Browse Source

REPORT-25778 json数据集,设计器重启之后消失

换一种处理方式,刷新面板会导致各种诡异的问题
final/10.0
Harrison 5 years ago
parent
commit
03a8dd09dd
  1. 5
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  2. 13
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  3. 23
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java

5
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -16,9 +16,9 @@ import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.TableDataDefineProvider;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
@ -172,8 +172,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
private void reloadCurrTemplate() {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (accept(jt)) {
HistoryTemplateListCache.getInstance().closeSelectedReport(jt);
DesignerContext.getDesignerFrame().openTemplate(jt.getEditingFILE());
jt.refreshResource();
}
}

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

@ -244,6 +244,19 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
/**
* 刷新内部资源
*/
public void refreshResource() {
try {
this.template = JTemplateFactory.asIOFile(this.editingFILE);
setTarget(this.template);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
/**
* 刷新容器
*/

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

@ -1,5 +1,6 @@
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;
@ -43,6 +44,28 @@ 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);
if (indexOfLastDot < 0) {
return null;
}
String fileExtension = fileName.substring(indexOfLastDot + 1);
for (App<?> app : ALL_APP) {
String[] defaultAppExtensions = app.defaultExtensions();
for (String defaultAppExtension : defaultAppExtensions) {
if (defaultAppExtension.equalsIgnoreCase(fileExtension)) {
BaseBook bb = app.asIOFile(file);
if (bb != null) {
return (T) bb;
}
}
}
}
return null;
}
/**
* 注册app.

Loading…
Cancel
Save