Qinghui.Liu
4 years ago
17 changed files with 307 additions and 239 deletions
@ -0,0 +1,20 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import javax.swing.JWindow; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/10/9 |
||||
* 只关心Window的显示和隐藏操作时可以实现该接口 |
||||
*/ |
||||
public interface PromptWindow { |
||||
/** |
||||
* 显示弹窗 |
||||
*/ |
||||
void showWindow(); |
||||
|
||||
/** |
||||
* 隐藏弹窗 |
||||
*/ |
||||
void hideWindow(); |
||||
} |
@ -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); |
||||
} |
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.fr.design.notification; |
||||
|
||||
import com.fr.plugin.context.PluginContext; |
||||
|
||||
/** |
||||
* @Author: Yuan.Wang |
||||
* @Date: 2020/10/10 |
||||
*/ |
||||
public class SnapChatFactory { |
||||
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() { |
||||
@Override |
||||
public boolean defaultStatus() { |
||||
return defaultStatus; |
||||
} |
||||
|
||||
@Override |
||||
public SnapChatKey key() { |
||||
return snapChatKey; |
||||
} |
||||
|
||||
@Override |
||||
public String calcKey() { |
||||
return context == null ? key().calc() : key().calc(context); |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -1,9 +1,18 @@
|
||||
package com.fr.design.notification; |
||||
|
||||
import com.fr.plugin.context.PluginContext; |
||||
|
||||
/** |
||||
* created by Harrison on 2020/03/16 |
||||
**/ |
||||
public interface SnapChatKey { |
||||
|
||||
String calc(); |
||||
|
||||
/** |
||||
* 插件刚被安装时不能通过PluginContexts.getContext()方法获取插件上下文,因此加一个接口 |
||||
*/ |
||||
default String calc(PluginContext context) { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue