Browse Source

Merge pull request #7485 in DESIGN/design from release/11.0 to feature/x

* commit '90a49ece7db9a4a96b20127fb51ce8eabb867cac':
  REPORT-65613 【主题边框】单元格样式修改文本和对齐样式,会导致边框配置丢失
  CHART-22259 feat:插件重新加载或者切换env fvs模板重新加载
feature/x
superman 3 years ago
parent
commit
e0aae03fd0
  1. 23
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  2. 18
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  3. 12
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java

23
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -15,7 +15,6 @@ import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.StashedFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.invoke.ClassHelper; import com.fr.invoke.ClassHelper;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -25,7 +24,7 @@ import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.third.org.apache.commons.io.FilenameUtils;
import java.io.ByteArrayOutputStream; import javax.swing.SwingWorker;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -33,7 +32,6 @@ import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.swing.SwingWorker;
/** /**
* 历史模板缓存 * 历史模板缓存
@ -364,7 +362,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
int size = historyList.size(); int size = historyList.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
JTemplate<?, ?> template = historyList.get(i); JTemplate<?, ?> template = historyList.get(i);
FILE file = templateToStashFile(template); FILE file = template.templateToStashFile();
if (file != null) { if (file != null) {
stashFILEMap.put(i, file); stashFILEMap.put(i, file);
} }
@ -372,21 +370,6 @@ public class HistoryTemplateListCache implements CallbackEvent {
FineLoggerFactory.getLogger().info("Env Change Template Stashed."); FineLoggerFactory.getLogger().info("Env Change Template Stashed.");
} }
private FILE templateToStashFile(JTemplate<?, ?> template) {
FILE file = template.getEditingFILE();
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BaseBook target = template.getTarget();
if (target != null) {
target.export(outputStream);
return new StashedFILE(file, outputStream.toByteArray(), template.suffix());
}
// 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
private boolean checkStash() { private boolean checkStash() {
try { try {
@ -469,7 +452,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
FILE file = template.getEditingFILE(); FILE file = template.getEditingFILE();
boolean needReload = context == null || needReloadTemplate(context, template); boolean needReload = context == null || needReloadTemplate(context, template);
if (needReload) { if (needReload) {
FILE stashFile = templateToStashFile(template); FILE stashFile = template.templateToStashFile();
if (stashFile != null) { if (stashFile != null) {
FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName()); FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName());
template.refreshResource(stashFile); template.refreshResource(stashFile);

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

@ -65,6 +65,7 @@ import com.fr.event.EventDispatcher;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEChooserPane; import com.fr.file.FILEChooserPane;
import com.fr.file.MemFILE; import com.fr.file.MemFILE;
import com.fr.file.StashedFILE;
import com.fr.form.ui.NoneWidget; import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -104,6 +105,7 @@ import javax.swing.JOptionPane;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.io.ByteArrayOutputStream;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.util.Set; import java.util.Set;
@ -438,6 +440,22 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
stopListenThemeConfig(); stopListenThemeConfig();
} }
public FILE templateToStashFile() {
FILE file = this.getEditingFILE();
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BaseBook target = this.getTarget();
if (target != null) {
target.export(outputStream);
return new StashedFILE(file, outputStream.toByteArray(), template.suffix());
}
// 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
/** /**
* 刷新内部资源 * 刷新内部资源

12
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java

@ -88,13 +88,13 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
@Override @Override
public ThemedCellStyle updateBean() { public ThemedCellStyle updateBean() {
AbstractBasicStylePane basicStylePane = (AbstractBasicStylePane) paneList.get(tabPane.getSelectedIndex()); Style style = this.cellStyle.getStyle();
Style style = basicStylePane.update(this.cellStyle.getStyle());
CellBorderStyle borderStyle = createDefaultBorderStyleFromStyle(style); CellBorderStyle borderStyle = createDefaultBorderStyleFromStyle(style);
for (BasicPane basicPane : paneList) {
style = ((AbstractBasicStylePane) basicPane).update(style);
if (ThemedFeatureController.isCellStyleSupportInnerBorder() && basicStylePane instanceof BorderPane) { if (ThemedFeatureController.isCellStyleSupportInnerBorder() && basicPane instanceof BorderPane) {
borderStyle = ((BorderPane) basicStylePane).update(); borderStyle = ((BorderPane) basicPane).update();
}
} }
this.cellStyle.setStyle(style); this.cellStyle.setStyle(style);

Loading…
Cancel
Save