Browse Source

Merge pull request #10263 in DESIGN/design from bugfix/11.0 to feature/x

* commit '70cb44ab30499624c4d2c05d62fa4d3acde0d9ea':
  REPORT-78144 FVS报表块字号统一
  REPORT-81336 FR11决策报表报表块-编辑退出,编辑内容丢失
feature/x
superman 2 years ago
parent
commit
6a54910f05
  1. 56
      designer-base/src/main/java/com/fr/design/fun/DefaultValueAdjustProvider.java
  2. 24
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractDefaultValueAdjustProvider.java
  3. 37
      designer-base/src/main/java/com/fr/design/mainframe/AbsoluteMeasureUIMode.java
  4. 17
      designer-base/src/main/java/com/fr/design/mainframe/DesignerUIMode.java
  5. 63
      designer-base/src/main/java/com/fr/design/mainframe/DesignerUIModeConfig.java
  6. 38
      designer-base/src/main/java/com/fr/design/mainframe/SimulateWebUIMode.java
  7. 6
      designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java
  8. 18
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  9. 6
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  10. 6
      designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java
  11. 7
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java
  12. 7
      designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java
  13. 47
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  14. 19
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

56
designer-base/src/main/java/com/fr/design/fun/DefaultValueAdjustProvider.java

@ -0,0 +1,56 @@
package com.fr.design.fun;
import com.fr.base.chart.BaseChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.general.FRFont;
import com.fr.report.cell.CellElement;
import com.fr.stable.fun.mark.Selectable;
import java.awt.Font;
/**
* 主要用于fvs报表块内元素默认值的调整以达到所见所得效果后续fvs内置后删除
*/
public interface DefaultValueAdjustProvider extends Selectable {
String MARK_STRING = "DefaultValueAdjustProvider";
int CURRENT_LEVEL = 1;
/**
* 调整单元格对象默认值
*
* @param cellElement
*/
void adjustCellElement(CellElement cellElement);
/**
* 调整富文本默认值
*
* @param fontSize
* @return
*/
int adjustRichTextTransform(int fontSize, double transformedFontSize);
/**
* 调整ChartCollection
*
* @param chartCollection
*/
void adjustChartCollectionStyle(BaseChartCollection chartCollection);
/**
* 调整图表
*
* @param chartProvider
*/
void adjustChart(ChartProvider chartProvider);
/**
* 转成当前分辨率下显示的font
* @param font
* @param resolution
* @return
*/
Font transformFontByResolution(FRFont font, int resolution);
}

24
designer-base/src/main/java/com/fr/design/fun/impl/AbstractDefaultValueAdjustProvider.java

@ -0,0 +1,24 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.stable.fun.assist.Selector;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
@API(level = DefaultValueAdjustProvider.CURRENT_LEVEL)
public abstract class AbstractDefaultValueAdjustProvider extends AbstractProvider implements DefaultValueAdjustProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
public String mark4Provider() {
return this.getClass().getName();
}
public Selector selector() {
return Selector.ALWAYS;
}
}

37
designer-base/src/main/java/com/fr/design/mainframe/AbsoluteMeasureUIMode.java

@ -0,0 +1,37 @@
package com.fr.design.mainframe;
import com.fr.base.AutoChangeLineProvider;
import com.fr.base.DefaultAutoChangeLine;
import com.fr.base.ScreenResolution;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.unit.UnitConvertUtil;
public class AbsoluteMeasureUIMode implements DesignerUIMode {
private static class AbsoluteMeasureUIModeHolder {
private static final AbsoluteMeasureUIMode absoluteMeasureUIMode = new AbsoluteMeasureUIMode();
}
private AbsoluteMeasureUIMode() {
}
public static AbsoluteMeasureUIMode getInstance() {
return AbsoluteMeasureUIModeHolder.absoluteMeasureUIMode;
}
@Override
public ReportLengthUNITProvider parseLengthUNIT(int unitType) {
return UnitConvertUtil.parseLengthUNIT(unitType);
}
@Override
public AutoChangeLineProvider getAutoChangeLineStrategy() {
return new DefaultAutoChangeLine();
}
@Override
public int getScreenResolution() {
return ScreenResolution.getScreenResolution();
}
}

17
designer-base/src/main/java/com/fr/design/mainframe/DesignerUIMode.java

@ -0,0 +1,17 @@
package com.fr.design.mainframe;
import com.fr.base.AutoChangeLineProvider;;
import com.fr.design.fun.ReportLengthUNITProvider;
/**
* 设计器上和展示相关配置
*/
public interface DesignerUIMode {
ReportLengthUNITProvider parseLengthUNIT(int unitType);
AutoChangeLineProvider getAutoChangeLineStrategy();
int getScreenResolution();
}

63
designer-base/src/main/java/com/fr/design/mainframe/DesignerUIModeConfig.java

@ -1,19 +1,14 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.AutoChangeLineProvider; import com.fr.base.AutoChangeLineProvider;
import com.fr.base.DefaultAutoChangeLine;
import com.fr.base.ScreenResolution;
import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.unit.UnitConvertUtil;
import com.fr.form.fit.NewUIModeAutoChangeLine;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.Constants;
/** /**
* Created by kerry on 2020-06-05 * Created by kerry on 2020-06-05
*/ */
public class DesignerUIModeConfig { public class DesignerUIModeConfig {
private DesignerUIMode mode = DesignerUIMode.ABSOLUTE_MEASURE_UI_MODE; private DesignerUIMode mode = AbsoluteMeasureUIMode.getInstance();
private static class DesignerUIModeConfigHolder { private static class DesignerUIModeConfigHolder {
private static final DesignerUIModeConfig designerUIModeConfig = new DesignerUIModeConfig(); private static final DesignerUIModeConfig designerUIModeConfig = new DesignerUIModeConfig();
@ -34,21 +29,25 @@ public class DesignerUIModeConfig {
* @return boolean * @return boolean
*/ */
public boolean simulateWebUIMode() { public boolean simulateWebUIMode() {
return ComparatorUtils.equals(DesignerUIMode.SIMULATE_WEB_UI_MODE, mode); return ComparatorUtils.equals(SimulateWebUIMode.getInstance(), mode);
} }
/** /**
* 设置新ui模式 * 设置新ui模式
*/ */
public void setSimulateWebUIMode() { public void setSimulateWebUIMode() {
this.mode = DesignerUIMode.SIMULATE_WEB_UI_MODE; this.mode = SimulateWebUIMode.getInstance();
}
public void setDesignerUIMode(DesignerUIMode mode) {
this.mode = mode;
} }
/** /**
* 设置老ui模式 * 设置老ui模式
*/ */
public void setAbsoluteMeasureUIMode() { public void setAbsoluteMeasureUIMode() {
this.mode = DesignerUIMode.ABSOLUTE_MEASURE_UI_MODE; this.mode = AbsoluteMeasureUIMode.getInstance();
} }
/** /**
@ -78,50 +77,4 @@ public class DesignerUIModeConfig {
return mode.getScreenResolution(); return mode.getScreenResolution();
} }
private enum DesignerUIMode {
ABSOLUTE_MEASURE_UI_MODE {
@Override
protected ReportLengthUNITProvider parseLengthUNIT(int unitType) {
return UnitConvertUtil.parseLengthUNIT(unitType);
}
@Override
public AutoChangeLineProvider getAutoChangeLineStrategy() {
return new DefaultAutoChangeLine();
}
@Override
protected int getScreenResolution() {
return ScreenResolution.getScreenResolution();
}
},
SIMULATE_WEB_UI_MODE {
@Override
protected ReportLengthUNITProvider parseLengthUNIT(int unitType) {
return new PXReportLengthUNIT();
}
@Override
public AutoChangeLineProvider getAutoChangeLineStrategy() {
return new NewUIModeAutoChangeLine();
}
@Override
protected int getScreenResolution() {
return Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION;
}
};
protected abstract ReportLengthUNITProvider parseLengthUNIT(int unitType);
public abstract AutoChangeLineProvider getAutoChangeLineStrategy();
protected abstract int getScreenResolution();
}
} }

38
designer-base/src/main/java/com/fr/design/mainframe/SimulateWebUIMode.java

@ -0,0 +1,38 @@
package com.fr.design.mainframe;
import com.fr.base.AutoChangeLineProvider;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.form.fit.NewUIModeAutoChangeLine;
import com.fr.stable.Constants;
public class SimulateWebUIMode implements DesignerUIMode {
private static class SimulateWebUIModeHolder {
private static final SimulateWebUIMode simulateWebUIMode = new SimulateWebUIMode();
}
private SimulateWebUIMode() {
}
public static SimulateWebUIMode getInstance() {
return SimulateWebUIModeHolder.simulateWebUIMode;
}
@Override
public ReportLengthUNITProvider parseLengthUNIT(int unitType) {
return new PXReportLengthUNIT();
}
@Override
public AutoChangeLineProvider getAutoChangeLineStrategy() {
return new NewUIModeAutoChangeLine();
}
@Override
public int getScreenResolution() {
return Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION;
}
}

6
designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java

@ -5,7 +5,9 @@ import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.base.theme.settings.ThemedCellStyle;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.DesignUtils;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
/** /**
@ -41,6 +43,10 @@ public class DefaultThemedTemplateCellElementCase {
cellElement.setStyle(DesignModeContext.isDuchampMode() ? nameStyle.getRealStyle() : nameStyle); cellElement.setStyle(DesignModeContext.isDuchampMode() ? nameStyle.getRealStyle() : nameStyle);
} }
} }
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
if (adjustProvider != null) {
adjustProvider.adjustCellElement(cellElement);
}
return cellElement; return cellElement;
} }
} }

18
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -7,6 +7,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.deeplink.DeepLinkCore; import com.fr.design.deeplink.DeepLinkCore;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.UILookAndFeel; import com.fr.design.gui.UILookAndFeel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -18,11 +19,14 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.injectable.PluginModule;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CommonCodeUtils; import com.fr.stable.CommonCodeUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.bridge.ObjectHolder;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import com.fr.start.common.DesignerStartupContext; import com.fr.start.common.DesignerStartupContext;
import com.fr.start.common.DesignerStartupUtil; import com.fr.start.common.DesignerStartupUtil;
@ -48,6 +52,7 @@ import java.net.URI;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Locale; import java.util.Locale;
import java.util.Set;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -463,4 +468,17 @@ public class DesignUtils {
return xmlDesignerVersion; return xmlDesignerVersion;
} }
public static DefaultValueAdjustProvider getValueAdjust() {
ExtraDesignClassManager extraDesignClassManager = PluginModule.getAgent(PluginModule.ExtraDesign);
if (extraDesignClassManager != null) {
Set<DefaultValueAdjustProvider> providers = extraDesignClassManager.getArray(DefaultValueAdjustProvider.MARK_STRING);
for (DefaultValueAdjustProvider provider : providers) {
if (provider.selector().accept(new ObjectHolder())) {
return provider;
}
}
}
return null;
}
} }

6
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -17,6 +17,7 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.border.UITitledBorder; import com.fr.design.border.UITitledBorder;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
@ -32,6 +33,7 @@ import com.fr.design.style.color.ColorCell;
import com.fr.design.style.color.ColorFactory; import com.fr.design.style.color.ColorFactory;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.ColorSelectable; import com.fr.design.style.color.ColorSelectable;
import com.fr.design.utils.DesignUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -171,6 +173,10 @@ public final class GUICoreUtils {
FRFont frFont = style.getFRFont(); FRFont frFont = style.getFRFont();
textField.setFont(new Font(frFont.getFontName(), frFont.getStyle(), frFont.getShowSize(resolution))); textField.setFont(new Font(frFont.getFontName(), frFont.getStyle(), frFont.getShowSize(resolution)));
DefaultValueAdjustProvider valueAdjust = DesignUtils.getValueAdjust();
if (valueAdjust != null) {
textField.setFont(valueAdjust.transformFontByResolution(frFont, resolution));
}
textField.setForeground(style.getFRFont().getForeground()); textField.setForeground(style.getFRFont().getForeground());
if (style.getBackground() instanceof ColorBackground) { if (style.getBackground() instanceof ColorBackground) {

6
designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java

@ -4,9 +4,11 @@ import com.fr.base.chart.BaseChartCollection;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.gui.chart.MiddleChartDialog; import com.fr.design.gui.chart.MiddleChartDialog;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.third.joda.time.DateTime; import com.fr.third.joda.time.DateTime;
@ -87,6 +89,10 @@ public class ChartDialog extends MiddleChartDialog {
return new ActionListener() { return new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
chartTypePane.update((ChartCollection) cc, createTime); chartTypePane.update((ChartCollection) cc, createTime);
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
if (adjustProvider != null) {
adjustProvider.adjustChartCollectionStyle(cc);
}
doOK(); doOK();
} }
}; };

7
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java

@ -8,10 +8,12 @@ import com.fr.chart.web.ChartHyperPoplink;
import com.fr.chartx.attr.ChartProvider; import com.fr.chartx.attr.ChartProvider;
import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.hyperlink.AbstractHyperLinkPane; import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.ChartHyperEditPane; import com.fr.design.mainframe.chart.ChartHyperEditPane;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.van.chart.config.DefaultStyleHelper4Van; import com.fr.van.chart.config.DefaultStyleHelper4Van;
@ -67,7 +69,10 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane<ChartHyperPopli
private ChartCollection createChartCollection() { private ChartCollection createChartCollection() {
ChartCollection cc = new ChartCollection(); ChartCollection cc = new ChartCollection();
cc.setThemeStyle(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplateTheme()); cc.setThemeStyle(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplateTheme());
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
if (adjustProvider != null) {
adjustProvider.adjustChartCollectionStyle(cc);
}
ChartProvider chart = ChartTypeManager.getInstanceWithCheck().getFirstChart(); ChartProvider chart = ChartTypeManager.getInstanceWithCheck().getFirstChart();
if (chart != null) { if (chart != null) {
try { try {

7
designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java

@ -11,7 +11,9 @@ import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.DataSheet; import com.fr.chart.chartglyph.DataSheet;
import com.fr.chartx.attr.ChartProvider; import com.fr.chartx.attr.ChartProvider;
import com.fr.config.predefined.ColorFillStyle; import com.fr.config.predefined.ColorFillStyle;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.DesignUtils;
import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.attr.axis.VanChartAlertValue; import com.fr.plugin.chart.attr.axis.VanChartAlertValue;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
@ -54,9 +56,14 @@ public class DefaultStyleHelper4Van {
dealChartColor((VanChart) chartProvider); dealChartColor((VanChart) chartProvider);
// //主题中没有的 根据主题深浅色自动 的属性 默认自动 // //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom(); // ((VanChart) chart4Update).setAutoThemeCustom();
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
if (adjustProvider != null) {
adjustProvider.adjustChart(chartProvider);
} }
} }
}
public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) { public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) {
if (!duchampMode()) { if (!duchampMode()) {
return; return;

47
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -704,8 +704,8 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
} }
} }
} else { } else {
// 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块.
// 修改了JForm的Target需要同步修改formDesign的Target. // 修改了JForm的Target需要同步修改formDesign的Target.
this.setTarget(undoForm);
String widgetName = this.formDesign.getElementCaseContainerName(); String widgetName = this.formDesign.getElementCaseContainerName();
//这儿太坑了,u.getForm() 与 getTarget内容不一样 //这儿太坑了,u.getForm() 与 getTarget内容不一样
FormElementCaseProvider dataTable = undoForm.getElementCaseByName(widgetName); FormElementCaseProvider dataTable = undoForm.getElementCaseByName(widgetName);
@ -1249,8 +1249,26 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
@Override @Override
public void setTemplateTheme(TemplateTheme newTheme, TemplateThemeCompatible compatible) { public void setTemplateTheme(TemplateTheme newTheme, TemplateThemeCompatible compatible) {
FormTheme oldTheme = getTarget().getTemplateTheme(); FormTheme oldTheme = getTarget().getTemplateTheme();
boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName()); boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName());
Form target = getTarget();
target.setTemplateTheme(newTheme, compatible);
target = (Form) FineColorSynchronizer.flush(target, target.getTemplateTheme());
refreshTarget(target);
super.setTemplateTheme(newTheme, compatible);
fireTargetModified(shouldCreateUndoState);
}
private void refreshTarget(Form form) {
setTarget(form);
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
if (this.index == FORM_TAB) {
// save state
FormArea formArea = formDesign.getArea(); FormArea formArea = formDesign.getArea();
int horizontalValue = formArea.getHorizontalValue(); int horizontalValue = formArea.getHorizontalValue();
int verticalValue = formArea.getVerticalValue(); int verticalValue = formArea.getVerticalValue();
@ -1258,20 +1276,20 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
double widthValue = formArea.getWidthPaneValue(); double widthValue = formArea.getWidthPaneValue();
double heightValue = formArea.getHeightPaneValue(); double heightValue = formArea.getHeightPaneValue();
double slideValue = formArea.getSlideValue(); double slideValue = formArea.getSlideValue();
Widget[] selectedWidgets = formArea.getFormEditor().getSelectionModel().getSelection().getSelectedWidgets();
getTarget().setTemplateTheme(newTheme, compatible); // refresh ui
setTarget((Form) FineColorSynchronizer.flush(getTarget(), newTheme, compatible)); JForm.this.refreshRoot();
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) { // restore state
fireTargetModified(shouldCreateUndoState);
formDesign.refreshRoot();
// 刷新界面后恢复原来的尺寸
formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue); formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue);
formDesign.getArea().undoFixLayoutState(formArea.isFixLayout()); formDesign.getArea().undoFixLayoutState(formArea.isFixLayout());
if (this.index != FORM_TAB) { this.formDesign.getSelectionModel().setSelectedCreators(FormSelectionUtils.rebuildSelection(formDesign.getRootComponent(),
formDesign.getRootComponent() == selectedBodyLayout() ? selectedWidgets : new Widget[]{selectedBodyLayout().toData()}));
refreshToolArea(); refreshToolArea();
} else {
// CHART-20568: 当图表块处于编辑状态时,任何界面内容的修改都会导致其进行截图操作,进而引起设计器界面再次重绘,导致死循环,因而需要停止编辑 恢复浮层展示 // 停止编辑 恢复浮层展示
TreePath[] treePaths = FormHierarchyTreePane.getInstance(formDesign).getComponentTree().getSelectedTreePath(); TreePath[] treePaths = FormHierarchyTreePane.getInstance(formDesign).getComponentTree().getSelectedTreePath();
if (treePaths != null) { if (treePaths != null) {
for (TreePath path : treePaths) { for (TreePath path : treePaths) {
@ -1280,11 +1298,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
} }
} }
} }
} else {
String widgetName = this.formDesign.getElementCaseContainerName();
FormElementCaseProvider dataTable = form.getElementCaseByName(widgetName);
this.reportComposite.setSelectedWidget(dataTable);
formDesign.setElementCase(dataTable);
} }
FormHierarchyTreePane.getInstance().refreshRoot(); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
} }
super.setTemplateTheme(newTheme, compatible);
} }
@Override @Override

19
designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

@ -12,14 +12,15 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.form.util.FontTransformUtil; import com.fr.design.form.util.FontTransformUtil;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula; import com.fr.design.formula.UIFormula;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.style.FRFontPane; import com.fr.design.gui.style.FRFontPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.report.RichTextEditingPane; import com.fr.design.report.RichTextEditingPane;
import com.fr.design.report.RichTextPane;
import com.fr.design.style.color.UIToolbarColorButton; import com.fr.design.style.color.UIToolbarColorButton;
import com.fr.design.utils.DesignUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.cell.cellattr.core.RichTextConverter; import com.fr.report.cell.cellattr.core.RichTextConverter;
@ -51,7 +52,6 @@ import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.math.BigDecimal;
/** /**
* *
@ -512,12 +512,23 @@ public class RichTextToolBar extends BasicPane {
//pt转为px =*4/3 //pt转为px =*4/3
private int scaleUp(int fontSize) { private int scaleUp(int fontSize) {
return roundUp(FontTransformUtil.pt2px(fontSize)); double value = FontTransformUtil.pt2px(fontSize);
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
if (adjustProvider != null) {
return adjustProvider.adjustRichTextTransform(fontSize, value);
}
return roundUp(value);
} }
//px转pt = *3/4 //px转pt = *3/4
private int scaleDown(int fontSize) { private int scaleDown(int fontSize) {
return roundUp(FontTransformUtil.px2pt(fontSize)); double value = FontTransformUtil.px2pt(fontSize);
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
if (adjustProvider != null) {
return adjustProvider.adjustRichTextTransform(fontSize, value);
}
return roundUp(value);
} }

Loading…
Cancel
Save