Browse Source

Merge branch 'release/10.0' of https://cloud.finedevelop.com/scm/~hugh.c/design into release/10.0

feature/big-screen
Hugh.C 5 years ago
parent
commit
ea90c7043e
  1. 103
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 16
      designer-base/src/main/java/com/fr/design/dialog/TipDialog.java
  3. 3
      designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java
  4. 5
      designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java
  5. 13
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  6. 6
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java
  7. 16
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStylePane.java
  8. 387
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java
  9. 30
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleProvider.java
  10. 167
      designer-base/src/main/java/com/fr/design/utils/DesignerPort.java
  11. 47
      designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java
  12. 7
      designer-base/src/main/java/com/fr/exit/DesignerExiter.java
  13. BIN
      designer-base/src/main/resources/com/fr/design/images/edit/edit_typing.png
  14. BIN
      designer-base/src/main/resources/com/fr/design/images/error/error2.png
  15. BIN
      designer-base/src/main/resources/com/fr/design/images/warnings/warning5.png
  16. 7
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  17. 7
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  18. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java
  19. 16
      designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java
  20. 14
      designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java
  21. 4
      designer-form/src/main/java/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java
  22. 24
      designer-realize/src/main/java/com/fr/start/Designer.java
  23. 55
      designer-realize/src/main/java/com/fr/start/DesignerLauncher.java
  24. 38
      designer-realize/src/main/java/com/fr/start/DesignerSubListener.java
  25. 147
      designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java
  26. 2
      designer-realize/src/main/java/com/fr/start/MainDesigner.java
  27. 8
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java
  28. 16
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

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

