Browse Source

Merge branch 'feature/big-screen' of ssh://code.fineres.com:7999/~zheng/C-design into feature/big-screen

feature/big-screen
shine 3 years ago
parent
commit
8a689f647e
  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. 35
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java
  6. 2
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  7. 6
      designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java
  8. 4
      designer-base/src/main/java/com/fr/design/mainframe/ComponentReuseNotifyUtil.java
  9. 2
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  10. 23
      designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java
  11. 16
      designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java
  12. 6
      designer-base/src/main/java/com/fr/design/notification/NotificationCenter.java
  13. 18
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java
  14. 4
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java
  15. 2
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  16. 2
      designer-base/src/main/resources/com/fr/design/login/login.js
  17. 247
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  18. 44
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
  19. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java
  20. 11
      designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java
  21. BIN
      designer-form/src/main/resources/com/fr/design/form/images/version_not_match.png
  22. 5
      designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java
  23. 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 boolean showTemplateMissingPlugin = true;
/**
* DesignerEnvManager.
*/
@ -315,8 +317,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
LogHandler handler = new LogHandler<FileAppender>() {
final FileAppender appender = new FileAppender(
new com.fr.third.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n"),
fileName
new com.fr.third.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n"),
fileName
);
@Override
@ -621,6 +623,24 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
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);
}
@ -1792,6 +1812,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.setRecentSelectedConnection(tmpVal);
}
this.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false));
this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true));
}
private void readReportPaneAttributions(XMLableReader reader) {
@ -2060,6 +2081,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (this.isEmbedServerLazyStartup()) {
writer.attr("embedServerLazyStartup", this.isEmbedServerLazyStartup());
}
if (!this.isShowTemplateMissingPlugin()) {
writer.attr("showTemplateMissingPlugin", this.isShowTemplateMissingPlugin());
}
writer.end();
}
@ -2212,11 +2236,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
enum XmlHandler {
Self;
public void handle(Throwable throwable) {
ErrorDialog dialog = new ErrorDialog(null,
Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"),
Toolkit.i18nText("Fine-Design_Error_Start_Report"),
throwable.getMessage()) {
Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"),
Toolkit.i18nText("Fine-Design_Error_Start_Report"),
throwable.getMessage()) {
@Override
protected void okEvent() {
dispose();
@ -2232,5 +2257,5 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
dialog.setVisible(true);
DesignerExiter.getInstance().execute();
}
};
}
}

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

