Browse Source

REPORT-38778 1.新用户的小红点、弹窗提示;

2.去掉菜单项
3.新用户预装组件
feature/big-screen
Yuan.Wang 4 years ago
parent
commit
d6c6299733
  1. 32
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  2. 17
      designer-base/src/main/java/com/fr/design/mainframe/PromptWindow.java
  3. 20
      designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java
  4. 42
      designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java
  5. 34
      designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java
  6. 29
      designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java
  7. 22
      designer-base/src/main/java/com/fr/design/notification/AbstractSnapChat.java
  8. 4
      designer-base/src/main/java/com/fr/design/notification/SnapChat.java

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

@ -12,6 +12,8 @@ import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.icontainer.UIEastResizableContainer;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.menu.SnapChatUtil;
import com.fr.design.notification.SnapChat;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
@ -221,11 +223,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
String key = provider.key(); String key = provider.key();
PropertyItemBean itemBean = provider.getItem(); PropertyItemBean itemBean = provider.getItem();
PropertyItem propertyItem = new PropertyItem(itemBean.getName(), PropertyItem propertyItem = new PropertyItem(itemBean.getName(),
itemBean.getTitle(), itemBean.getTitle(),
itemBean.getBtnIconName(), itemBean.getBtnIconName(),
itemBean.getBtnIconBaseDir(), itemBean.getBtnIconBaseDir(),
itemBean.getVisibleModes(), itemBean.getVisibleModes(),
itemBean.getEnableModes()); itemBean.getEnableModes(),
itemBean.getSnapChat(),
itemBean.getPromptWindow());
UIButton button = propertyItem.getButton(); UIButton button = propertyItem.getButton();
List<ActionListener> buttonListeners = itemBean.getButtonListeners(); List<ActionListener> buttonListeners = itemBean.getButtonListeners();
if (buttonListeners != null) { if (buttonListeners != null) {
@ -657,6 +661,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
class PropertyItem { class PropertyItem {
private SnapChat snapChat;
private UIButton button; private UIButton button;
private String name; // 用于 card 切换 private String name; // 用于 card 切换
private String title; // 用于显示 private String title; // 用于显示
@ -667,6 +672,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private FixedPopupPane popupPane; // 左侧固定弹出框 private FixedPopupPane popupPane; // 左侧固定弹出框
private PopupToolPane popupToolPane; // 弹出工具条 private PopupToolPane popupToolPane; // 弹出工具条
private PopupDialog popupDialog; // 弹出框 private PopupDialog popupDialog; // 弹出框
private PromptWindow promptWindow; //提示窗
private boolean isPoppedOut = false; // 是否弹出 private boolean isPoppedOut = false; // 是否弹出
private boolean isVisible = true; // 是否可见 private boolean isVisible = true; // 是否可见
private boolean replace = false; // 是否被替代 private boolean replace = false; // 是否被替代
@ -687,14 +693,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) { public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) {
this(name, title, btnIconName, ICON_BASE_DIR, visibleModes, enableModes); this(name, title, btnIconName, ICON_BASE_DIR, visibleModes, enableModes, null,null);
} }
public PropertyItem(String name, String title, String btnIconName, String iconBaseDir, PropertyMode[] visibleModes, PropertyMode[] enableModes) { public PropertyItem(String name, String title, String btnIconName, String iconBaseDir, PropertyMode[] visibleModes, PropertyMode[] enableModes, SnapChat snapChat,PromptWindow promptWindow) {
this.name = name; this.name = name;
this.title = title; this.title = title;
this.btnIconName = btnIconName; this.btnIconName = btnIconName;
this.iconBaseDir = iconBaseDir; this.iconBaseDir = iconBaseDir;
this.snapChat = snapChat;
this.promptWindow = promptWindow;
initButton(); initButton();
initPropertyPanel(); initPropertyPanel();
initModes(visibleModes, enableModes); initModes(visibleModes, enableModes);
@ -875,6 +883,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
if (snapChat != null && !snapChat.hasRead()) {
SnapChatUtil.paintPropertyItemPoint(g, getBounds());
}
} }
}; };
button.set4LargeToolbarButton(); button.set4LargeToolbarButton();
@ -902,6 +913,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
popupFixedPane(); popupFixedPane();
} }
setTabButtonSelected(); setTabButtonSelected();
if (snapChat != null && !snapChat.hasRead()) {
snapChat.markRead();
}
if (promptWindow != null) {
promptWindow.showWindow();
}
} }
}); });
button.setToolTipText(title); button.setToolTipText(title);

