Browse Source

Merge branch 'release/10.0' of ssh://code.fineres.com:7999/~starryi/design into release/10.0

feature/big-screen
Starryi 5 years ago
parent
commit
58962a9cb7
  1. 103
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 3
      designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java
  3. 5
      designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java
  4. 13
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  5. 47
      designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java
  6. BIN
      designer-base/src/main/resources/com/fr/design/images/warnings/warning5.png
  7. 7
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  8. 7
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  9. 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);

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

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 : "");
}
};
} }

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.");
} }
} }

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