Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~qinghui.liu/design into release/10.0

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
7f927f658f
  1. 4
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  2. 67
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java
  3. 17
      designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java
  4. 54
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  5. 20
      designer-base/src/main/java/com/fr/design/mainframe/PromptWindow.java
  6. 54
      designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java
  7. 43
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  8. 47
      designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java
  9. 49
      designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java
  10. 31
      designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java
  11. 22
      designer-base/src/main/java/com/fr/design/notification/AbstractSnapChat.java
  12. 4
      designer-base/src/main/java/com/fr/design/notification/SnapChat.java
  13. 32
      designer-base/src/main/java/com/fr/design/notification/SnapChatFactory.java
  14. 11
      designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java
  15. 67
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  16. 16
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  17. 8
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTabCommonSettingPane.java

4
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -442,7 +442,7 @@ public class PreviewTablePane extends BasicPane {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
previewTablePane.fireLoadedListener();
previewTablePane.showWindow(DesignerContext.getDesignerFrame()).setVisible(true);
previewTablePane.showWindow(new JFrame()).setVisible(true);
}
/**
@ -475,7 +475,7 @@ public class PreviewTablePane extends BasicPane {
};
prieviewPane.setLayout(FRGUIPaneFactory.createBorderLayout());
prieviewPane.add(tabPreviewpane, BorderLayout.CENTER);
prieviewPane.showWindow(DesignerContext.getDesignerFrame()).setVisible(true);
prieviewPane.showWindow(new JFrame()).setVisible(true);
}
private void populateStoreDataSQL() throws Exception {

67
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java

@ -7,17 +7,16 @@ import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.data.operator.DataOperator;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.Icon;
import javax.swing.JOptionPane;
import javax.swing.JFrame;
import javax.swing.SwingWorker;
import java.util.ArrayList;
import java.util.Arrays;
@ -50,7 +49,6 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
private AutoProgressBar connectionBar;
private ProcedureDataModel[] dataModels;
private SwingWorker worker;
private BasicDialog dialog;
private int previewModel;
public StoreProcedureDataWrapper(StoreProcedure storeProcedure, String storeprocedureName, String dsName) {
@ -71,19 +69,8 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
if (needLoad) {
setWorker();
}
dialog = PreviewTablePane.getInstance().getDialog();
dialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
getWorker().cancel(true);
}
public void doCancel() {
getWorker().cancel(true);
}
});
loadingBar = new AutoProgressBar(dialog, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
loadingBar = new AutoProgressBar(new JFrame(), Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
public void doMonitorCanceled() {
getDialog().setVisible(false);
getWorker().cancel(true);
}
};
@ -93,17 +80,17 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
* 数据集执行结果返回的所有字段
*
* @return 数据集执行结果返回的所有字段
*
*
*
* @date 2014-12-3-下午7:43:17
*
*
*/
public List<String> calculateColumnNameList() {
if (columnNameList != null) {
return columnNameList;
}
if (!createStore(false)) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData"));
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData"));
return new ArrayList<String>();
}
columnNameList = Arrays.asList(procedureDataModel.getColumnName());
@ -114,10 +101,10 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
* 生成子节点
*
* @return 节点数组
*
*
*
* @date 2014-12-3-下午7:06:47
*
*
*/
public ExpandMutableTreeNode[] load() {
List<String> namelist;
@ -160,25 +147,16 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
/**
* 预览数据
*
*
* @param previewModel 预览模式, 全部还是一个
*
*
*
* @date 2014-12-3-下午7:05:50
*
*
*/
public void previewData(final int previewModel) {
this.previewModel = previewModel;
new SwingWorker() {
protected Object doInBackground() throws Exception {
loadingBar.close();
PreviewTablePane.resetPreviewTable();
dialog.setVisible(true);
return null;
}
}.execute();
connectionBar = new AutoProgressBar(dialog, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Now_Create_Connection"), "", 0, 100) {
connectionBar = new AutoProgressBar(new JFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Now_Create_Connection"), "", 0, 100) {
public void doMonitorCanceled() {
connectionBar.close();
worker.cancel(true);
@ -190,13 +168,13 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
private void setWorker() {
worker = new SwingWorker<Void, Void>() {
protected Void doInBackground() throws Exception {
loadingBar.close();
PreviewTablePane.resetPreviewTable();
connectionBar.start();
boolean status = DataOperator.getInstance().testConnection(((StoreProcedure) getTableData()).getDatabaseConnection());
if (!status) {
connectionBar.close();
// bug 61345 预览失败时,关闭窗口
dialog.setVisible(false);
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
}
connectionBar.close();
storeProcedure.resetDataModelList();
@ -208,7 +186,6 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
try {
get();
loadingBar.close();
dialog.setVisible(false);
switch (previewModel) {
case StoreProcedureDataWrapper.PREVIEW_ALL:
PreviewTablePane.previewStoreDataWithAllDs(dataModels);
@ -228,10 +205,6 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
};
}
private BasicDialog getDialog() {
return this.dialog;
}
private SwingWorker getWorker() {
return this.worker;
}
@ -240,10 +213,10 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
/**
* 预览返回的一个数据集
*
*
*
* @date 2014-12-3-下午7:42:53
*
*
*/
public void previewData() {
previewData(-1, -1);
@ -253,13 +226,13 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
/**
* 预览返回的一个数据集带有显示值和实际值的标记结果
*
*
* @param keyIndex 实际值
* @param valueIndex 显示值
*
*
*
* @date 2014-12-3-下午7:42:27
*
*
*/
public void previewData(final int keyIndex, final int valueIndex) {
PreviewTablePane.previewStoreData(procedureDataModel, keyIndex, valueIndex);

17
designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java

@ -156,7 +156,20 @@ public enum SupportLocaleImpl implements SupportLocale {
set.add(Locale.TAIWAN);
return set;
}
}
},
/**
* 更新升级-帮助菜单下
*/
UPDATE_HELP {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<>();
set.add(Locale.US);
set.add(Locale.KOREA);
set.add(Locale.CHINA);
set.add(Locale.TAIWAN);
return set;
}
}
}

54
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.ilable.UILabel;
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.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
@ -171,7 +173,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
updateAllPropertyPane();
}
}); }
});
}
}, filter);
PluginListenerRegistration.getInstance().listen(
PluginEventType.BeforeStop,
@ -221,11 +224,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
String key = provider.key();
PropertyItemBean itemBean = provider.getItem();
PropertyItem propertyItem = new PropertyItem(itemBean.getName(),
itemBean.getTitle(),
itemBean.getBtnIconName(),
itemBean.getBtnIconBaseDir(),
itemBean.getVisibleModes(),
itemBean.getEnableModes());
itemBean.getTitle(),
itemBean.getBtnIconName(),
itemBean.getBtnIconBaseDir(),
itemBean.getVisibleModes(),
itemBean.getEnableModes(),
itemBean.getSnapChat(),
itemBean.getPromptWindow());
UIButton button = propertyItem.getButton();
List<ActionListener> buttonListeners = itemBean.getButtonListeners();
if (buttonListeners != null) {
@ -324,6 +329,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
cellElement.popupDialog.showDefaultPane();
}
}
// 禁用单元格元素tab
private void enableCellElementPane(PropertyItem cellElement) {
cellElement.setEnabled(true);
@ -381,7 +387,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
/**
* 可通过此方法判断当前的编辑模式
* */
*/
public PropertyMode getCurrentMode() {
return currentMode;
}
@ -527,7 +533,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane);
}
public static void main(String[] args){
public static void main(String[] args) {
JFrame jf = new JFrame("test");
// jf = new JFrame("test");
@ -549,7 +555,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
// leftPane.add(b2);
// leftPane.setLayout(new BoxLayout(leftPane, BoxLayout.Y_AXIS));
JPanel content = (JPanel)jf.getContentPane();
JPanel content = (JPanel) jf.getContentPane();
// content.setLayout(null);
content.add(cc, BorderLayout.CENTER);
content.add(new EastRegionContainerPane(), BorderLayout.EAST);
@ -657,6 +663,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
class PropertyItem {
private SnapChat snapChat;
private UIButton button;
private String name; // 用于 card 切换
private String title; // 用于显示
@ -667,6 +674,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private FixedPopupPane popupPane; // 左侧固定弹出框
private PopupToolPane popupToolPane; // 弹出工具条
private PopupDialog popupDialog; // 弹出框
private PromptWindow promptWindow; //提示窗
private boolean isPoppedOut = false; // 是否弹出
private boolean isVisible = true; // 是否可见
private boolean replace = false; // 是否被替代
@ -687,14 +695,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
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.title = title;
this.btnIconName = btnIconName;
this.iconBaseDir = iconBaseDir;
this.snapChat = snapChat;
this.promptWindow = promptWindow;
initButton();
initPropertyPanel();
initModes(visibleModes, enableModes);
@ -835,7 +845,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
if (isRightPaneVisible()) {
hideCurrentPopupPane();
replaceContentPane(contentPane);
} else if(popupPane != null && popupPane.isVisible()) {
} else if (popupPane != null && popupPane.isVisible()) {
popupPane.replaceContentPane(contentArea);
}
}
@ -872,9 +882,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public Dimension getPreferredSize() {
return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT);
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (snapChat != null && !snapChat.hasRead()) {
SnapChatUtil.paintPropertyItemPoint(g, getBounds());
}
}
};
button.set4LargeToolbarButton();
@ -902,6 +916,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
popupFixedPane();
}
setTabButtonSelected();
if (snapChat != null && !snapChat.hasRead()) {
snapChat.markRead();
if (promptWindow != null) {
promptWindow.showWindow();
}
}
}
});
button.setToolTipText(title);
@ -1015,8 +1035,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
/**
* @Description:刷新currentPopupPane面板位置当设计器缩放时会调用这个函数
* @param
* @Description:刷新currentPopupPane面板位置当设计器缩放时会调用这个函数
* @return:
* @Author: Henry.Wang
* @date: 2020/7/30 11:39
@ -1031,8 +1051,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
/**
* @Description:清空currentPopupPane数据当切换模板时会调用这个函数
* @param
* @Description:清空currentPopupPane数据当切换模板时会调用这个函数
* @return:
* @Author: Henry.Wang
* @date: 2020/7/30 11:42
@ -1071,12 +1091,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
repaint();
}
@Override
public void mouseClicked(MouseEvent e) {
if (e.getX() >= ARROW_RANGE_START) {
onPop();
}
}
@Override
public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null;
@ -1084,6 +1106,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
contentPane.setBackground(originColor);
}
}
@Override
public void mousePressed(MouseEvent e) {
if (e.getX() < ARROW_RANGE_START) {
@ -1105,6 +1128,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
repaint();
}
@Override
public void mouseDragged(MouseEvent e) {
if (isMovable && mouseDownCompCoords != null) {
@ -1217,6 +1241,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private Container contentPane;
private JPanel defaultPane; // 无可用配置项
private PropertyItem propertyItem;
public PopupDialog(PropertyItem propertyItem) {
super(DesignerContext.getDesignerFrame());
container = getContentPane();
@ -1319,6 +1344,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
mouseDownCompCoords = e.getLocationOnScreen();
}
}
@Override
public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null;

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

@ -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();
}

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

@ -1,5 +1,7 @@
package com.fr.design.mainframe;
import com.fr.design.notification.SnapChat;
import java.awt.event.ActionListener;
import java.util.List;
@ -7,71 +9,89 @@ import java.util.List;
* created by Harrison on 2020/03/23
**/
public class PropertyItemBean {
private String name;
private String title;
private String btnIconName;
private String btnIconBaseDir;
private SnapChat snapChat;
private PromptWindow promptWindow;
private EastRegionContainerPane.PropertyMode[] visibleModes;
private EastRegionContainerPane.PropertyMode[] enableModes;
private List<ActionListener> buttonListeners;
public PropertyItemBean() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBtnIconName() {
return btnIconName;
}
public void setBtnIconName(String btnIconName) {
this.btnIconName = btnIconName;
}
public String getBtnIconBaseDir() {
return btnIconBaseDir;
}
public void setBtnIconBaseDir(String 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() {
return visibleModes;
}
public void setVisibleModes(EastRegionContainerPane.PropertyMode[] visibleModes) {
this.visibleModes = visibleModes;
}
public EastRegionContainerPane.PropertyMode[] getEnableModes() {
return enableModes;
}
public void setEnableModes(EastRegionContainerPane.PropertyMode[] enableModes) {
this.enableModes = enableModes;
}
public List<ActionListener> getButtonListeners() {
return buttonListeners;
}
public void setButtonListeners(List<ActionListener> buttonListeners) {
this.buttonListeners = buttonListeners;
}

43
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.SeparatorDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.SnapChatMenuDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.notification.SnapChatAllTypes;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction;
@ -530,35 +528,18 @@ public abstract class ToolBarMenuDock {
* @return 帮组菜单的子菜单
*/
public ShortCut[] createHelpShortCuts() {
final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
Locale locale = GeneralContext.getLocale();
final java.util.List<ShortCut> shortCuts = new ArrayList<>();
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new VideoAction());
}
}, SupportLocaleImpl.VIDEO);
LocaleCenter.buildAction(() -> shortCuts.add(new VideoAction()), SupportLocaleImpl.VIDEO);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new TutorialAction());
}
}, SupportLocaleImpl.TUTORIAL_HELP);
LocaleCenter.buildAction(() -> shortCuts.add(new TutorialAction()), SupportLocaleImpl.TUTORIAL_HELP);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new TechSupportAction());
}
}, SupportLocaleImpl.TECH_SUPPORT_HELP);
LocaleCenter.buildAction(() -> shortCuts.add(new TechSupportAction()), SupportLocaleImpl.TECH_SUPPORT_HELP);
//远程不使用更新升级,产品演示
if (WorkContext.getCurrent().isLocal()) {
shortCuts.add(new WebDemoAction());
shortCuts.add(new SoftwareUpdateAction());
LocaleCenter.buildAction(() -> shortCuts.add(new SoftwareUpdateAction()), SupportLocaleImpl.UPDATE_HELP);
}
if (AlphaFineConfigManager.isALPHALicAvailable()) {
shortCuts.add(new AlphaFineAction());
@ -566,12 +547,7 @@ public abstract class ToolBarMenuDock {
shortCuts.add(SeparatorDef.DEFAULT);
if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
shortCuts.add(new FineUIAction());
}
}, SupportOSImpl.FINEUI);
OSSupportCenter.buildAction(objects -> shortCuts.add(new FineUIAction()), SupportOSImpl.FINEUI);
}
shortCuts.add(new AboutAction());
@ -655,11 +631,8 @@ public abstract class ToolBarMenuDock {
}
public MenuDef createCommunityMenuDef() {
MenuDef menuDef = new SnapChatMenuDef(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"),
'C',
SnapChatAllTypes.Menu.BBS);
MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"), 'C');
ShortCut[] otherCommunityShortCuts = createCommunityShortCuts();
for (ShortCut shortCut : otherCommunityShortCuts) {
menuDef.addShortCut(shortCut);

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

@ -4,6 +4,7 @@ import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIScrollMenu;
import com.fr.design.notification.SnapChat;
import com.fr.design.notification.SnapChatConfig;
import com.fr.design.notification.SnapChatFactory;
import com.fr.design.notification.SnapChatKey;
import javax.swing.JMenu;
@ -19,47 +20,49 @@ import java.awt.image.BufferedImage;
* created by Harrison on 2020/03/16
**/
public class SnapChatMenuDef extends MenuDef implements SnapChat {
private SnapChatKey uniqueKey;
private SnapChatMenuUI menuUI = new SnapChatMenuUI(this);
private SnapChat snapChat ;
public SnapChatMenuDef(String name, SnapChatKey uniqueKey) {
super(name);
this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(true, uniqueKey);
}
public SnapChatMenuDef(Boolean rePaint, SnapChatKey uniqueKey) {
super(rePaint);
this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(true, uniqueKey);
}
public SnapChatMenuDef(String name, char mnemonic, SnapChatKey uniqueKey) {
super(name, mnemonic);
this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(true, uniqueKey);
}
@Override
public boolean hasRead() {
String calcKey = calcKey();
Boolean val = SnapChatConfig.getInstance().hasRead(calcKey);
// 默认读过了。
return val == null ? defaultStatus() : val;
return snapChat.hasRead();
}
@Override
public void markRead() {
String calcKey = calcKey();
SnapChatConfig.getInstance().markRead(calcKey);
snapChat.markRead();
}
@Override
public boolean defaultStatus() {
return true;
return snapChat.defaultStatus();
}
@Override
public SnapChatKey key() {
return snapChat.key();
}
@Override
public void addShortCut(ShortCut shortCut) {
@ -74,13 +77,6 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat {
super.insertShortCut(index, shortCut);
}
@Override
public SnapChatKey key() {
return this.uniqueKey;
}
@Override
protected MenuListener createMenuListener() {
@ -97,17 +93,12 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat {
if (shortCut instanceof SnapChatUpdateAction) {
SnapChatUpdateAction action = (SnapChatUpdateAction) shortCut;
if (!action.hasRead()) {
String calcKey = calcKey();
String calcKey = snapChat.calcKey();
SnapChatConfig.getInstance().resetRead(calcKey);
}
}
}
private String calcKey() {
return key().calc();
}
@Override
protected UIMenu createJMenu0() {

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

@ -3,7 +3,7 @@ package com.fr.design.menu;
import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.notification.SnapChat;
import com.fr.design.notification.SnapChatConfig;
import com.fr.design.notification.SnapChatFactory;
import com.fr.design.notification.SnapChatKey;
import java.awt.event.ActionEvent;
@ -12,57 +12,46 @@ import java.awt.event.ActionEvent;
* created by Harrison on 2020/03/22
**/
public abstract class SnapChatUpdateAction extends UpdateAction implements SnapChat {
private SnapChatKey uniqueKey;
private SnapChat snapChat ;
public SnapChatUpdateAction(SnapChatKey uniqueKey) {
this.uniqueKey = uniqueKey;
snapChat = SnapChatFactory.createSnapChat(false, uniqueKey);
}
@Override
public final void actionPerformed(ActionEvent e) {
markRead();
actionPerformed0(e);
}
protected abstract void actionPerformed0(ActionEvent e);
@Override
public boolean hasRead() {
String calcKey = calcKey();
Boolean val = SnapChatConfig.getInstance().hasRead(calcKey);
return val == null ? defaultStatus() : val;
return snapChat.hasRead();
}
@Override
public void markRead() {
String calcKey = calcKey();
SnapChatConfig.getInstance().markRead(calcKey);
snapChat.markRead();
}
@Override
public boolean defaultStatus() {
return false;
return snapChat.defaultStatus();
}
@Override
public SnapChatKey key() {
return this.uniqueKey;
}
private String calcKey() {
return key().calc();
return snapChat.key();
}
@Override
public UIMenuItem createMenuItem() {
Object object = this.getValue(UIMenuItem.class.getName());
if (object == null && !(object instanceof UIMenuItem)) {
UIMenuItem menuItem = new UIMenuItem(this);
@ -70,10 +59,10 @@ public abstract class SnapChatUpdateAction extends UpdateAction implements SnapC
menuItem.setName(getName());
menuItem.setUI(new SnapChatMenuItemUI(this));
object = menuItem;
this.putValue(UIMenuItem.class.getName(), object);
}
return (UIMenuItem) object;
}
}

31
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
**/
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) {
Color oldColor = g.getColor();
double x = textRect.getWidth();
x += textRect.getX();
x += 2;
double x = textRect.getWidth() + textRect.getX() + 2;
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;
g2d.setColor(Color.red);
Ellipse2D.Double shape =
new Ellipse2D.Double(x, y, 4, 4);
g2d.fill(shape);
g2d.draw(shape);
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 字符标志
*/
SnapChatKey key();
default String calcKey() {
return key().calc();
}
}

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

@ -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);
}
};
}
}

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