@ -96,8 +96,9 @@ public class EnvChangeEntrance {
* @param envName 目标工作目录名称
*/
public void switch2Env(final String envName) {
switch2Env(envName, PopTipStrategy.LATER);
VersionCheckUtils.showVersionCheckDialog(envName);
if (switch2Env(envName, PopTipStrategy.LATER)) {
VersionCheckUtils.showVersionCheckDialog(envName);
}
}
/**
@ -445,9 +446,12 @@ public class EnvChangeEntrance {
@Override
public void doOk() {
envListOkAction(envListPane, PopTipStrategy.LATER);
boolean changeResult = envListOkAction(envListPane, PopTipStrategy.LATER);
// 切换完成后清理密码
updateNotRememberPwdEnv();
if (changeResult) {
VersionCheckUtils.showVersionCheckDialog(envListPane.updateEnvManager());
}
}
@Override
@ -479,6 +483,7 @@ public class EnvChangeEntrance {
DesignerExiter.getInstance().execute();
} else {
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.design.actions.UpdateAction;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
@ -13,7 +14,7 @@ import java.awt.event.ActionEvent;
/**
* created by Harrison on 2020/03/24
**/
public class TemplateStoreAction extends UpdateAction {
public class TemplateStoreAction extends AbstractDesignerSSO {
public TemplateStoreAction() {
@ -44,9 +45,8 @@ public class TemplateStoreAction extends UpdateAction {
};
@Override
public void actionPerformed(ActionEvent e) {
public String getJumpUrl() {
ComponentCollector.getInstance().collectTepMenuEnterClick();
String url = CloudCenter.getInstance().acquireUrlByKind("design.market.template", "https://market.fanruan.com/template");
BrowseUtils.browser(url);
return CloudCenter.getInstance().acquireUrlByKind("design.market.template", "https://market.fanruan.com/template");
}
}

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

35
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java

@ -4,7 +4,6 @@ import com.fr.base.Parameter;
import com.fr.data.impl.ClassTableData;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.JavaEditorPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
@ -15,14 +14,18 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.IOUtils;
import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -65,30 +68,6 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
dlg.setVisible(true);
}
});
UIButton editButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit"));
editButton.setPreferredSize(new Dimension(
editButton.getPreferredSize().width,
classNameTextField.getPreferredSize().height));
reportletNamePane.add(editButton);
editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final JavaEditorPane javaEditorPane = new JavaEditorPane(classNameTextField.getText(), JavaEditorPane.DEFAULT_TABLEDATA_STRING);
final BasicDialog dlg = javaEditorPane.showMediumWindow(SwingUtilities.getWindowAncestor(ClassTableDataPane.this),
new DialogActionAdapter() {
public void doOk() {
classNameTextField.setText(javaEditorPane.getClassText());
}
});
javaEditorPane.addSaveActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dlg.doOK();
}
});
dlg.setVisible(true);
}
});
Component[][] components = {
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Class_Name") + ":"), reportletNamePane},

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);
PluginWebBridge.getHelper().setDialogHandle(dlg);
dlg.setVisible(true);
DesignerLoginUtils.showPluginRemindOnFirstLaunch();
DesignerLoginUtils.showPluginRemindOnFirstLaunch(dlg);
} catch (Exception e) {
// ignored
FineLoggerFactory.getLogger().error(e.getMessage(), e);

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.log.FineLoggerFactory;
import com.fr.third.org.bouncycastle.util.encoders.Hex;
import java.awt.Window;
import java.security.SecureRandom;
import java.util.HashMap;
import java.util.Map;
@ -32,14 +33,15 @@ public class DesignerLoginUtils {
return map4Tpl;
}
public static void showPluginRemindOnFirstLaunch() {
public static void showPluginRemindOnFirstLaunch(Window parent) {
DesignerEnvManager manager = DesignerEnvManager.getEnvManager();
int uid = manager.getDesignerLoginUid();
if (uid > 0) {
boolean pluginRemindOnFirstLaunch = manager.isPluginRemindOnFirstLaunch();
if (pluginRemindOnFirstLaunch) {
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);
}

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()) {
return;
}
@ -28,7 +28,7 @@ public class ComponentReuseNotifyUtil {
return COMPONENT_SNAP_CHAT_KEY;
}
});
if (snapChat.hasRead() && needValidRead) {
if (snapChat.hasRead()) {
DesignerToastMsgUtil.toastPrompt(Toolkit.i18nText("Fine-Design_Component_Reuse_Merge_Prompt"));
}
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
public void actionPerformed(ActionEvent e) {
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.stable.Constants;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Window;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JEditorPane;
@ -30,12 +33,15 @@ public class DesignerToastMsgUtil {
public static void toastPrompt(JPanel contendPane) {
toastPane(PROMPT_ICON, contendPane);
toastPane(PROMPT_ICON, contendPane, DesignerContext.getDesignerFrame());
}
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) {
@ -46,6 +52,10 @@ public class DesignerToastMsgUtil {
toastWarning(toastPane(warningInfo));
}
public static void toastWarning(String warningInfo, Window parent) {
toastWarning(toastPane(warningInfo), parent);
}
private static JPanel toastPane(String text) {
UILabel promptLabel = new UILabel("<html>" + text + "</html>");
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -58,7 +68,7 @@ public class DesignerToastMsgUtil {
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();
UILabel uiLabel = new UILabel(icon);
uiLabel.setVerticalAlignment(SwingConstants.TOP);
@ -67,7 +77,12 @@ public class DesignerToastMsgUtil {
pane.add(contendPane, BorderLayout.CENTER);
pane.setBorder(BorderFactory.createEmptyBorder(8, 15, 8, 15));
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);
}

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.module.ModuleContext;
import java.awt.Dialog;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.Frame;
@ -26,14 +27,23 @@ public class ToastMsgDialog extends UIDialog {
public ToastMsgDialog(Frame parent, JPanel panel) {
super(parent);
init(panel);
}
public ToastMsgDialog(Dialog parent, JPanel panel) {
super(parent);
init(panel);
}
private void init(JPanel panel) {
setFocusable(false);
setAutoRequestFocus(false);
setUndecorated(true);
contentPane = panel;
initComponent(parent);
initComponent();
}
private void initComponent(Frame parent) {
private void initComponent() {
this.getContentPane().setLayout(null);
this.getContentPane().add(contentPane);
Dimension dimension = calculatePreferSize();
@ -42,7 +52,7 @@ public class ToastMsgDialog extends UIDialog {
contentPane.setSize(dimension);
setLocationRelativeTo(DesignerContext.getDesignerFrame().getContentFrame());
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);
}

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

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

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

@ -2,7 +2,6 @@ package com.fr.design.notification.ui;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.notification.Notification;
import com.fr.design.notification.NotificationCenter;
import java.awt.BorderLayout;
@ -26,9 +25,8 @@ public class NotificationCenterDialog extends JDialog {
private UILabel deleteLabel;
private static final int NOTIFICATIONCOUNT = 5;
private static NotificationCenterDialog instance;
private NotificationCenterDialog(Frame parent) {
public NotificationCenterDialog(Frame parent) {
super(parent);
setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Notification"));
setResizable(false);
@ -42,13 +40,6 @@ public class NotificationCenterDialog extends JDialog {
initComponents();
}
public static NotificationCenterDialog getInstance() {
if (instance == null) {
instance = new NotificationCenterDialog(DesignerContext.getDesignerFrame());
}
return instance;
}
private void initComponents() {
centerPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1);
addNotification();
@ -89,14 +80,15 @@ public class NotificationCenterDialog extends JDialog {
return deleteLabel;
}
public void showDialog() {
this.setVisible(true);
}
public void hideDialog() {
this.dispose();
}
public void showDialog() {
this.setVisible(true);
}
public void addNotification() {
notificationNeedShow.clear();

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

@ -4,6 +4,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.notification.NotificationCenter;
import com.fr.general.IOUtils;
import java.awt.BorderLayout;
@ -27,7 +28,8 @@ public class NotificationCenterPane extends BasicPane {
notificationCenterButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
NotificationCenterDialog.getInstance().showDialog();
NotificationCenterDialog notificationCenterDialog = new NotificationCenterDialog(DesignerContext.getDesignerFrame());
notificationCenterDialog.showDialog();
}
});
this.setBackground(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND);

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.setVisible(true);
DesignerLoginUtils.showPluginRemindOnFirstLaunch();
DesignerLoginUtils.showPluginRemindOnFirstLaunch(dialog);
}
}

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

File diff suppressed because one or more lines are too long

247
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -15,6 +15,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.imenutable.UIMenuNameableCreator;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.general.ComparatorUtils;
@ -48,6 +49,7 @@ import java.util.Set;
/**
* 图表 类型 增删 控制按钮界面.
*
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-9-26 上午09:27:49
*/
@ -55,7 +57,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
private static final long serialVersionUID = -8130803225718028933L;
private static final int B_W = 52;
private static final int B_H = 20;
private static final int COL_COUNT = 3;
private static final int COL_COUNT = 4;
private static final int P_W = 300;
private static final int P_H = 400;
@ -67,7 +69,11 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
private UIButton addButton;
private UIButton configButton;
private ArrayList<ChartChangeButton> indexList = new ArrayList<ChartChangeButton>();
private UIButton copyButton;
private UIButton moveForwardButton;
private UIButton moveBackButton;
private ArrayList<ChartChangeButton> indexList = new ArrayList<>();
private JPanel buttonPane;
private ChartCollection editingCollection;
@ -85,37 +91,60 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
//所以:stopEditing--选中其他button则响应click之后relayout;普通失焦则直接relayout.
private boolean pressOtherButtonWhenEditing = false;
public ChartTypeButtonPane(ChartTypePane chartTypePane){
public ChartTypeButtonPane(ChartTypePane chartTypePane) {
this();
parent = chartTypePane;
}
public ChartTypeButtonPane() {
this.setLayout(new BorderLayout());
addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
configButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png"));
initButton();
buttonPane = new JPanel();
this.add(buttonPane, BorderLayout.CENTER);
JPanel eastPane = new JPanel();
this.add(eastPane, BorderLayout.EAST);
JPanel northPane = new JPanel();
this.add(northPane, BorderLayout.NORTH);
eastPane.setLayout(new BorderLayout());
northPane.setLayout(new BorderLayout());
northPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
JPanel addPanel = new JPanel();
addPanel.setLayout(new BorderLayout());
addPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3));
addPanel.add(addButton, BorderLayout.CENTER);
eastPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 5));
JPanel button = new JPanel();
button.setPreferredSize(new Dimension(45, 20));
button.setLayout(new GridLayout(1, 2, 5, 0));
button.add(addButton);
button.add(configButton);
eastPane.add(button, BorderLayout.NORTH);
button.setPreferredSize(new Dimension(95, 20));
button.setLayout(new GridLayout(1, 4, 0, 0));
button.add(addPanel);
button.add(copyButton);
button.add(moveForwardButton);
button.add(moveBackButton);
northPane.add(button, BorderLayout.WEST);
northPane.add(configButton, BorderLayout.EAST);
initAddButton();
initConfigButton();
initConfigCreator();
// Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK);
// Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK);
}
private void initButton() {
addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
configButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png"));
copyButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
copyButton.setBorderPainted(false);
copyButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Action_Copy"));
moveForwardButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/left.png"));
moveForwardButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Left"));
moveForwardButton.setBorderPainted(false);
moveBackButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/right.png"));
moveBackButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Right"));
moveBackButton.setBorderPainted(false);
initAddButton();
initConfigButton();
initMoveButton();
initCopyButton();
}
public static void registerSupportChangeConfigChartClass(Class<? extends ChartProvider> cls) {
@ -123,53 +152,95 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
}
private void initConfigCreator() {
configCreator = new UIMenuNameableCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"), new AttrChangeConfig(), ChangeConfigPane.class);
configCreator = new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"), new AttrChangeConfig(), ChangeConfigPane.class);
}
private void initAddButton() {
addButton.setPreferredSize(new Dimension(20, 20));
addButton.addActionListener(addListener);
addButton.addActionListener((e) -> {
String name = getNewChartName();
ChartProvider chart = getChangeStateNewChart();
addNewChart(chart, name, editingCollection.getChartCount());
});
}
private void initConfigButton() {
configButton.setPreferredSize(new Dimension(20, 20));
configButton.addActionListener(configListener);
configButton.addActionListener((e) -> showConfigDialog());
}
ActionListener addListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String name = getNewChartName();
ChartChangeButton button = new ChartChangeButton(name);// some set selected
private void initCopyButton() {
copyButton.setPreferredSize(new Dimension(20, 20));
copyButton.addActionListener((e) -> {
String name = getCopyChartName();
ChartProvider chart = getCopyChart();
addNewChart(chart, name, editingCollection.getSelectedIndex() + 1);
});
}
button.registerChangeListener(uiobListener);
private void initMoveButton() {
moveForwardButton.setPreferredSize(new Dimension(20, 20));
moveBackButton.setPreferredSize(new Dimension(20, 20));
moveForwardButton.addActionListener((e) -> moveForwardChart());
moveBackButton.addActionListener((e) -> moveBackChart());
}
indexList.add(button);
private void moveBackChart() {
editingCollection.moveBackChart();
populateBean(editingCollection);
}
if (editingCollection != null) {
//点击添加按钮,则会触发切换状态
ChartProvider chart = getChangeStateNewChart();
try {
ChartProvider newChart = (ChartProvider) chart.clone();
editingCollection.addNamedChart(name, newChart);
ChartInfoCollector.getInstance().collection(newChart, null);
} catch (CloneNotSupportedException e1) {
FineLoggerFactory.getLogger().error("Error in Clone");
}
checkoutChange();
}
layoutPane(buttonPane);
private void moveForwardChart() {
editingCollection.moveForwardChart();
populateBean(editingCollection);
}
private void checkMoveButton() {
moveBackButton.setEnabled(editingCollection.getSelectedIndex() != editingCollection.getChartCount() - 1);
moveForwardButton.setEnabled(editingCollection.getSelectedIndex() != 0);
}
private void addNewChart(ChartProvider chart, String name, int index) {
if (chart == null) {
return;
}
};
ChartChangeButton button = new ChartChangeButton(name);// some set selected
button.registerChangeListener(uiobListener);
indexList.add(index, button);
editingCollection.addNamedChart(index, name, chart);
ChartInfoCollector.getInstance().collection(chart, null);
checkoutChange();
layoutPane(buttonPane);
}
private void showConfigDialog() {
UIMenuNameableCreator ui = configCreator.clone();
final BasicBeanPane pane = ui.getPane();
pane.populateBean(editingCollection);
UIDialog dialog = pane.showUnsizedWindow(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionListener() {
@Override
public void doOk() {
pane.updateBean(editingCollection);
}
@Override
public void doCancel() {
}
});
dialog.setSize(P_W, P_H);
dialog.setVisible(true);
}
//获取图表收集器的状态
private void checkoutChange(){
private void checkoutChange() {
calculateMultiChartMode();
if (parent != null){
if (parent != null) {
parent.relayoutChartTypePane(editingCollection);
}
//检查是否可以配置切换
configButton.setEnabled(changeEnable());
checkMoveButton();
}
/**
@ -181,7 +252,23 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
ChartProvider chart = editingCollection.getSelectedChartProvider(ChartProvider.class);
String chartID = chart.getID();
int priority = ChartTypeManager.getInstanceWithCheck().getPriority(chartID);
return ChartTypeManager.getInstanceWithCheck().getFirstChart(priority);
ChartProvider firstChart = ChartTypeManager.getInstanceWithCheck().getFirstChart(priority);
try {
return (ChartProvider) firstChart.clone();
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
return null;
}
public ChartProvider getCopyChart() {
ChartProvider chart = editingCollection.getSelectedChartProvider(ChartProvider.class);
try {
return (ChartProvider) chart.clone();
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
return getChangeStateNewChart();
}
}
//图表收集器模式状态改变
@ -204,48 +291,42 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
return supportChangeConfigChartClassSet.contains(editingCollection.getSelectedChartProvider(ChartProvider.class).getClass());
}
ActionListener configListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
UIMenuNameableCreator ui = configCreator.clone();
final BasicBeanPane pane = ui.getPane();
pane.populateBean(editingCollection);
UIDialog dialog = pane.showUnsizedWindow(SwingUtilities.getWindowAncestor(parent), new DialogActionListener() {
@Override
public void doOk() {
pane.updateBean(editingCollection);
}
@Override
public void doCancel() {
}
});
dialog.setSize(P_W, P_H);
dialog.setVisible(true);
}
};
private String getNewChartName() {
int count = indexList.size() + 1;
while (true) {
String name_test = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Module_Name") + count;
boolean repeated = false;
for (int i = 0, len = indexList.size(); i < len; i++) {
ChartChangeButton nameable = indexList.get(i);
if (ComparatorUtils.equals(nameable.getButtonName(), name_test)) {
repeated = true;
break;
}
String nameTest = Toolkit.i18nText("Fine-Design_Chart_Module_Name") + count;
if (!nameRepeated(nameTest)) {
return nameTest;
}
count++;
}
}
if (!repeated) {
return name_test;
private String getCopyChartName() {
String chartName = "CopyOf" + editingCollection.getChartName(editingCollection.getSelectedIndex());
if (!nameRepeated(chartName)) {
return chartName;
}
int count = 1;
while (true) {
String nameTest = chartName + count;
if (!nameRepeated(nameTest)) {
return nameTest;
}
count++;
}
}
private boolean nameRepeated(String name) {
for (int i = 0, len = indexList.size(); i < len; i++) {
ChartChangeButton nameable = indexList.get(i);
if (ComparatorUtils.equals(nameable.getButtonName(), name)) {
return true;
}
}
return false;
}
private void layoutPane(JPanel northPane) {
if (northPane == null) {
return;
@ -291,6 +372,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
/**
* 注册监听器
*
* @param listener 观察者监听事件
*/
public void registerChangeListener(UIObserverListener listener) {
@ -299,6 +381,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
/**
* 是否应该响应事件监听器
*
* @return 是则返回true
*/
public boolean shouldResponseChangeListener() {
@ -383,7 +466,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
int selectedIndex = editingCollection.getSelectedIndex();
ChartChangeButton button = indexList.get(selectedIndex);
button.isMoveOn = false;
if (!ComparatorUtils.equals(editingCollection.getChartName(selectedIndex), newName)) {
if (!nameRepeated(newName)) {
editingCollection.setChartName(selectedIndex, newName);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified();
button.changeChartName(newName);
@ -391,7 +474,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
buttonPane.remove(currentEditingEditor);
currentEditingEditor = null;
if(!pressOtherButtonWhenEditing) {
if (!pressOtherButtonWhenEditing) {
layoutPane(buttonPane);
}
}
@ -427,7 +510,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
@Override
public void focusLost(FocusEvent e) {//编辑状态lost才走这边
if (currentEditingEditor != null ) {
if (currentEditingEditor != null) {
stopEditing();
}
}
@ -519,7 +602,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
relayoutPane();
//重构面板
if (parent != null ){
if (parent != null) {
parent.reLayoutEditPane(lastPlotID, editingCollection);
}
}
@ -534,7 +617,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
@Override
public void mouseClicked(MouseEvent e) {
mouseClick(e);
if(pressOtherButtonWhenEditing){
if (pressOtherButtonWhenEditing) {
relayoutPane();
pressOtherButtonWhenEditing = false;
}
@ -581,7 +664,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
//需要先更新,最后重构面板
//重构面板
if (parent != null ){
if (parent != null) {
parent.reLayoutEditPane(lastPlotID, editingCollection);
}
}

44
designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -4,17 +4,24 @@ import com.fr.base.BaseUtils;
import com.fr.design.dialog.BasicPane;
import com.fr.design.file.Releasable;
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.mainframe.reuse.ComponentReuseNotificationInfo;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.util.ArrayList;
import java.util.List;
@ -31,6 +38,8 @@ public class FormWidgetDetailPane extends FormDockView implements Releasable {
private UIHeadGroup headGroup;
private List<BasicPane> paneList;
private boolean isEmptyPane = false;
public static FormWidgetDetailPane getInstance() {
if (HOLDER.singleton == null) {
HOLDER.singleton = new FormWidgetDetailPane();
@ -59,7 +68,7 @@ public class FormWidgetDetailPane extends FormDockView implements Releasable {
}
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
@ -71,6 +80,9 @@ public class FormWidgetDetailPane extends FormDockView implements Releasable {
* 初始化
*/
public void refreshDockingView(){
if (isEmptyPane) {
return;
}
FormDesigner designer = this.getEditingFormDesigner();
removeAll();
if (designer == null) {
@ -101,6 +113,10 @@ public class FormWidgetDetailPane extends FormDockView implements Releasable {
this.add(centerPane, BorderLayout.CENTER);
}
public void resetEmptyPane(){
this.isEmptyPane = false;
}
/**
* 清除数据
@ -111,10 +127,34 @@ public class FormWidgetDetailPane extends FormDockView implements Releasable {
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/design/form/images/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() {
ComponentReuseNotifyUtil.enterWidgetLibExtraAction();
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.layout.FRGUIPaneFactory;
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.ui.widgetfilter.LocalWidgetFilter;
import com.fr.design.mainframe.share.util.InstallComponentHelper;
@ -213,6 +214,7 @@ public class LocalWidgetRepoPane extends BasicPane {
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
FormWidgetDetailPane.getInstance().switch2Empty();
} finally {
isRefreshing.set(false);
}

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() {
//老用户或者组件库里已有组件,不预装组件
SnapChat snapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT);
return !snapChat.hasRead() && !hasComponentInstalled();
try {
//老用户或者组件库里已有组件,不预装组件
SnapChat snapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT);
return !snapChat.hasRead() && !hasComponentInstalled();
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return false;
}
/**

BIN
designer-form/src/main/resources/com/fr/design/form/images/version_not_match.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

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

@ -77,6 +77,11 @@ public class DesignerAppUtils {
* @return 格式化后的多行插件错误信息详情
*/
public static String dealWithErrorDetailMultiLineAndCache(String key) {
if (!DesignerEnvManager.getEnvManager().isShowTemplateMissingPlugin()) {
// 直接清空不提示
TemplateIOErrorContextHolder.reset();
return StringUtils.EMPTY;
}
Multimap<String, PluginMarkerAdapter> pendingPlugins = TemplateIOErrorContextHolder.getPendingPlugin();
if (pendingPlugins.isEmpty()) {
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.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.mainframe.FormWidgetDetailPane;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.share.collect.ComponentCollector;
@ -55,6 +56,7 @@ public class SharableManager {
GeneralContext.addEnvChangedListenerToLast(new EnvChangedListener() {
@Override
public void envChanged() {
FormWidgetDetailPane.getInstance().resetEmptyPane();
LocalWidgetRepoPane.getInstance().refreshPane();
}
});

Loading…
Cancel
Save