Browse Source

Merge pull request #3300 in DESIGN/design from bugfix/10.0 to feature/10.0

* commit '870a01ec04c17f4ecacb914000dc7bb34760cef7':
  REPORT-46585 在远程新建编辑的未保存模板切换回本地不能保存
  REPORT-44803 参数面板拖动组件大小右侧不能跟随显示大小--来源【客户需求 508884】 【问题原因】release已验收,传一份到final,10.0.12.1中间版本发布 【改动思路】release已验收,传一份到final,10.0.12.1中间版本发布
research/11.0
superman 4 years ago
parent
commit
b07f768df4
  1. 2
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 30
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java

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

@ -341,7 +341,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public void refreshResource(FILE file) {
try {
this.template = JTemplateFactory.asIOFile(file);
this.template = JTemplateFactory.asIOFile(file, this.suffix());
setTarget(this.template);
// 先移除旧的。

30
designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java

@ -3,11 +3,12 @@ package com.fr.design.mainframe;
import com.fr.base.io.BaseBook;
import com.fr.file.FILE;
import com.fr.stable.CoreConstants;
import com.fr.third.javax.annotation.Nonnull;
import com.fr.third.javax.annotation.Nullable;
import com.fr.stable.StringUtils;
import java.util.ArrayList;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public final class JTemplateFactory {
private static final List<App<?>> ALL_APP = new ArrayList<App<?>>();
@ -21,8 +22,7 @@ public final class JTemplateFactory {
* @param file 包含了模板名称类型以及内容的文件
* @return 设计器编辑的模板对象
*/
@Nullable
public static JTemplate<?, ?> createJTemplate(@Nonnull FILE file) {
public static JTemplate<?, ?> createJTemplate(@NotNull FILE file) {
String fileName = file.getName();
int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT);
@ -43,15 +43,19 @@ public final class JTemplateFactory {
}
return null;
}
public static <T extends BaseBook> T asIOFile(@Nonnull FILE file) {
String fileName = file.getName();
int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT);
@Nullable
public static <T extends BaseBook> T asIOFile(@NotNull FILE file, String fileNameOrSuffix) {
if (StringUtils.isEmpty(fileNameOrSuffix)) {
return null;
}
int indexOfLastDot = fileNameOrSuffix.lastIndexOf(CoreConstants.DOT);
if (indexOfLastDot < 0) {
return null;
}
String fileExtension = fileName.substring(indexOfLastDot + 1);
String fileExtension = fileNameOrSuffix.substring(indexOfLastDot + 1);
for (App<?> app : ALL_APP) {
String[] defaultAppExtensions = app.defaultExtensions();
for (String defaultAppExtension : defaultAppExtensions) {
@ -66,6 +70,12 @@ public final class JTemplateFactory {
return null;
}
@Nullable
public static <T extends BaseBook> T asIOFile(@NotNull FILE file) {
return asIOFile(file, file.getName());
}
/**
* 注册app.

Loading…
Cancel
Save