Browse Source

REPORT-38778 去掉社区和模板商城的小红点,修正使用工厂类引起的bug,修改预装组件的逻辑

feature/big-screen
Yuan.Wang 4 years ago
parent
commit
1108edcbf3
  1. 7
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  2. 6
      designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java
  3. 6
      designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java
  4. 11
      designer-base/src/main/java/com/fr/design/notification/SnapChatFactory.java
  5. 9
      designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java

7
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -54,9 +54,7 @@ import com.fr.design.mainframe.ToolBarNewTemplatePane;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.SnapChatMenuDef;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.notification.SnapChatAllTypes;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction; import com.fr.design.update.actions.SoftwareUpdateAction;
@ -656,10 +654,7 @@ public abstract class ToolBarMenuDock {
public MenuDef createCommunityMenuDef() { public MenuDef createCommunityMenuDef() {
MenuDef menuDef = new SnapChatMenuDef( MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"), 'C');
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"),
'C',
SnapChatAllTypes.Menu.BBS);
ShortCut[] otherCommunityShortCuts = createCommunityShortCuts(); ShortCut[] otherCommunityShortCuts = createCommunityShortCuts();
for (ShortCut shortCut : otherCommunityShortCuts) { for (ShortCut shortCut : otherCommunityShortCuts) {
menuDef.addShortCut(shortCut); menuDef.addShortCut(shortCut);

6
designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java

@ -2,7 +2,6 @@ package com.fr.design.menu;
import com.fr.design.gui.imenu.UIMenu; import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIScrollMenu; import com.fr.design.gui.imenu.UIScrollMenu;
import com.fr.design.notification.AbstractSnapChat;
import com.fr.design.notification.SnapChat; import com.fr.design.notification.SnapChat;
import com.fr.design.notification.SnapChatConfig; import com.fr.design.notification.SnapChatConfig;
import com.fr.design.notification.SnapChatFactory; import com.fr.design.notification.SnapChatFactory;
@ -24,21 +23,24 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat {
private SnapChatKey uniqueKey; private SnapChatKey uniqueKey;
private SnapChatMenuUI menuUI = new SnapChatMenuUI(this); private SnapChatMenuUI menuUI = new SnapChatMenuUI(this);
private SnapChat snapChat = SnapChatFactory.createSnapChat(true, uniqueKey); private SnapChat snapChat ;
public SnapChatMenuDef(String name, SnapChatKey uniqueKey) { public SnapChatMenuDef(String name, SnapChatKey uniqueKey) {
super(name); super(name);
this.uniqueKey = uniqueKey; this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(true, uniqueKey);
} }
public SnapChatMenuDef(Boolean rePaint, SnapChatKey uniqueKey) { public SnapChatMenuDef(Boolean rePaint, SnapChatKey uniqueKey) {
super(rePaint); super(rePaint);
this.uniqueKey = uniqueKey; this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(true, uniqueKey);
} }
public SnapChatMenuDef(String name, char mnemonic, SnapChatKey uniqueKey) { public SnapChatMenuDef(String name, char mnemonic, SnapChatKey uniqueKey) {
super(name, mnemonic); super(name, mnemonic);
this.uniqueKey = uniqueKey; this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(true, uniqueKey);
} }
@Override @Override

6
designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java

@ -2,9 +2,7 @@ package com.fr.design.menu;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.notification.AbstractSnapChat;
import com.fr.design.notification.SnapChat; import com.fr.design.notification.SnapChat;
import com.fr.design.notification.SnapChatConfig;
import com.fr.design.notification.SnapChatFactory; import com.fr.design.notification.SnapChatFactory;
import com.fr.design.notification.SnapChatKey; import com.fr.design.notification.SnapChatKey;
@ -16,11 +14,11 @@ import java.awt.event.ActionEvent;
public abstract class SnapChatUpdateAction extends UpdateAction implements SnapChat { public abstract class SnapChatUpdateAction extends UpdateAction implements SnapChat {
private SnapChatKey uniqueKey; private SnapChatKey uniqueKey;
private SnapChat snapChat ;
private SnapChat snapChat = SnapChatFactory.createSnapChat(false, uniqueKey);
public SnapChatUpdateAction(SnapChatKey uniqueKey) { public SnapChatUpdateAction(SnapChatKey uniqueKey) {
this.uniqueKey = uniqueKey; this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(false, uniqueKey);
} }
@Override @Override

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

@ -1,11 +1,17 @@
package com.fr.design.notification; package com.fr.design.notification;
import com.fr.plugin.context.PluginContext;
/** /**
* @Author: Yuan.Wang * @Author: Yuan.Wang
* @Date: 2020/10/10 * @Date: 2020/10/10
*/ */
public class SnapChatFactory { public class SnapChatFactory {
public static SnapChat createSnapChat(boolean defaultStatus, SnapChatKey snapChatKey) { public static SnapChat createSnapChat(boolean defaultStatus, SnapChatKey snapChatKey) {
return createSnapChat(defaultStatus, snapChatKey, null);
}
public static SnapChat createSnapChat(boolean defaultStatus, SnapChatKey snapChatKey, PluginContext context) {
return new AbstractSnapChat() { return new AbstractSnapChat() {
@Override @Override
public boolean defaultStatus() { public boolean defaultStatus() {
@ -16,6 +22,11 @@ public class SnapChatFactory {
public SnapChatKey key() { public SnapChatKey key() {
return snapChatKey; return snapChatKey;
} }
@Override
public String calcKey() {
return context == null ? key().calc() : key().calc(context);
}
}; };
} }
} }

9
designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java

@ -1,9 +1,18 @@
package com.fr.design.notification; package com.fr.design.notification;
import com.fr.plugin.context.PluginContext;
/** /**
* created by Harrison on 2020/03/16 * created by Harrison on 2020/03/16
**/ **/
public interface SnapChatKey { public interface SnapChatKey {
String calc(); String calc();
/**
* 插件刚被安装时不能通过PluginContexts.getContext()方法获取插件上下文因此加一个接口
*/
default String calc(PluginContext context) {
throw new UnsupportedOperationException();
}
} }

Loading…
Cancel
Save