Browse Source

Merge pull request #1417 in DESIGN/design from ~HARRISON/design:release/10.0 to release/10.0

* commit 'e7584b8ea03180039b73d3fab9ba9cb51f8e177b':
  REPORT-25778 json数据集,设计器重启之后消失 换一种处理方式,刷新面板会导致各种诡异的问题
feature/big-screen
Harrison 5 years ago
parent
commit
7740e3e2e5
  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.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.TableDataDefineProvider; import com.fr.design.fun.TableDataDefineProvider;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
@ -172,8 +172,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
private void reloadCurrTemplate() { private void reloadCurrTemplate() {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (accept(jt)) { if (accept(jt)) {
HistoryTemplateListCache.getInstance().closeSelectedReport(jt); jt.refreshResource();
DesignerContext.getDesignerFrame().openTemplate(jt.getEditingFILE());
} }
} }

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; package com.fr.design.mainframe;
import com.fr.base.io.BaseBook;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.third.javax.annotation.Nonnull; import com.fr.third.javax.annotation.Nonnull;
@ -43,6 +44,28 @@ public final class JTemplateFactory {
return null; 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. * 注册app.

Loading…
Cancel
Save