17
designer-base/src/main/java/com/fr/design/mainframe/PromptWindow.java

@ -0,0 +1,17 @@
package com.fr.design.mainframe;
/**
* @Author: Yuan.Wang
* @Date: 2020/10/9
*/
public interface PromptWindow {
/**
* 显示弹窗
* */
void showWindow();
/**
* 影藏弹窗
* */
void hideWindow();
}

20
designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java

@ -1,5 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.design.notification.SnapChat;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.List; import java.util.List;
@ -12,6 +14,8 @@ public class PropertyItemBean {
private String title; private String title;
private String btnIconName; private String btnIconName;
private String btnIconBaseDir; private String btnIconBaseDir;
private SnapChat snapChat;
private PromptWindow promptWindow;
private EastRegionContainerPane.PropertyMode[] visibleModes; private EastRegionContainerPane.PropertyMode[] visibleModes;
private EastRegionContainerPane.PropertyMode[] enableModes; private EastRegionContainerPane.PropertyMode[] enableModes;
private List<ActionListener> buttonListeners; private List<ActionListener> buttonListeners;
@ -52,6 +56,22 @@ public class PropertyItemBean {
this.btnIconBaseDir = btnIconBaseDir; this.btnIconBaseDir = btnIconBaseDir;
} }
public SnapChat getSnapChat() {
return snapChat;
}
public void setSnapChat(SnapChat snapChat) {
this.snapChat = snapChat;
}
public PromptWindow getPromptWindow() {
return promptWindow;
}
public void setPromptWindow(PromptWindow promptWindow) {
this.promptWindow = promptWindow;
}
public EastRegionContainerPane.PropertyMode[] getVisibleModes() { public EastRegionContainerPane.PropertyMode[] getVisibleModes() {
return visibleModes; return visibleModes;
} }

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

