Browse Source

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

bugfix/10.0
Hades 6 years ago
parent
commit
50f0c565d6
  1. 37
      designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java
  2. 11
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java
  3. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XTreeEditor.java
  4. 2
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

37
designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.template.info;
import com.fr.base.FRContext;
import com.fr.base.io.XMLReadHelper;
import com.fr.design.DesignerEnvManager;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ProductConstants;
@ -12,12 +13,15 @@ import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.javax.xml.stream.XMLStreamException;
import com.fr.workspace.WorkContext;
import com.fr.third.org.apache.commons.io.FileUtils;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -132,13 +136,24 @@ public class TemplateInfoCollector implements XMLReadable, XMLWriter {
if (!getInfoFile().exists()) {
return;
}
try {
XMLableReader xmlReader = XMLableReader.createXMLableReader(new FileReader(getInfoFile()));
xmlReader.readXMLObject(this);
} catch (XMLStreamException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
XMLableReader reader = null;
try (InputStream in = new FileInputStream(getInfoFile())) {
// XMLableReader 还是应该考虑实现 Closable 接口的,这样就能使用 try-with 语句了
reader = XMLReadHelper.createXMLableReader(in, XMLPrintWriter.XML_ENCODER);
reader.readXMLObject(this);
} catch (FileNotFoundException e) {
// do nothing
} catch (XMLStreamException | IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (XMLStreamException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
@ -160,8 +175,12 @@ public class TemplateInfoCollector implements XMLReadable, XMLWriter {
*/
private void saveInfo() {
try {
FileOutputStream out = new FileOutputStream(getInfoFile());
ByteArrayOutputStream out = new ByteArrayOutputStream();
XMLTools.writeOutputStreamXML(this, out);
out.flush();
out.close();
String fileContent = new String(out.toByteArray(), StandardCharsets.UTF_8);
FileUtils.writeStringToFile(getInfoFile(), fileContent, StandardCharsets.UTF_8);
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage());
}

11
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java

@ -8,6 +8,7 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.mainframe.vcs.common.VcsCacheFileNodeFile;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
@ -53,9 +54,13 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe
//先关闭当前打开的模板版本
JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
jt.stopEditing();
MutilTempalteTabPane.getInstance().setIsCloseCurrent(true);
MutilTempalteTabPane.getInstance().closeFormat(jt);
MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt);
//只有模板路径一致时关闭当前模板
if (ComparatorUtils.equals(fileOfVersion, jt.getPath())) {
MutilTempalteTabPane.getInstance().setIsCloseCurrent(true);
MutilTempalteTabPane.getInstance().closeFormat(jt);
MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt);
}
//再打开cache中的模板
DesignerContext.getDesignerFrame().openTemplate(new VcsCacheFileNodeFile(new FileNode(fileOfVersion, false)));

2
designer-form/src/main/java/com/fr/design/designer/creator/XTreeEditor.java

@ -73,7 +73,7 @@ public class XTreeEditor extends XWidgetCreator {
crp = (CRPropertyDescriptor[]) ArrayUtils.add(crp, new CRPropertyDescriptor("ajax", this.data.getClass()).setI18NName(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Load_By_Async")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY,
"Advanced"));
"Fine-Design_Basic_Advanced"));
crp = this.addAllowEdit(crp);
crp = this.addCustomData(crp);

2
designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

@ -205,7 +205,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
TemplateInfoCollector.getInstance().sendTemplateInfo();
ErrorInfoUploader.getInstance().sendErrorInfo();
}
}, SEND_DELAY, TimeUnit.SECONDS);
}, SEND_DELAY, TimeUnit.MILLISECONDS);
}
/**

Loading…
Cancel
Save