@ -43,7 +43,11 @@ import javax.swing.JOptionPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -132,36 +136,7 @@ public class EnvChangeEntrance {
if (template != null) { if (template != null) {
template.refreshToolArea(); template.refreshToolArea();
} }
showServiceDialog(selectedEnv);
//是否需要做服务校验
if(needCheckBranch(selectedEnv)) {
String localBranch;
String remoteBranch;
localBranch = GeneralUtils.readFullBuildNO();
try {
remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch();
} catch (WorkspaceConnectionException e) {
remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(localBranch);
}
//通过是否包含#来避免当前版本为非安装版本(主要是内部开发版本)
if (localBranch.contains("#") && localBranch.equals(remoteBranch)) {
//说明版本一致,仅做日志记录
FineLoggerFactory.getLogger().info("Remote Designer version consistency");
} else {
localBranch = formatBranch(localBranch);
remoteBranch = formatBranch(remoteBranch);
Set<Class> noExistServiceSet = getNoExistServiceSet(connectionInfo);
StringBuilder textBuilder = new StringBuilder();
for (Class clazz : noExistServiceSet) {
WorkspaceAPI workspaceAPI = (WorkspaceAPI) clazz.getAnnotation(WorkspaceAPI.class);
String descriptionOfCN = InterProviderFactory.getProvider().getLocText(workspaceAPI.description());
textBuilder.append(descriptionOfCN).append("\n");
}
String areaText = textBuilder.toString();
CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), areaText, localBranch, remoteBranch);
dialog.setVisible(true);
}
}
} catch (WorkspaceAuthException | RegistEditionException e) { } catch (WorkspaceAuthException | RegistEditionException e) {
// String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"); // String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed");
// String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote"); // String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote");
@ -238,17 +213,76 @@ public class EnvChangeEntrance {
return true; return true;
} }
/**
* 对选择的环境做服务检测
* @param selectedEnv 选择的工作环境
*/
public void showServiceDialog(DesignerWorkspaceInfo selectedEnv) throws Exception {
//是否需要做服务校验
if(needCheckBranch(selectedEnv)) {
String localBranch;
String remoteBranch;
WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection();
localBranch = GeneralUtils.readFullBuildNO();
try {
remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch();
} catch (WorkspaceConnectionException e) {
remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(localBranch);
}
//通过是否包含#来避免当前版本为非安装版本(主要是内部开发版本)
if (localBranch.contains("#") && localBranch.equals(remoteBranch)) {
//说明版本一致,仅做日志记录
FineLoggerFactory.getLogger().info("Remote Designer version consistency");
} else {
localBranch = formatBranch(localBranch);
remoteBranch = formatBranch(remoteBranch);
Set<Class> noExistServiceSet = getNoExistServiceSet(connectionInfo);
StringBuilder textBuilder = new StringBuilder();
for (Class clazz : noExistServiceSet) {
WorkspaceAPI workspaceAPI = (WorkspaceAPI) clazz.getAnnotation(WorkspaceAPI.class);
String descriptionOfCN = InterProviderFactory.getProvider().getLocText(workspaceAPI.description());
textBuilder.append(descriptionOfCN).append("\n");
}
String areaText = textBuilder.toString();
CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), areaText, localBranch, remoteBranch);
dialog.setVisible(true);
}
}
}
/** /**
* 判断是否需要做版本验证判断依据为 * 判断是否需要做版本验证判断依据为
* 1选择的环境为远程环境 * 1选择的环境为远程环境
* 2一个月内不弹出是否勾选这里预留还未实际增加 * 2一个月内不弹出是否勾选
* @param selectedEnv 选择的环境 * @param selectedEnv 选择的环境
* @return * @return
*/ */
private boolean needCheckBranch(DesignerWorkspaceInfo selectedEnv){ private boolean needCheckBranch(DesignerWorkspaceInfo selectedEnv){
return selectedEnv.getType() == DesignerWorkspaceType.Remote; if(selectedEnv.getType() == DesignerWorkspaceType.Remote){
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
//获取记录的时间
Date remindTime = format.parse(selectedEnv.getRemindTime());
calendar.setTime(remindTime);
//获取一个月后的时间
calendar.add(Calendar.MONTH,1);
//与当前时间作对比,然后判断是否提示
if(new Date().after(calendar.getTime())){
return true;
}
} catch (ParseException e) {
return true;
}
}
return false;
} }
/**
* 获取不存在的服务列表
* @param info 环境连接信息
* @return 以Set形式返回不存在的服务
*/
public Set<Class> getNoExistServiceSet(WorkspaceConnectionInfo info){ public Set<Class> getNoExistServiceSet(WorkspaceConnectionInfo info){
Set<Class> noExistServiceSet = new HashSet<Class>(); Set<Class> noExistServiceSet = new HashSet<Class>();
Set<Class> remoteServiceSet = new HashSet<Class>(); Set<Class> remoteServiceSet = new HashSet<Class>();
@ -295,6 +329,11 @@ public class EnvChangeEntrance {
} }
} }
/**
* 格式化分支版本号
* @param branch 初始的分支版本号
* @return 格式化后的版本号
*/
private String formatBranch(String branch){ private String formatBranch(String branch){
if(branch.contains("#")){ if(branch.contains("#")){
return branch.substring(branch.lastIndexOf("#") + 1, branch.length() - 13); return branch.substring(branch.lastIndexOf("#") + 1, branch.length() - 13);

16
designer-base/src/main/java/com/fr/design/dialog/TipDialog.java

@ -7,9 +7,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.JDialog; import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
@ -27,16 +25,16 @@ public abstract class TipDialog extends JDialog implements ActionListener {
private UIButton endButton; private UIButton endButton;
private UIButton cancelButton; private UIButton cancelButton;
public TipDialog(Frame parent, String type) { public TipDialog(Frame parent, String type, String tip, String endText, String cancelText) {
super(parent, true); super(parent, true);
JPanel northPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel northPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel iconPane = new JPanel(); JPanel iconPane = new JPanel();
UILabel iconLabel = new UILabel(); UILabel iconLabel = new UILabel();
iconLabel.setIcon(IOUtils.readIcon("com/fr/design/images/error/error.png")); iconLabel.setIcon(IOUtils.readIcon("com/fr/design/images/error/error2.png"));
iconPane.add(iconLabel); iconPane.add(iconLabel);
iconPane.setPreferredSize(new Dimension(100, 100)); iconPane.setPreferredSize(new Dimension(50, 50));
JPanel tipPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel tipPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Last_Designer_Process_Not_Exist")); UILabel tipLabel = new UILabel(tip);
tipPane.add(tipLabel); tipPane.add(tipLabel);
northPane.add(iconPane, BorderLayout.WEST); northPane.add(iconPane, BorderLayout.WEST);
northPane.add(tipPane, BorderLayout.CENTER); northPane.add(tipPane, BorderLayout.CENTER);
@ -51,7 +49,7 @@ public abstract class TipDialog extends JDialog implements ActionListener {
JPanel southPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel southPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0)); JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0));
endButton = new UIButton(Toolkit.i18nText("Fine-Design_End_Occupied_Process")); endButton = new UIButton(endText);
endButton.addActionListener(new ActionListener() { endButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -59,7 +57,7 @@ public abstract class TipDialog extends JDialog implements ActionListener {
} }
}); });
buttonPane.add(endButton); buttonPane.add(endButton);
cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); cancelButton = new UIButton(cancelText);
cancelButton.addActionListener(new ActionListener() { cancelButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {

3
designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java vendored

@ -10,6 +10,9 @@ public interface DesignerWorkspaceInfo extends XMLable {
String getPath(); String getPath();
//获取提醒时间,用于判断是否做服务检测
String getRemindTime();
WorkspaceConnectionInfo getConnection(); WorkspaceConnectionInfo getConnection();
boolean checkValid(); boolean checkValid();

5
designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java vendored

@ -43,6 +43,11 @@ public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
return path; return path;
} }
@Override
public String getRemindTime() {
return null;
}
@Override @Override
public WorkspaceConnectionInfo getConnection() { public WorkspaceConnectionInfo getConnection() {
return null; return null;

13
designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java vendored

@ -13,6 +13,8 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
private String name; private String name;
private String remindTime;
private WorkspaceConnectionInfo connection; private WorkspaceConnectionInfo connection;
public static RemoteDesignerWorkspaceInfo create(WorkspaceConnectionInfo connection) { public static RemoteDesignerWorkspaceInfo create(WorkspaceConnectionInfo connection) {
@ -45,11 +47,21 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
return connection; return connection;
} }
public void setRemindTime(String remindTime){
this.remindTime = remindTime;
}
@Override
public String getRemindTime(){
return remindTime;
}
@Override @Override
public void readXML(XMLableReader reader) { public void readXML(XMLableReader reader) {
if (reader.isAttr()) { if (reader.isAttr()) {
this.name = reader.getAttrAsString("name", StringUtils.EMPTY); this.name = reader.getAttrAsString("name", StringUtils.EMPTY);
this.remindTime = reader.getAttrAsString("remindTime", StringUtils.EMPTY);
} }
if (reader.isChildNode()) { if (reader.isChildNode()) {
String tagName = reader.getTagName(); String tagName = reader.getTagName();
@ -69,6 +81,7 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
public void writeXML(XMLPrintWriter writer) { public void writeXML(XMLPrintWriter writer) {
writer.attr("name", name); writer.attr("name", name);
writer.attr("remindTime", remindTime);
if (this.connection != null) { if (this.connection != null) {
writer.startTAG("Connection"); writer.startTAG("Connection");
writer.attr("url", connection.getUrl()); writer.attr("url", connection.getUrl());

6
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java

@ -30,11 +30,15 @@ public class MobileBookMarkStyleDefinePane extends BasicBeanPane<MobileBookMarkS
private void initComponent() { private void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel settingPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel settingPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
if (!ComparatorUtils.equals(displayName, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_None_BookMark_Style"))) { if (!ComparatorUtils.equals(displayName, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_None_BookMark_Style"))) {
JPanel hintLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
hintLabelPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
UILabel hintLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Hint")); UILabel hintLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Hint"));
hintLabel.setForeground(Color.GRAY); hintLabel.setForeground(Color.GRAY);
settingPane.add(hintLabel, BorderLayout.NORTH); hintLabelPane.add(hintLabel);
settingPane.add(hintLabelPane, BorderLayout.NORTH);
} }
settingPane.add(this.customDefinePane, BorderLayout.CENTER); settingPane.add(this.customDefinePane, BorderLayout.CENTER);
this.add(settingPane, BorderLayout.CENTER); this.add(settingPane, BorderLayout.CENTER);

16
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStylePane.java

@ -7,6 +7,8 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.mobile.MobileBookMarkStyle; import com.fr.form.ui.mobile.MobileBookMarkStyle;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*; import java.awt.*;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -23,6 +25,11 @@ import java.util.Set;
* Created by hades on 2019/12/23 * Created by hades on 2019/12/23
*/ */
public class MobileBookMarkStylePane extends BasicBeanPane<MobileBookMarkStyle> { public class MobileBookMarkStylePane extends BasicBeanPane<MobileBookMarkStyle> {
public static final int LEFT_PANEL_WIDTH = 140;
public static final int LEFT_PANEL_HEIGHT = 565;
public static final int RIGHT_PANEL_WIDTH = 510;
public static final int RIGHT_PANEL_HEIGHT = 565;
public static ListCellRenderer renderer = new DefaultListCellRenderer() { public static ListCellRenderer renderer = new DefaultListCellRenderer() {
@Override @Override
@ -48,6 +55,7 @@ public class MobileBookMarkStylePane extends BasicBeanPane<MobileBookMarkStyle>
private void initComponent() { private void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
this.listModel = new DefaultListModel<>(); this.listModel = new DefaultListModel<>();
this.card = new CardLayout(); this.card = new CardLayout();
this.rightPane = FRGUIPaneFactory.createCardLayout_S_Pane(); this.rightPane = FRGUIPaneFactory.createCardLayout_S_Pane();
@ -79,14 +87,16 @@ public class MobileBookMarkStylePane extends BasicBeanPane<MobileBookMarkStyle>
} }
}); });
JPanel leftPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel leftPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
leftPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
leftPanel.add(bookMarkList, BorderLayout.CENTER); leftPanel.add(bookMarkList, BorderLayout.CENTER);
leftPanel.setPreferredSize(new Dimension(100, 500)); leftPanel.setPreferredSize(new Dimension(LEFT_PANEL_WIDTH, LEFT_PANEL_HEIGHT));
this.add(leftPanel, BorderLayout.WEST); this.add(leftPanel, BorderLayout.WEST);
} }
private void initRightPanel() { private void initRightPanel() {
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
centerPane.setPreferredSize(new Dimension(500, 500)); centerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
centerPane.setPreferredSize(new Dimension(RIGHT_PANEL_WIDTH, RIGHT_PANEL_HEIGHT));
centerPane.add(rightPane, BorderLayout.CENTER); centerPane.add(rightPane, BorderLayout.CENTER);
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
} }
@ -94,10 +104,12 @@ public class MobileBookMarkStylePane extends BasicBeanPane<MobileBookMarkStyle>
private List<MobileBookMarkStyleProvider> getMobileBookMarkStyleProvider() { private List<MobileBookMarkStyleProvider> getMobileBookMarkStyleProvider() {
DefaultMobileBookMarkStyleProvider defaultMobileBookMarkStyleProvider = new DefaultMobileBookMarkStyleProvider(); DefaultMobileBookMarkStyleProvider defaultMobileBookMarkStyleProvider = new DefaultMobileBookMarkStyleProvider();
SidebarMobileBookMarkStyleProvider sidebarMobileBookMarkStyleProvider = new SidebarMobileBookMarkStyleProvider();
Set<MobileBookMarkStyleProvider> mobileBookMarkStyleProviders = ExtraDesignClassManager.getInstance().getArray( Set<MobileBookMarkStyleProvider> mobileBookMarkStyleProviders = ExtraDesignClassManager.getInstance().getArray(
MobileBookMarkStyleProvider.XML_TAG); MobileBookMarkStyleProvider.XML_TAG);
List<MobileBookMarkStyleProvider> list = new ArrayList<>(); List<MobileBookMarkStyleProvider> list = new ArrayList<>();
list.add(defaultMobileBookMarkStyleProvider); list.add(defaultMobileBookMarkStyleProvider);
list.add(sidebarMobileBookMarkStyleProvider);
list.addAll(mobileBookMarkStyleProviders); list.addAll(mobileBookMarkStyleProviders);
return Collections.unmodifiableList(list); return Collections.unmodifiableList(list);
} }

387
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java

@ -0,0 +1,387 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.base.BaseUtils;
import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UnsignedIntUISpinner;
import com.fr.design.gui.style.FRFontPane;
import com.fr.design.gui.style.NumberDragBar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.mobile.MobileBookMarkStyle;
import com.fr.form.ui.mobile.impl.SidebarMobileBookMarkStyle;
import com.fr.stable.CoreConstants;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
/**
* @author Starryi
* @version 10.0
* Created by Starryi on 2020/02/28
*/
public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<MobileBookMarkStyle> {
private static final long serialVersionUID = 1L;
private static final int COLUMN_WIDTH = 160;
private UnsignedIntUISpinner buttonWidthSpinner;
private UnsignedIntUISpinner buttonHeightSpinner;
private UnsignedIntUISpinner buttonGapSpinner;
private UnsignedIntUISpinner buttonBorderRadiusSpinner;
private ColorSelectBox normalBackgroundColorBox;
private NumberDragBar normalOpacityDragBar;
private UnsignedIntUISpinner normalOpacitySpinner;
private LineComboBox normalBorderWidthComBox;
private ColorSelectBox normalBorderColorBox;
private UIComboBox normalFontNameComboBox;
private UIComboBox normalFontSizeComboBox;
private UIColorButton normalFontColorButton;
private UIToggleButton normalFontItalicButton;
private UIToggleButton normalFontBoldButton;
private ColorSelectBox selectedBackgroundColorBox;
private NumberDragBar selectedOpacityDragBar;
private UnsignedIntUISpinner selectedOpacitySpinner;
private LineComboBox selectedBorderWidthComBox;
private ColorSelectBox selectedBorderColorBox;
private UIComboBox selectedFontNameComboBox;
private UIComboBox selectedFontSizeComboBox;
private UIColorButton selectedFontColorButton;
private UIToggleButton selectedFontItalicButton;
private UIToggleButton selectedFontBoldButton;
private SidebarMobileBookMarkStyle DEFAULT_STYLE = new SidebarMobileBookMarkStyle();
public SidebarMobileBookMarkStyleCustomDefinePane() {
this.initComponent();
}
private void initComponent() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
this.add(this.createNavButtonStylePanel());
this.add(this.createNormalStateStylePanel());
this.add(this.createSelectedStateStylePanel());
}
private JPanel createNavButtonStylePanel() {
buttonWidthSpinner = new UnsignedIntUISpinner(20, 150, 1, DEFAULT_STYLE.getWidth());
buttonHeightSpinner = new UnsignedIntUISpinner(20, 100, 1, DEFAULT_STYLE.getHeight());
buttonGapSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, DEFAULT_STYLE.getGap());
buttonBorderRadiusSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, DEFAULT_STYLE.getBorderRadius());
UILabel sizeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Size") + ":",
SwingConstants.RIGHT);
JPanel sizePane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0);
sizePane.add(buttonWidthSpinner);
sizePane.add(buttonHeightSpinner);
JPanel sizeTipsPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0);
sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Width"),
SwingConstants.CENTER));
sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Height"),
SwingConstants.CENTER));
UILabel gapLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Gap") + ":",
SwingConstants.RIGHT);
UILabel borderRadiusLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Border_Radius") + ":",
SwingConstants.RIGHT);
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p};
double[] columnSize = {p, COLUMN_WIDTH};
double[] verticalGaps = {0, 10, 10};
JPanel navButtonSettingsPanel = TableLayoutHelper.createDiffVGapTableLayoutPane(new JComponent[][]{
{sizeLabel, sizePane},
{null, sizeTipsPane},
{gapLabel, buttonGapSpinner},
{borderRadiusLabel, buttonBorderRadiusSpinner},
}, rowSize, columnSize, 5, verticalGaps);
navButtonSettingsPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
JPanel containerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
containerPane.setBorder(GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Style"),
Color.decode("#2F8EF1")));
containerPane.add(navButtonSettingsPanel);
return containerPane;
}
private JPanel createNormalStateStylePanel() {
double p = TableLayout.PREFERRED;
normalBackgroundColorBox = new ColorSelectBox(COLUMN_WIDTH);
normalBackgroundColorBox.setSelectObject(DEFAULT_STYLE.getBackgroundColor());
normalOpacityDragBar = new NumberDragBar(0, 100);
normalOpacityDragBar.setValue(DEFAULT_STYLE.getOpacity());
normalOpacityDragBar.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
normalOpacitySpinner.setValue(normalOpacityDragBar.getValue());
}
});
normalOpacitySpinner = new UnsignedIntUISpinner(0, 100, 1, DEFAULT_STYLE.getOpacity());
normalOpacitySpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
normalOpacityDragBar.setValue((int) normalOpacitySpinner.getValue());
}
});
normalBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
normalBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getBorderWidth());
normalBorderColorBox = new ColorSelectBox(COLUMN_WIDTH);
normalBorderColorBox.setSelectObject(DEFAULT_STYLE.getBorderColor());
normalFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
normalFontNameComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontFamily());
normalFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);
normalFontSizeComboBox.setSelectedItem(DEFAULT_STYLE.getFontSize());
normalFontColorButton = new UIColorButton();
normalFontColorButton.setColor(DEFAULT_STYLE.getFontColor());
normalFontItalicButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));
normalFontItalicButton.setSelected(DEFAULT_STYLE.isFontItalic());
normalFontBoldButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
normalFontBoldButton.setSelected(DEFAULT_STYLE.isFontBold());
JPanel opacityPane = new JPanel(new BorderLayout(0, 0));
JPanel jp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0);
jp.add(normalOpacityDragBar);
jp.add(normalOpacitySpinner);
opacityPane.add(jp, BorderLayout.CENTER);
JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane(
new JComponent[][]{{normalFontSizeComboBox, normalFontColorButton, normalFontItalicButton, normalFontBoldButton}},
new double[]{p},
new double[]{p, p, p, p},
0, 5
);
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p, COLUMN_WIDTH, p};
JPanel normalStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
{
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Background_Color") + ":", SwingConstants.RIGHT),
normalBackgroundColorBox
},
{
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Opacity") + ":", SwingConstants.RIGHT),
opacityPane,
new UILabel("%")
},
{
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Width") + ":", SwingConstants.RIGHT),
normalBorderWidthComBox
},
{
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Color") + ":", SwingConstants.RIGHT),
normalBorderColorBox
},
{
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Font") + ":", SwingConstants.RIGHT),
normalFontNameComboBox,
fontExtraPane
}
}, rowSize, columnSize, 5, 10);
normalStateStyleSettingsPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
JPanel containerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
containerPane.setBorder(
GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Normal_Style"),
Color.decode("#2F8EF1"))
);
containerPane.add(normalStateStyleSettingsPanel);
return containerPane;
}
private JPanel createSelectedStateStylePanel() {
double p = TableLayout.PREFERRED;
selectedBackgroundColorBox = new ColorSelectBox(COLUMN_WIDTH);
selectedBackgroundColorBox.setSelectObject(DEFAULT_STYLE.getSelectedBackgroundColor());
selectedOpacityDragBar = new NumberDragBar(0, 100);
selectedOpacityDragBar.setValue(DEFAULT_STYLE.getSelectedOpacity());
selectedOpacityDragBar.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
selectedOpacitySpinner.setValue(selectedOpacityDragBar.getValue());
}
});
selectedOpacitySpinner = new UnsignedIntUISpinner(0, 100, 1, DEFAULT_STYLE.getSelectedOpacity());
selectedOpacitySpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
selectedOpacityDragBar.setValue((int) selectedOpacitySpinner.getValue());
}
});
selectedBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
selectedBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getSelectedBorderWidth());
selectedBorderColorBox = new ColorSelectBox(COLUMN_WIDTH);
selectedBorderColorBox.setSelectObject(DEFAULT_STYLE.getSelectedBorderColor());
selectedFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
selectedFontNameComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontFamily());
selectedFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);
selectedFontSizeComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontSize());
selectedFontColorButton = new UIColorButton();
selectedFontColorButton.setColor(DEFAULT_STYLE.getSelectedFontColor());
selectedFontItalicButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));
selectedFontItalicButton.setSelected(DEFAULT_STYLE.isSelectedFontItalic());
selectedFontBoldButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
selectedFontBoldButton.setSelected(DEFAULT_STYLE.isSelectedFontBold());
JPanel opacityPane = new JPanel(new BorderLayout(0, 0));
JPanel jp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0);
jp.add(selectedOpacityDragBar);
jp.add(selectedOpacitySpinner);
opacityPane.add(jp, BorderLayout.CENTER);
JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane(
new JComponent[][]{{selectedFontSizeComboBox, selectedFontColorButton, selectedFontItalicButton, selectedFontBoldButton}},
new double[]{p},
new double[]{p, p, p, p},
0, 5
);
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p, COLUMN_WIDTH, p};
JPanel selectedStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
{
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Background_Color") + ":", SwingConstants.RIGHT),
selectedBackgroundColorBox
},
{
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Opacity") + ":", SwingConstants.RIGHT),
opacityPane,
new UILabel("%")
},
{
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Width") + ":", SwingConstants.RIGHT),
selectedBorderWidthComBox
},
{
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Color") + ":", SwingConstants.RIGHT),
selectedBorderColorBox
},
{
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Font") + ":", SwingConstants.RIGHT),
selectedFontNameComboBox,
fontExtraPane
}
}, rowSize, columnSize, 5, 10);
selectedStateStyleSettingsPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
JPanel containerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
containerPane.setBorder(
GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Selected_Style"),
Color.decode("#2F8EF1"))
);
containerPane.add(selectedStateStyleSettingsPanel);
return containerPane;
}
@Override
public void populateBean(MobileBookMarkStyle ob) {
SidebarMobileBookMarkStyle style = null;
if (ob instanceof SidebarMobileBookMarkStyle) {
style = (SidebarMobileBookMarkStyle) ob;
}
if (style == null) {
return;
}
buttonWidthSpinner.setValue(style.getWidth());
buttonHeightSpinner.setValue(style.getHeight());
buttonGapSpinner.setValue(style.getGap());
buttonBorderRadiusSpinner.setValue(style.getBorderRadius());
normalBackgroundColorBox.setSelectObject(style.getBackgroundColor());
normalOpacityDragBar.setValue(style.getOpacity());
normalOpacitySpinner.setValue(style.getOpacity());
normalBorderWidthComBox.setSelectedLineStyle(style.getBorderWidth());
normalBorderColorBox.setSelectObject(style.getBorderColor());
normalFontNameComboBox.setSelectedItem(style.getFontFamily());
normalFontSizeComboBox.setSelectedItem(style.getFontSize());
normalFontColorButton.setColor(style.getFontColor());
normalFontItalicButton.setSelected(style.isFontItalic());
normalFontBoldButton.setSelected(style.isFontBold());
selectedBackgroundColorBox.setSelectObject(style.getSelectedBackgroundColor());
selectedOpacityDragBar.setValue(style.getSelectedOpacity());
selectedOpacitySpinner.setValue(style.getSelectedOpacity());
selectedBorderWidthComBox.setSelectedLineStyle(style.getSelectedBorderWidth());
selectedBorderColorBox.setSelectObject(style.getSelectedBorderColor());
selectedFontNameComboBox.setSelectedItem(style.getSelectedFontFamily());
selectedFontSizeComboBox.setSelectedItem(style.getSelectedFontSize());
selectedFontColorButton.setColor(style.getSelectedFontColor());
selectedFontItalicButton.setSelected(style.isSelectedFontItalic());
selectedFontBoldButton.setSelected(style.isSelectedFontBold());
}
@Override
public MobileBookMarkStyle updateBean() {
SidebarMobileBookMarkStyle style = new SidebarMobileBookMarkStyle();
style.setWidth((int) buttonWidthSpinner.getValue());
style.setHeight((int) buttonHeightSpinner.getValue());
style.setGap((int) buttonGapSpinner.getValue());
style.setBorderRadius((int) buttonBorderRadiusSpinner.getValue());
if (normalBackgroundColorBox.getSelectObject() != null) {
style.setBackgroundColor(normalBackgroundColorBox.getSelectObject());
}
style.setOpacity((int) normalOpacitySpinner.getValue());
style.setBorderWidth(normalBorderWidthComBox.getSelectedLineStyle());
style.setBorderColor(normalBorderColorBox.getSelectObject());
if (normalFontNameComboBox.getSelectedItem() != null) {
style.setFontFamily((String) normalFontNameComboBox.getSelectedItem());
}
if (normalFontSizeComboBox.getSelectedItem() != null) {
style.setFontSize((Integer) normalFontSizeComboBox.getSelectedItem());
}
style.setFontColor(normalFontColorButton.getColor());
style.setFontItalic(normalFontItalicButton.isSelected());
style.setFontBold(normalFontBoldButton.isSelected());
if (selectedBackgroundColorBox.getSelectObject() != null) {
style.setSelectedBackgroundColor(selectedBackgroundColorBox.getSelectObject());
}
style.setSelectedOpacity((int) selectedOpacitySpinner.getValue());
style.setSelectedBorderWidth(selectedBorderWidthComBox.getSelectedLineStyle());
style.setSelectedBorderColor(selectedBorderColorBox.getSelectObject());
if (selectedFontNameComboBox.getSelectedItem() != null) {
style.setSelectedFontFamily((String) selectedFontNameComboBox.getSelectedItem());
}
if (selectedFontSizeComboBox.getSelectedItem() != null) {
style.setSelectedFontSize((Integer) selectedFontSizeComboBox.getSelectedItem());
}
style.setSelectedFontColor(selectedFontColorButton.getColor());
style.setSelectedFontItalic(selectedFontItalicButton.isSelected());
style.setSelectedFontBold(selectedFontBoldButton.isSelected());
return style;
}
@Override
protected String title4PopupWindow() {
return null;
}
}

30
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleProvider.java

@ -0,0 +1,30 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.impl.AbstractMobileBookMarkStyleProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.form.ui.mobile.MobileBookMarkStyle;
import com.fr.form.ui.mobile.impl.SidebarMobileBookMarkStyle;
/**
* @author Starryi
* @version 10.0
* Created by Starryi on 2020/02/28
*/
public class SidebarMobileBookMarkStyleProvider extends AbstractMobileBookMarkStyleProvider {
@Override
public Class<? extends MobileBookMarkStyle> classForMobileBookMarkStyle() {
return SidebarMobileBookMarkStyle.class;
}
@Override
public Class<? extends BasicBeanPane<MobileBookMarkStyle>> classForMobileBookMarkStyleAppearance() {
return SidebarMobileBookMarkStyleCustomDefinePane.class;
}
@Override
public String displayName() {
return Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar");
}
}

167
designer-base/src/main/java/com/fr/design/utils/DesignerPort.java

@ -1,13 +1,29 @@
package com.fr.design.utils; package com.fr.design.utils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
import com.fr.design.dialog.TipDialog;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.exit.DesignerExiter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLWriter; import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import javax.swing.JOptionPane; import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
* 为的就是能替换 DesignPort.class 实现多开,因此避免编译器常量编译展开优化 * 为的就是能替换 DesignPort.class 实现多开,因此避免编译器常量编译展开优化
@ -69,27 +85,138 @@ public class DesignerPort implements XMLReadable, XMLWriter {
writer.end(); writer.end();
} }
public int resetPort() { public void resetPort() {
String port = JOptionPane.showInputDialog(null,
Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Tip"), TipDialog dialog = new TipDialog(null,
Toolkit.i18nText("Fine-Design_Modify_Designer_Port"), JOptionPane.INFORMATION_MESSAGE); StringUtils.EMPTY,
int value; Toolkit.i18nText("Fine-Design_Port_Found_Port_Conflict"),
try { Toolkit.i18nText("Fine-Design_End_Occupied_Process"),
value = Integer.parseInt(port); Toolkit.i18nText("Fine-Design_Modify_Designer_Port")) {
} catch (NumberFormatException e) { @Override
JOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Not_Number_Tip")); protected void endEvent() {
value = resetPort(); dispose();
} }
if (value < MIN_PORT || value > MAX_PORT) {
JOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Out_Of_Range_Tip")); @Override
value = resetPort(); protected void cancelEvent() {
new ResetPortDialog();
}
};
dialog.setVisible(true);
DesignerExiter.getInstance().execute();
}
private class ResetPortDialog extends JDialog {
private UITextField portFiled;
private UILabel warnLabel;
private UIButton okButton;
private ResetPortDialog() {
this.setLayout(new BorderLayout());
this.setModal(true);
this.portFiled = new UITextField();
this.portFiled.setPreferredSize(new Dimension(180, 20));
this.portFiled.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
checkValid();
}
@Override
public void removeUpdate(DocumentEvent e) {
checkValid();
}
@Override
public void changedUpdate(DocumentEvent e) {
checkValid();
}
});
JPanel iconPanel = new JPanel();
UILabel iconLabel = new UILabel();
iconLabel.setIcon(IOUtils.readIcon("com/fr/design/images/edit/edit_typing.png"));
iconPanel.add(iconLabel);
iconPanel.add(iconLabel);
JPanel textPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10);
textPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Tip")));
textPane.add(portFiled);
warnLabel = new UILabel();
warnLabel.setVisible(false);
warnLabel.setForeground(Color.RED);
okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_OK"));
okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int value = Integer.parseInt(portFiled.getText().trim());
if (ComparatorUtils.equals("true", System.getProperty("debug"))) {
setDebugMessagePort(value);
} else {
setMessagePort(value);
}
dispose();
DesignerEnvManager.getEnvManager().saveXMLFile();
RestartHelper.restart();
}
});
UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_Cancel"));
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
});
JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15));
buttonPane.add(okButton);
buttonPane.add(cancelButton);
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
controlPane.add(buttonPane, BorderLayout.EAST);
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
northPane.add(iconPanel, BorderLayout.WEST);
northPane.add(textPane, BorderLayout.CENTER);
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
centerPane.add(warnLabel);
JPanel southPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
southPane.add(controlPane);
this.add(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
this.add(southPane, BorderLayout.SOUTH);
this.setSize(300, 150);
this.setTitle(Toolkit.i18nText("Fine-Design_Modify_Designer_Port"));
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
this.setResizable(false);
this.setAlwaysOnTop(true);
GUICoreUtils.centerWindow(this);
this.setVisible(true);
} }
if (ComparatorUtils.equals("true", System.getProperty("debug"))) {
setDebugMessagePort(value); private void checkValid() {
} else { String port = this.portFiled.getText().trim();
setMessagePort(value); if (StringUtils.isEmpty(port)) {
okButton.setEnabled(false);
return;
}
int value;
try {
value = Integer.parseInt(port);
} catch (NumberFormatException ignore) {
warnLabel.setText(Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Not_Number_Tip"));
warnLabel.setVisible(true);
okButton.setEnabled(false);
return;
}
if (value < MIN_PORT || value > MAX_PORT) {
warnLabel.setText(Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Out_Of_Range_Tip"));
warnLabel.setVisible(true);
okButton.setEnabled(false);
return;
}
warnLabel.setVisible(false);
okButton.setEnabled(true);
} }
return value;
} }
} }

47
designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java

@ -1,10 +1,14 @@
package com.fr.design.write.submit; package com.fr.design.write.submit;
import com.fr.design.DesignerEnvManager;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -18,6 +22,9 @@ import java.awt.Dimension;
import java.awt.Frame; import java.awt.Frame;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
/** /**
* @author: Maksim * @author: Maksim
@ -28,30 +35,31 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
private JPanel topPanel; private JPanel topPanel;
private JPanel centerPanel; private JPanel centerPanel;
private JPanel bottomPanel; private JPanel bottomPanel;
private UICheckBox remindBox;
public CheckServiceDialog(Frame parent, String areaText, String localBranch, String remoteBranch){ public CheckServiceDialog(Frame parent, String areaText, String localBranch, String remoteBranch){
super(parent,true); super(parent,true);
//上面的标签面板 //上面的标签面板
topPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); topPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel imagePanel = new JPanel(); JPanel imagePanel = new JPanel();
Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/warning4.png"); Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/warning5.png");
JLabel imageLabel = new JLabel(); JLabel imageLabel = new JLabel();
imageLabel.setIcon(icon); imageLabel.setIcon(icon);
imagePanel.add(imageLabel); imagePanel.add(imageLabel);
imagePanel.setPreferredSize(new Dimension(100,80)); imagePanel.setPreferredSize(new Dimension(110,80));
JPanel verticalPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); JPanel verticalPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true);
FRFont font = FRFont.getInstance(); FRFont font = FRFont.getInstance();
font = font.applySize(15).applyStyle(1); font = font.applySize(15).applyStyle(1);
JLabel label = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Inconsistency")); JLabel label = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Inconsistency"));
label.setFont(font); label.setFont(font);
label.setPreferredSize(new Dimension(500,30)); label.setPreferredSize(new Dimension(600,30));
JLabel label2 = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer") JLabel label2 = new JLabel("<html>"+Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer")
+ localBranch + "/" + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch); + localBranch + "/" + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch+"</html>");
label2.setPreferredSize(new Dimension(500,20)); label2.setPreferredSize(new Dimension(600,30));
JLabel label3 = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Need_Update")); JLabel label3 = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Need_Update"));
label3.setPreferredSize(new Dimension(500,20)); label3.setPreferredSize(new Dimension(500,30));
verticalPanel.add(label); verticalPanel.add(label);
verticalPanel.add(label2); verticalPanel.add(label2);
@ -73,9 +81,13 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
centerPanel.add(checkArea,BorderLayout.CENTER); centerPanel.add(checkArea,BorderLayout.CENTER);
//下面的按钮面板 //下面的按钮面板
remindBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remind_Show"));
remindBox.addActionListener(remindCheckboxListener);
UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Button_Confirm")); UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Button_Confirm"));
JPanel buttonPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); JPanel buttonPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
buttonPanel.add(okButton); buttonPanel.setBorder(BorderFactory.createEmptyBorder(0,10,10,10));
buttonPanel.add(remindBox, BorderLayout.WEST);
buttonPanel.add(okButton,BorderLayout.EAST);
okButton.addActionListener(this ); okButton.addActionListener(this );
bottomPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); bottomPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
bottomPanel.add(buttonPanel); bottomPanel.add(buttonPanel);
@ -86,7 +98,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
this.add(topPanel,BorderLayout.NORTH); this.add(topPanel,BorderLayout.NORTH);
this.add(centerPanel, BorderLayout.CENTER); this.add(centerPanel, BorderLayout.CENTER);
this.add(buttonPanel,BorderLayout.SOUTH); this.add(buttonPanel,BorderLayout.SOUTH);
this.setSize(new Dimension(600, 500)); this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US)? 700:600, 500));
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
} }
@ -94,4 +106,19 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
this.dispose(); this.dispose();
} }
private ActionListener remindCheckboxListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String remindTime = format.format(new Date());
//环境已切换,通过当前环境获取,一定是远程环境
String currentEnvName = DesignerEnvManager.getEnvManager().getCurEnvName();
RemoteDesignerWorkspaceInfo currentEnv = (RemoteDesignerWorkspaceInfo)DesignerEnvManager.getEnvManager().getWorkspaceInfo(currentEnvName);
currentEnv.setRemindTime(remindBox.isSelected()? remindTime : "");
}
};
} }

7
designer-base/src/main/java/com/fr/exit/DesignerExiter.java

@ -14,17 +14,14 @@ public class DesignerExiter {
public static final DesignerExiter INSTANCE = new DesignerExiter(); public static final DesignerExiter INSTANCE = new DesignerExiter();
private static final String DOT = ".";
public static DesignerExiter getInstance() { public static DesignerExiter getInstance() {
return INSTANCE; return INSTANCE;
} }
public void execute() { public void execute() {
if (FineProcessContext.getParentPipe() == null && DOT.equals(StableUtils.getInstallHome())) { if (FineProcessContext.getParentPipe() != null) {
System.exit(0);
} else {
FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY);
} }
System.exit(0);
} }
} }

BIN
designer-base/src/main/resources/com/fr/design/images/edit/edit_typing.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

BIN
designer-base/src/main/resources/com/fr/design/images/error/error2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/warnings/warning5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

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

@ -503,6 +503,13 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
if (this.isSelected()) { if (this.isSelected()) {
indexList.get(0).setSelected(true); indexList.get(0).setSelected(true);
changeCollectionSelected(indexList.get(0).getButtonName()); changeCollectionSelected(indexList.get(0).getButtonName());
} else {//删除的tab非选中状态, 原为选中状态的tab保持选中不变
for (ChartChangeButton button : indexList) {
if (button.isSelected()) {
changeCollectionSelected(button.getButtonName());
break;
}
}
} }
} }

7
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -294,13 +294,14 @@ public class ChartTypePane extends AbstractChartAttrPane{
* @param collection * @param collection
*/ */
public void reLayoutEditPane(String lastPlotID, ChartCollection collection){ public void reLayoutEditPane(String lastPlotID, ChartCollection collection){
if (editPane == null) {
return;
}
ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class); ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class);
String plotID = chart.getID(); String plotID = chart.getID();
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
if (editPane != null && editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){ if (editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))) {
editPane.reLayout(chart); editPane.reLayout(chart);
}else {
throw new IllegalArgumentException("editPane can not be null.");
} }
} }

5
designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java

@ -221,7 +221,10 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
protected boolean largeModel(Plot plot) { protected boolean largeModel(Plot plot) {
return PlotFactory.largeDataModel(plot); //大数据模式 恢复用注释。下面1行删除。
return largeDataModelGroup != null && largeDataModelGroup.getSelectedIndex() == 0;
//大数据模式 恢复用注释。取消注释。
//return PlotFactory.largeDataModel(plot);
} }

16
designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java

@ -4,8 +4,13 @@ import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.van.chart.multilayer.data.MultiPiePlotReportDataContentPane;
import com.fr.van.chart.multilayer.data.MultiPiePlotTableDataContentPane;
import com.fr.van.chart.multilayer.other.VanChartMultiPieConditionPane; import com.fr.van.chart.multilayer.other.VanChartMultiPieConditionPane;
import com.fr.van.chart.multilayer.style.VanChartMultiPieSeriesPane; import com.fr.van.chart.multilayer.style.VanChartMultiPieSeriesPane;
import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI;
@ -47,6 +52,17 @@ public class MultiPieIndependentVanChartInterface extends AbstractIndependentVan
// }; // };
// } // }
//图表数据结构 恢复用注释。删除下面两个方法 getTableDataSourcePane getReportDataSourcePane。
@Override
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){
return new MultiPiePlotTableDataContentPane(parent);
}
@Override
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){
return new MultiPiePlotReportDataContentPane(parent);
}
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){ public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){
return new VanChartMultiPieSeriesPane(parent, plot); return new VanChartMultiPieSeriesPane(parent, plot);
} }

14
designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java

@ -56,6 +56,9 @@ public class FormMobileAttrAction extends JTemplateAction<JForm> {
final FormMobileAttrPane mobileAttrPane = new FormMobileAttrPane(); final FormMobileAttrPane mobileAttrPane = new FormMobileAttrPane();
mobileAttrPane.populateBean(mobileAttr); mobileAttrPane.populateBean(mobileAttr);
final boolean oldMobileOnly = mobileAttr.isMobileOnly();
final boolean oldAdaptive = mobileAttr.isAdaptivePropertyAutoMatch();
BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
@ -75,13 +78,16 @@ public class FormMobileAttrAction extends JTemplateAction<JForm> {
recordFunction(); recordFunction();
// 设置移动端属性并刷新界面 // 设置移动端属性并刷新界面
formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后 formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后
((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); boolean changeSize = (!oldMobileOnly && formMobileAttr.isMobileOnly()) || (oldMobileOnly && !formMobileAttr.isMobileOnly());
if (changeSize) {
((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified();
}
jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent()); jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent());
//当自适应属性自动匹配处于勾选状态 进行切换 //改变布局为自适应布局,只在移动端属性设置保存后改变一次
if (formMobileAttr.isMobileOnly() && formMobileAttr.isAdaptivePropertyAutoMatch()) { boolean changeLayout = !oldAdaptive && formMobileAttr.isAdaptivePropertyAutoMatch();
if (changeLayout) {
doChangeBodyLayout(); doChangeBodyLayout();
} }
WidgetPropertyPane.getInstance().refreshDockingView(); WidgetPropertyPane.getInstance().refreshDockingView();
jf.fireTargetModified(); jf.fireTargetModified();
} }

4
designer-form/src/main/java/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java

@ -47,9 +47,7 @@ public class FormMobileTemplateSettingsPane extends BasicBeanPane<FormMobileAttr
public void doChange() { public void doChange() {
boolean mobileOnlyCheckSelected = mobileOnlyCheck.isSelected(); boolean mobileOnlyCheckSelected = mobileOnlyCheck.isSelected();
mobileSettingsPane.setVisible(mobileOnlyCheckSelected); mobileSettingsPane.setVisible(mobileOnlyCheckSelected);
if (mobileOnlyCheckSelected) { adaptivePropertyAutoMatchCheck.setSelected(mobileOnlyCheckSelected);
adaptivePropertyAutoMatchCheck.setSelected(true);
}
} }
}); });

24
designer-realize/src/main/java/com/fr/start/Designer.java

@ -1,12 +1,5 @@
package com.fr.start; package com.fr.start;
import com.fr.event.Event;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.process.FineProcess;
import com.fr.process.engine.FineJavaProcessFactory;
import com.fr.process.engine.core.FineProcessEngineEvent;
/** /**
* 设计器主进程入口(无缝更换升级jar包若使用其他类作为入口需要重新打包designer.exe等升级后仍然走的原来逻辑) * 设计器主进程入口(无缝更换升级jar包若使用其他类作为入口需要重新打包designer.exe等升级后仍然走的原来逻辑)
* *
@ -19,21 +12,6 @@ public class Designer {
public static void main(String[] args) { public static void main(String[] args) {
// 创建进程 // 创建进程
final FineProcess process = FineJavaProcessFactory.create(). DesignerLauncher.getInstance().start(args);
entry("com.fr.start.MainDesigner").
javaRuntime(DesignerJavaRuntime.getInstance().getJavaExec()).
classPath(DesignerJavaRuntime.getInstance().getClassPath()).
inheritJvmSettings().
jvmSettings(DesignerJavaRuntime.getInstance().getJvmOptions()).
arguments(args).
startProcess(DesignerProcessType.INSTANCE);
process.getPipe().listen(FineProcessEngineEvent.DESTROY, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
process.destroy();
}
});
} }
} }

55
designer-realize/src/main/java/com/fr/start/DesignerLauncher.java

@ -0,0 +1,55 @@
package com.fr.start;
import com.fr.process.FineProcess;
import com.fr.process.engine.FineJavaProcessFactory;
import com.fr.process.engine.core.FineProcessContext;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/21
*/
public class DesignerLauncher {
private static final DesignerLauncher INSTANCE = new DesignerLauncher();
private String[] args;
private DesignerLauncher() {
}
public static DesignerLauncher getInstance() {
return INSTANCE;
}
public void start(String[] args) {
this.args = args;
FineJavaProcessFactory.create().
entry(MainDesigner.class).
javaRuntime(DesignerJavaRuntime.getInstance().getJavaExec()).
classPath(DesignerJavaRuntime.getInstance().getClassPath()).
inheritJvmSettings().
jvmSettings(DesignerJavaRuntime.getInstance().getJvmOptions()).
arguments(args).
startProcess(DesignerProcessType.INSTANCE);
DesignerSuperListener.getInstance().start();
}
private void beforeExit() {
DesignerSuperListener.getInstance().stopTask();
FineProcess process = FineProcessContext.getProcess(DesignerProcessType.INSTANCE);
process.destroy();
}
public void exit() {
beforeExit();
DesignerSuperListener.getInstance().stop();
System.exit(0);
}
public void restart() {
beforeExit();
start(args);
}
}

38
designer-realize/src/main/java/com/fr/start/DesignerSubListener.java

