Browse Source

REPORT-78144 FVS报表块字号统一

newui
kerry 2 years ago
parent
commit
d5f4a34c70
  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. 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;
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;
import com.fr.form.fit.NewUIModeAutoChangeLine;
import com.fr.general.ComparatorUtils;
import com.fr.stable.Constants;
/**
* Created by kerry on 2020-06-05
*/
public class DesignerUIModeConfig {
private DesignerUIMode mode = DesignerUIMode.ABSOLUTE_MEASURE_UI_MODE;
private DesignerUIMode mode = AbsoluteMeasureUIMode.getInstance();
private static class DesignerUIModeConfigHolder {
private static final DesignerUIModeConfig designerUIModeConfig = new DesignerUIModeConfig();
@ -34,21 +29,25 @@ public class DesignerUIModeConfig {
* @return boolean
*/
public boolean simulateWebUIMode() {
return ComparatorUtils.equals(DesignerUIMode.SIMULATE_WEB_UI_MODE, mode);
return ComparatorUtils.equals(SimulateWebUIMode.getInstance(), mode);
}
/**
* 设置新ui模式
*/
public void setSimulateWebUIMode() {
this.mode = DesignerUIMode.SIMULATE_WEB_UI_MODE;
this.mode = SimulateWebUIMode.getInstance();
}
public void setDesignerUIMode(DesignerUIMode mode) {
this.mode = mode;
}
/**
* 设置老ui模式
*/
public void setAbsoluteMeasureUIMode() {
this.mode = DesignerUIMode.ABSOLUTE_MEASURE_UI_MODE;
this.mode = AbsoluteMeasureUIMode.getInstance();
}
/**
@ -78,50 +77,4 @@ public class DesignerUIModeConfig {
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.design.base.mode.DesignModeContext;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.DesignUtils;
import com.fr.report.cell.DefaultTemplateCellElement;
/**
@ -41,6 +43,10 @@ public class DefaultThemedTemplateCellElementCase {
cellElement.setStyle(DesignModeContext.isDuchampMode() ? nameStyle.getRealStyle() : nameStyle);
}
}
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
if (adjustProvider != null) {
adjustProvider.adjustCellElement(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.deeplink.DeepLinkCore;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.UILookAndFeel;
import com.fr.design.i18n.Toolkit;
@ -18,11 +19,14 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.injectable.PluginModule;
import com.fr.stable.ArrayUtils;
import com.fr.stable.CommonCodeUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.ObjectHolder;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider;
import com.fr.start.ServerStarter;
import com.fr.start.common.DesignerStartupContext;
import com.fr.start.common.DesignerStartupUtil;
@ -48,6 +52,7 @@ import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -463,4 +468,17 @@ public class DesignUtils {
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.border.UITitledBorder;
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.UIToggleButton;
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.ColorSelectBox;
import com.fr.design.style.color.ColorSelectable;
import com.fr.design.utils.DesignUtils;
import com.fr.general.FRFont;
import com.fr.stable.AssistUtils;
import com.fr.stable.Constants;
@ -171,6 +173,10 @@ public final class GUICoreUtils {
FRFont frFont = style.getFRFont();
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());
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.design.dialog.BasicDialog;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.gui.chart.MiddleChartDialog;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.third.joda.time.DateTime;
@ -87,6 +89,10 @@ public class ChartDialog extends MiddleChartDialog {
return new ActionListener() {
public void actionPerformed(ActionEvent e) {
chartTypePane.update((ChartCollection) cc, createTime);
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
if (adjustProvider != null) {
adjustProvider.adjustChartCollectionStyle(cc);
}
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.design.chart.gui.ChartComponent;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.ChartHyperEditPane;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.van.chart.config.DefaultStyleHelper4Van;
@ -67,7 +69,10 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane<ChartHyperPopli
private ChartCollection createChartCollection() {
ChartCollection cc = new ChartCollection();
cc.setThemeStyle(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplateTheme());
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
if (adjustProvider != null) {
adjustProvider.adjustChartCollectionStyle(cc);
}
ChartProvider chart = ChartTypeManager.getInstanceWithCheck().getFirstChart();
if (chart != null) {
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.chartx.attr.ChartProvider;
import com.fr.config.predefined.ColorFillStyle;
import com.fr.design.fun.DefaultValueAdjustProvider;
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.attr.axis.VanChartAlertValue;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
@ -54,7 +56,12 @@ public class DefaultStyleHelper4Van {
dealChartColor((VanChart) chartProvider);
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
if (adjustProvider != null) {
adjustProvider.adjustChart(chartProvider);
}
}
}
public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) {

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.formula.FormulaFactory;
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.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.style.FRFontPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.report.RichTextEditingPane;
import com.fr.design.report.RichTextPane;
import com.fr.design.style.color.UIToolbarColorButton;
import com.fr.design.utils.DesignUtils;
import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory;
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.MouseEvent;
import java.awt.event.MouseListener;
import java.math.BigDecimal;
/**
*
@ -512,12 +512,23 @@ public class RichTextToolBar extends BasicPane {
//pt转为px =*4/3
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
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