@ -2,6 +2,7 @@ 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.SnapChatKey; import com.fr.design.notification.SnapChatKey;
@ -22,6 +23,17 @@ 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 = new AbstractSnapChat() {
@Override
public SnapChatKey key() {
return uniqueKey;
}
@Override
public boolean defaultStatus() {
return true;
}
};
public SnapChatMenuDef(String name, SnapChatKey uniqueKey) { public SnapChatMenuDef(String name, SnapChatKey uniqueKey) {
super(name); super(name);
@ -40,24 +52,22 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat {
@Override @Override
public boolean hasRead() { public boolean hasRead() {
return snapChat.hasRead();
String calcKey = calcKey();
Boolean val = SnapChatConfig.getInstance().hasRead(calcKey);
// 默认读过了。
return val == null ? defaultStatus() : val;
} }
@Override @Override
public void markRead() { public void markRead() {
snapChat.markRead();
String calcKey = calcKey();
SnapChatConfig.getInstance().markRead(calcKey);
} }
@Override @Override
public boolean defaultStatus() { public boolean defaultStatus() {
return snapChat.defaultStatus();
}
return true; @Override
public SnapChatKey key() {
return snapChat.key();
} }
@Override @Override
@ -74,13 +84,6 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat {
super.insertShortCut(index, shortCut); super.insertShortCut(index, shortCut);
} }
@Override
public SnapChatKey key() {
return this.uniqueKey;
}
@Override @Override
protected MenuListener createMenuListener() { protected MenuListener createMenuListener() {
@ -97,17 +100,12 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat {
if (shortCut instanceof SnapChatUpdateAction) { if (shortCut instanceof SnapChatUpdateAction) {
SnapChatUpdateAction action = (SnapChatUpdateAction) shortCut; SnapChatUpdateAction action = (SnapChatUpdateAction) shortCut;
if (!action.hasRead()) { if (!action.hasRead()) {
String calcKey = calcKey(); String calcKey = snapChat.calcKey();
SnapChatConfig.getInstance().resetRead(calcKey); SnapChatConfig.getInstance().resetRead(calcKey);
} }
} }
} }
private String calcKey() {
return key().calc();
}
@Override @Override
protected UIMenu createJMenu0() { protected UIMenu createJMenu0() {

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

@ -2,6 +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.SnapChatConfig;
import com.fr.design.notification.SnapChatKey; import com.fr.design.notification.SnapChatKey;
@ -15,13 +16,24 @@ public abstract class SnapChatUpdateAction extends UpdateAction implements SnapC
private SnapChatKey uniqueKey; private SnapChatKey uniqueKey;
private SnapChat snapChat = new AbstractSnapChat() {
@Override
public SnapChatKey key() {
return uniqueKey;
}
@Override
public boolean defaultStatus() {
return false;
}
};
public SnapChatUpdateAction(SnapChatKey uniqueKey) { public SnapChatUpdateAction(SnapChatKey uniqueKey) {
this.uniqueKey = uniqueKey; this.uniqueKey = uniqueKey;
} }
@Override @Override
public final void actionPerformed(ActionEvent e) { public final void actionPerformed(ActionEvent e) {
markRead(); markRead();
actionPerformed0(e); actionPerformed0(e);
} }
@ -30,34 +42,22 @@ public abstract class SnapChatUpdateAction extends UpdateAction implements SnapC
@Override @Override
public boolean hasRead() { public boolean hasRead() {
return snapChat.hasRead();
String calcKey = calcKey();
Boolean val = SnapChatConfig.getInstance().hasRead(calcKey);
return val == null ? defaultStatus() : val;
} }
@Override @Override
public void markRead() { public void markRead() {
snapChat.markRead();
String calcKey = calcKey();
SnapChatConfig.getInstance().markRead(calcKey);
} }
@Override @Override
public boolean defaultStatus() { public boolean defaultStatus() {
return snapChat.defaultStatus();
return false;
} }
@Override @Override
public SnapChatKey key() { public SnapChatKey key() {
return snapChat.key();
return this.uniqueKey;
}
private String calcKey() {
return key().calc();
} }
@Override @Override

29
designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java

@ -10,24 +10,31 @@ import java.awt.geom.Ellipse2D;
* created by Harrison on 2020/03/22 * created by Harrison on 2020/03/22
**/ **/
public class SnapChatUtil { public class SnapChatUtil {
private static final int WIDTH = 4;
private static final int HEIGHT = 4;
private static final int TOP_GAP = 4;
private static final int RIGHT_GAP = 6;
/**
* 绘制菜单项的小红点
*/
public static void paintSnapChat(Graphics g, Rectangle textRect) { public static void paintSnapChat(Graphics g, Rectangle textRect) {
double x = textRect.getWidth() + textRect.getX() + 2;
Color oldColor = g.getColor();
double x = textRect.getWidth();
x += textRect.getX();
x += 2;
double y = textRect.getY(); double y = textRect.getY();
paintRedPoint(g, new Ellipse2D.Double(x, y, WIDTH, HEIGHT));
}
public static void paintPropertyItemPoint(Graphics g, Rectangle bounds) {
double x = bounds.getWidth() - RIGHT_GAP;
paintRedPoint(g, new Ellipse2D.Double(x, TOP_GAP, WIDTH, HEIGHT));
}
private static void paintRedPoint(Graphics g, Ellipse2D.Double shape) {
Color oldColor = g.getColor();
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.red); g2d.setColor(Color.red);
Ellipse2D.Double shape =
new Ellipse2D.Double(x, y, 4, 4);
g2d.fill(shape); g2d.fill(shape);
g2d.draw(shape); g2d.draw(shape);
g2d.setColor(oldColor); g2d.setColor(oldColor);
} }
} }

22
designer-base/src/main/java/com/fr/design/notification/AbstractSnapChat.java

@ -0,0 +1,22 @@
package com.fr.design.notification;
/**
* @Author: Yuan.Wang
* @Date: 2020/9/27
*/
public abstract class AbstractSnapChat implements SnapChat {
@Override
public boolean hasRead() {
String calcKey = calcKey();
Boolean val = SnapChatConfig.getInstance().hasRead(calcKey);
return val == null ? defaultStatus() : val;
}
@Override
public void markRead() {
String calcKey = calcKey();
SnapChatConfig.getInstance().markRead(calcKey);
}
}

4
designer-base/src/main/java/com/fr/design/notification/SnapChat.java

@ -32,4 +32,8 @@ public interface SnapChat {
* @return 字符标志 * @return 字符标志
*/ */
SnapChatKey key(); SnapChatKey key();
default String calcKey() {
return key().calc();
}
} }

Loading…
Cancel
Save