@ -0,0 +1,38 @@
package com.fr.start;
import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.process.engine.core.CarryMessageEvent;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.process.engine.core.FineProcessEngineEvent;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/21
*/
public class DesignerSubListener {
public static DesignerSubListener INSTANCE = new DesignerSubListener();
public static DesignerSubListener getInstance() {
return INSTANCE;
}
private DesignerSubListener() {
}
public void start() {
FineProcessContext.getParentPipe().listen(FineProcessEngineEvent.READY, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
if (DesignerContext.getDesignerFrame() == null || !DesignerContext.getDesignerFrame().isShowing()) {
FineProcessContext.getParentPipe().fire(new CarryMessageEvent(DesignerProcessType.INSTANCE.obtain()));
}
}
});
}
}

147
designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java

@ -0,0 +1,147 @@
package com.fr.start;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.dialog.ErrorDialog;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector;
import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage;
import com.fr.design.utils.DesignUtils;
import com.fr.event.Event;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.process.FineProcess;
import com.fr.process.ProcessEventPipe;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.process.engine.core.FineProcessEngineEvent;
import com.fr.stable.StringUtils;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/21
*/
public class DesignerSuperListener {
private static final DesignerSuperListener INSTANCE = new DesignerSuperListener();
private static final int ONCE_DELAY = 90;
private static final int FIXED_DELAY = 0;
private static final int FIXED_FREQ = 2;
private final ScheduledExecutorService service = Executors.newScheduledThreadPool(2, new NamedThreadFactory("DesignerListener"));
private FineProcess process;
private ScheduledFuture fixedFuture;
private ScheduledFuture onceFuture;
private DesignerSuperListener() {
}
public static DesignerSuperListener getInstance() {
return INSTANCE;
}
public void start() {
process = FineProcessContext.getProcess(DesignerProcessType.INSTANCE);
startExitListener();
startFrameListener();
startFallBackListener();
}
private void startExitListener() {
process.getPipe().listen(FineProcessEngineEvent.DESTROY, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
DesignerLauncher.getInstance().exit();
}
});
}
private void startFrameListener() {
onceFuture = service.schedule(new Runnable() {
@Override
public void run() {
ProcessEventPipe pipe = process.getPipe();
pipe.fire(FineProcessEngineEvent.READY);
if (StringUtils.isNotEmpty(pipe.info())) {
frameReport();
}
}
}, ONCE_DELAY, TimeUnit.SECONDS);
}
private void frameReport() {
DesignUtils.initLookAndFeel();
StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.UNEXCEPTED_START_FAILED.getId(),
DesignerErrorMessage.UNEXCEPTED_START_FAILED.getMessage(),
StringUtils.EMPTY);
ErrorDialog dialog = new ErrorDialog(null,
Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"),
Toolkit.i18nText("Fine-Design_Error_Start_Report"),
Toolkit.i18nText(DesignerErrorMessage.UNEXCEPTED_START_FAILED.getMessage())) {
@Override
protected void okEvent() {
dispose();
}
@Override
protected void restartEvent() {
dispose();
DesignerLauncher.getInstance().restart();
}
};
dialog.setVisible(true);
DesignerLauncher.getInstance().exit();
}
private void startFallBackListener() {
fixedFuture = service.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
if (!process.isAlive()) {
fallBackReport();
}
}
}, FIXED_DELAY, FIXED_FREQ, TimeUnit.SECONDS);
}
private void fallBackReport() {
DesignUtils.initLookAndFeel();
StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.UNEXCEPTED_FALL_BACK.getId(),
DesignerErrorMessage.UNEXCEPTED_FALL_BACK.getMessage(),
StringUtils.EMPTY);
ErrorDialog dialog = new ErrorDialog(null,
Toolkit.i18nText("Fine-Design_Error_Fall_Back_Apology_Message"),
Toolkit.i18nText("Fine-Design_Error_Fall_Back_Report"),
Toolkit.i18nText(DesignerErrorMessage.UNEXCEPTED_FALL_BACK.getMessage())) {
@Override
protected void okEvent() {
dispose();
}
@Override
protected void restartEvent() {
dispose();
DesignerLauncher.getInstance().restart();
}
};
dialog.setVisible(true);
DesignerLauncher.getInstance().exit();
}
public void stopTask() {
onceFuture.cancel(false);
fixedFuture.cancel(false);
}
public void stop() {
stopTask();
service.shutdown();
}
}

2
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -47,8 +47,6 @@ import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.module.Module; import com.fr.module.Module;
import com.fr.module.ModuleContext; import com.fr.module.ModuleContext;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.process.engine.core.FineProcessEngineEvent;
import com.fr.runtime.FineRuntime; import com.fr.runtime.FineRuntime;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;

8
designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

@ -7,6 +7,7 @@ import com.fr.design.RestartHelper;
import com.fr.design.dialog.TipDialog; import com.fr.design.dialog.TipDialog;
import com.fr.design.fun.OemProcessor; import com.fr.design.fun.OemProcessor;
import com.fr.design.fun.impl.GlobalListenerProviderManager; import com.fr.design.fun.impl.GlobalListenerProviderManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector; import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector;
import com.fr.design.mainframe.messagecollect.StartupMessageCollector; import com.fr.design.mainframe.messagecollect.StartupMessageCollector;
import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage; import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage;
@ -15,6 +16,7 @@ import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.DesignerPort; import com.fr.design.utils.DesignerPort;
import com.fr.exit.DesignerExiter; import com.fr.exit.DesignerExiter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.EnableMetrics;
@ -69,7 +71,11 @@ public class DesignerStartup extends Activator {
DesignUtils.clientSend(args); DesignUtils.clientSend(args);
FineLoggerFactory.getLogger().info("The Designer Has Been Started"); FineLoggerFactory.getLogger().info("The Designer Has Been Started");
if (args.length == 0) { if (args.length == 0) {
TipDialog dialog = new TipDialog(null, DesignerProcessType.INSTANCE.obtain()) { TipDialog dialog = new TipDialog(null,
DesignerProcessType.INSTANCE.obtain(),
Toolkit.i18nText("Fine-Design_Last_Designer_Process_Not_Exist"),
Toolkit.i18nText("Fine-Design_End_Occupied_Process"),
Toolkit.i18nText("Fine-Design_Basic_Cancel")) {
@Override @Override
protected void endEvent() { protected void endEvent() {
dispose(); dispose();

16
designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

@ -6,6 +6,10 @@ import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.LocalDesignerWorkspaceInfo;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -54,6 +58,18 @@ public class DesignerWorkspaceProvider extends Activator {
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(); EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner();
} else { } else {
WorkContext.switchTo(workspace); WorkContext.switchTo(workspace);
//在设计器完全启动完成后,对初始环境进行一次服务检测,对主要功能无影响,异常仅做日志提示即可
final DesignerWorkspaceInfo selectEnv = workspaceInfo;
EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener<Null>() {
@Override
public void on(Event event, Null aNull) {
try {
EnvChangeEntrance.getInstance().showServiceDialog(selectEnv);
} catch (Exception e) {
FineLoggerFactory.getLogger().warn("Check Service Failed");
}
}
});
} }
} catch (Throwable e) { } catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);

Loading…
Cancel
Save