@ -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();
}
}

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

@ -10,6 +10,7 @@ import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import com.fr.workspace.Workspace;
@ -17,6 +18,7 @@ import com.fr.workspace.WorkspaceEvent;
import javax.swing.*;
import java.io.File;
import java.util.Locale;
/**
* @author richie
@ -27,6 +29,7 @@ public class UpmFinder {
private static final String UPM_DIR = "/upm";
private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html";
private static final String JXBROWSER = "com.teamdev.jxbrowser.chromium.Browser";
public static String installHome = FRContext.getCommonOperator().getWebRootPath();
@ -56,39 +59,49 @@ public class UpmFinder {
}
public static void showUPMDialog() {
boolean flag = true;
boolean hasJxBrowser = true;
try {
Class.forName("com.teamdev.jxbrowser.chromium.Browser");
Class.forName(JXBROWSER);
} catch (ClassNotFoundException e) {
flag = false;
hasJxBrowser = false;
}
if (flag) {
if (!checkUPMResourcesExist()){
// upm下载
int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
if (val == JOptionPane.OK_OPTION){
try {
UpmResourceLoader.INSTANCE.download();
UpmResourceLoader.INSTANCE.install();
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"),
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE);
} catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"),
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE);
}
if (hasJxBrowser) {
showUpmPane();
} else {
showUpdatePane();
}
}
private static void showUpmPane() {
if (!checkUPMResourcesExist()){
// upm下载
int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
if (val == JOptionPane.OK_OPTION){
try {
UpmResourceLoader.INSTANCE.download();
UpmResourceLoader.INSTANCE.install();
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"),
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE);
} catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"),
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE);
}
}
else {
UpmShowPane upmPane = new UpmShowPane();
if (dialog == null) {
dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane);
}
dialog.setVisible(true);
}
else {
UpmShowPane upmPane = new UpmShowPane();
if (dialog == null) {
dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane);
}
} else {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
dialog.setVisible(true);
}
}
private static void showUpdatePane() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
if (!GeneralContext.getLocale().equals(Locale.JAPAN)) {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.setAutoUpdateAfterInit();
dialog.showDialog();

16
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java

@ -731,8 +731,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
attrTooltipContent.setTextAttr(this.textAttrPane.update());
}
updateFormatsWithPaneWidth(attrTooltipContent);
htmlLabelPane.update(attrTooltipContent.getHtmlLabel());
return attrTooltipContent;
@ -809,18 +807,4 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
tooltipRichText.setAuto(richText.isAuto());
}
}
/**
* CHART-1295
* 通过格式的面板宽度来判断在自定义js代码中是否显示this.seriesName字符串
* 图表对于其他的格式有要求也可以在这里继续添加
*
* @param attrTooltipContent
*/
private void updateFormatsWithPaneWidth(AttrTooltipContent attrTooltipContent) {
int paneWidth = seriesNameFormatPane.getWidth();
if (paneWidth == 0) {
attrTooltipContent.getSeriesFormat().setEnable(false);
}
}
}

8
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTabCommonSettingPane.java

@ -133,14 +133,6 @@ public class MobileTabCommonSettingPane extends BasicPane {
tableConfigJPanel.add(dotIndicatorSettingPanel, BorderLayout.CENTER);
this.add(tableConfigJPanel, BorderLayout.CENTER);
tabSlideCheck.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
showTabDotIndicatorCheck.setVisible(tabSlideCheck.isSelected());
dotIndicatorSettingPanel.setVisible(tabSlideCheck.isSelected() && showTabDotIndicatorCheck.isSelected());
}
});
showTabDotIndicatorCheck.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {

Loading…
Cancel
Save