Browse Source

REPORT-44714 【10.0.12冒烟】设计器缓存文件记录设计器设置失效

与产品沟通后,确认修改方案为,当发生了足以造成数据集面板丢失的容器高度变化时,至少保证水平拖拽面板不丢失
feature/big-screen
Yvan 4 years ago
parent
commit
329b58d8b8
  1. 45
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 32
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java
  3. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  4. 2
      designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java

45
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -141,8 +141,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private int eastRegionToolPaneY = 300;
private int eastRegionContainerWidth = 260;
private int westRegionToolPaneY = 300;
private int westRegionContainerWidth = 240;
private double westRegionToolPaneYRate = 0.5;
private String encryptionKey;
private String jdkHome;
@ -240,7 +240,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
String installHome = StableUtils.getInstallHome();
//这里不判断路径是.的情况,放在checkValid方法里面,重新选
if (installHome != null) {
String name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_DEFAULT");
String name = Toolkit.i18nText("Fine-Design_Basic_Engine_DEFAULT");
String envPath = designerEnvManager.getDefaultenvPath(installHome);
designerEnvManager.putEnv(name, LocalDesignerWorkspaceInfo.create(name, envPath));
designerEnvManager.setCurEnvName(name);
@ -304,8 +304,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
String today = calender.get(Calendar.YEAR) + "-" + (calender.get(Calendar.MONTH) + 1) + "-" + calender.get(Calendar.DAY_OF_MONTH);
String fileName = StableUtils.pathJoin(logLocation, "fr_" + today + "_%g.log");
if (!new java.io.File(fileName).exists()) {
StableUtils.makesureFileExist(new java.io.File(fileName));
if (!new File(fileName).exists()) {
StableUtils.makesureFileExist(new File(fileName));
}
Handler handler = new FileHandler(fileName, true);
@ -440,12 +440,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.lastOpenFilePath = lastOpenFilePath;
}
/**
* 获取西面板的上子面板的高度占容器总高度的比例
* 得到西面板的上下子面板的高度区分
*
* @return
*/
public double getLastWestRegionToolPaneYRate() {
return westRegionToolPaneYRate;
public int getLastWestRegionToolPaneY() {
return this.westRegionToolPaneY;
}
/**
@ -458,11 +460,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
/**
* 设置关闭设计器前西面板的上子面板的高度占容器总高度的比例
* @param westRegionToolPaneYRate
* 设置西面板的上下子面板的高度区分
*
* @param toolPaneY
*/
public void setLastWestRegionToolPaneYRate(double westRegionToolPaneYRate) {
this.westRegionToolPaneYRate = westRegionToolPaneYRate;
public void setLastWestRegionToolPaneY(int toolPaneY) {
this.westRegionToolPaneY = toolPaneY;
}
/**
@ -526,7 +529,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
return env;
}
}
String name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Workspace_Default");
String name = Toolkit.i18nText("Fine-Design_Basic_Workspace_Default");
LocalDesignerWorkspaceInfo newDefaultEnv = LocalDesignerWorkspaceInfo.create(name, defaultenvPath);
this.putEnv(name, newDefaultEnv);
return newDefaultEnv;
@ -549,7 +552,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
}
}
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Workspace_Default");
return Toolkit.i18nText("Fine-Design_Basic_Workspace_Default");
}
@ -1607,8 +1610,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private void readLastWestRegionLayout(XMLableReader reader) {
String tmpVal;
if ((tmpVal = reader.getAttrAsString("toolPaneYRate", null)) != null) {
this.setLastWestRegionToolPaneYRate(Double.parseDouble(tmpVal));
if ((tmpVal = reader.getAttrAsString("toolPaneY", null)) != null) {
this.setLastWestRegionToolPaneY(Integer.parseInt(tmpVal));
}
if ((tmpVal = reader.getAttrAsString("containerWidth", null)) != null) {
this.setLastWestRegionContainerWidth(Integer.parseInt(tmpVal));
@ -1640,7 +1643,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if ((tmpVal = reader.getAttrAsString("webinfLocation", null)) != null) {
// marks:兼容6.1的
// marks:设置默认的目录.
String curReportServerName = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Embedded_Server");
String curReportServerName = Toolkit.i18nText("Fine-Design_Basic_Server_Embedded_Server");
LocalDesignerWorkspaceInfo reportServer = LocalDesignerWorkspaceInfo.create(curReportServerName, tmpVal);
this.putEnv(curReportServerName, reportServer);
@ -1931,8 +1934,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private void writeLastWestRegionLayout(XMLPrintWriter writer) {
writer.startTAG("LastWestRegionLayout");
if (this.getLastWestRegionToolPaneYRate() >= 0) {
writer.attr("toolPaneYRate", this.getLastWestRegionToolPaneYRate());
if (this.getLastWestRegionToolPaneY() >= 0) {
writer.attr("toolPaneY ", this.getLastWestRegionToolPaneY());
}
if (this.getLastWestRegionContainerWidth() >= 0) {
writer.attr("containerWidth", this.getLastWestRegionContainerWidth());
@ -2060,9 +2063,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
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();

32
designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java

@ -44,7 +44,6 @@ public class UIResizableContainer extends JPanel {
private boolean isDownPaneVisible = true ;
private int paraHeight;
private int parentHeight = -1;
private double toolPaneYRate;
public UIResizableContainer(int direction) {
this(new JPanel(), new JPanel(), direction);
@ -157,20 +156,12 @@ public class UIResizableContainer extends JPanel {
return this.toolPaneY;
}
/**
* 获取上子面板高度占容器总高度的比例
* @return
*/
public double getToolPaneYRate() {
return toolPaneYRate;
}
/**
* 设置关闭设计器前最新的上子面板的高度比例
* @param toolPaneYRate
* @param toolPaneY
*/
public void setLastToolPaneYRate(double toolPaneYRate) {
this.toolPaneYRate = toolPaneYRate;
public void setLastToolPaneY(int toolPaneY) {
this.toolPaneY = toolPaneY;
}
/**
@ -248,9 +239,10 @@ public class UIResizableContainer extends JPanel {
if (parentHeight == -1) {
// 初始化下parentheight,存一下当前的父容器height
parentHeight = parent.getHeight();
} else if (parentHeight != parent.getHeight() && parent.getHeight() > 0) {
// parentHeight与父容器height不等时,代表用户调整分辨率或者dpi或者容器高度发生变化了,此时调整toolPaneY
toolPaneY = Math.min((int) (parent.getHeight() * toolPaneYRate), (parent.getHeight() - toolPaneHeight));
}
if (parentHeight != parent.getHeight() && (parent.getHeight() - toolPaneHeight) >= 0) {
// 调整toolPaneY,保证至少水平的拖拽条horizontToolPane不丢失
toolPaneY = Math.min(toolPaneY, parent.getHeight() - toolPaneHeight);
parentHeight = parent.getHeight();
}
}
@ -376,7 +368,6 @@ public class UIResizableContainer extends JPanel {
toolPaneY = e.getYOnScreen() - UIResizableContainer.this.getLocationOnScreen().y;
toolPaneY = toolPaneY < 0 ? 0 : toolPaneY;
toolPaneY = toolPaneY > UIResizableContainer.this.getHeight() - toolPaneHeight ? UIResizableContainer.this.getHeight() - toolPaneHeight - getParameterPaneHeight() : toolPaneY - getParameterPaneHeight();
adjustToolPaneYRate();
refreshContainer();
}
});
@ -398,10 +389,8 @@ public class UIResizableContainer extends JPanel {
public void mouseClicked(MouseEvent e) {
if (e.getX() <= ARROW_RANGE) {
toolPaneY = 0;
UIResizableContainer.this.adjustToolPaneYRate();
} else if (e.getX() >= getWidth() - ARROW_RANGE) {
toolPaneY = UIResizableContainer.this.getHeight() - toolPaneHeight - getParameterPaneHeight();
UIResizableContainer.this.adjustToolPaneYRate();
} else {
return;
}
@ -562,11 +551,4 @@ public class UIResizableContainer extends JPanel {
jf.setSize(500, 500);
jf.setVisible(true);
}
/**
* 当toolPaneY发生变化时也需要调整toolPaneYRate
*/
private void adjustToolPaneYRate() {
this.toolPaneYRate = ((double) toolPaneY) / this.getHeight();
}
}

4
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -1170,8 +1170,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
DesignerEnvManager.getEnvManager().setLastOpenFile(jt.getEditingFILE().getPath());
}
DesignerEnvManager.getEnvManager().setLastWestRegionToolPaneYRate(
WestRegionContainerPane.getInstance().getToolPaneYRate());
DesignerEnvManager.getEnvManager().setLastWestRegionToolPaneY(
WestRegionContainerPane.getInstance().getToolPaneY());
DesignerEnvManager.getEnvManager().setLastWestRegionContainerWidth(
WestRegionContainerPane.getInstance().getContainerWidth());
DesignerEnvManager.getEnvManager().setLastEastRegionToolPaneY(

2
designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java

@ -24,7 +24,7 @@ public class WestRegionContainerPane extends UIResizableContainer {
public static final WestRegionContainerPane getInstance() {
if (THIS == null) {
THIS = new WestRegionContainerPane();
THIS.setLastToolPaneYRate(DesignerEnvManager.getEnvManager().getLastWestRegionToolPaneYRate());
THIS.setLastToolPaneY(DesignerEnvManager.getEnvManager().getLastWestRegionToolPaneY());
THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastWestRegionContainerWidth());
}
return THIS;

Loading…
Cancel
Save