Browse Source

Merge remote-tracking branch 'origin/feature/x' into feature/x

feature/x
Yvan-欧阳帆 2 years ago
parent
commit
096ebce6fe
  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. 3
      designer-base/src/main/resources/com/fr/design/images/buttonicon/replace_help.svg
  11. 6
      designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java
  12. 7
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java
  13. 7
      designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java
  14. 63
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  15. 3
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  16. 47
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java
  17. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java
  18. 19
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java
  19. 22
      designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.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) {

3
designer-base/src/main/resources/com/fr/design/images/buttonicon/replace_help.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15ZM8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14ZM6.193 4.696C6.655 4.223 7.293 3.992 8.107 3.992C8.811 3.992 9.383 4.179 9.823 4.575C10.263 4.96 10.483 5.488 10.483 6.148C10.483 6.687 10.34 7.138 10.065 7.49C9.966 7.611 9.658 7.897 9.141 8.348C8.932 8.524 8.778 8.722 8.679 8.92C8.558 9.14 8.503 9.382 8.503 9.646V9.733C8.503 9.78823 8.45823 9.833 8.403 9.833H7.426C7.37077 9.833 7.326 9.78823 7.326 9.733V9.646C7.326 9.239 7.392 8.887 7.546 8.601C7.689 8.293 8.107 7.842 8.789 7.237L8.976 7.028C9.174 6.775 9.284 6.511 9.284 6.225C9.284 5.84 9.174 5.543 8.965 5.323C8.745 5.103 8.426 4.993 8.03 4.993C7.535 4.993 7.172 5.147 6.952 5.466C6.76786 5.71152 6.66935 6.05217 6.65646 6.48796C6.65482 6.54316 6.61023 6.588 6.555 6.588H5.6C5.54477 6.588 5.49986 6.54311 5.50122 6.4879C5.51978 5.7327 5.75038 5.13862 6.193 4.696ZM7.337 10.647C7.491 10.493 7.689 10.427 7.909 10.427C8.14 10.427 8.338 10.493 8.492 10.647C8.646 10.79 8.723 10.977 8.723 11.208C8.723 11.439 8.635 11.626 8.481 11.78C8.327 11.923 8.129 12 7.909 12C7.689 12 7.491 11.923 7.337 11.769C7.183 11.615 7.106 11.428 7.106 11.208C7.106 10.977 7.183 10.79 7.337 10.647Z" fill="#419BF9"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

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) {

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

3
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java

@ -23,7 +23,6 @@ import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.ActionEvent;
@ -153,7 +152,7 @@ public class ITReplaceMainDialog extends UIDialog {
});
center.add(northPane.getScrollPane(), BorderLayout.NORTH);
center.add(southPanel.getTableEditorPane(), BorderLayout.CENTER);
add(westPanel.getLeftJpanel(), BorderLayout.WEST);
add(westPanel.getLeftPanel(), BorderLayout.WEST);
//主体部分
add(center, BorderLayout.CENTER);
center.setVisible(true);

47
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java

@ -1,14 +1,21 @@
package com.fr.design.actions.replace.ui;
import com.fr.base.svg.IconUtils;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.share.ui.base.MouseClickListener;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
/**
* 左侧面板
@ -18,28 +25,46 @@ import java.awt.GridLayout;
* created by Destiny.Lin on 2022-09-05
*/
public class ITReplaceWestPanel {
JPanel leftJpanel;
private JPanel leftPanel;
private UILabel iconLabel;
private static final Icon HELP_ICON = IconUtils.readIcon("com/fr/design/images/buttonicon/replace_help.svg");
private static final String HELP_URL = CloudCenter.getInstance().acquireUrlByKind("design.replace.help", "https://help.fanruan.com/finereport/doc-view-4954.html?source=3");
private static final int FILL_COUNT = 13;
public ITReplaceWestPanel() {
leftJpanel = new JPanel(new GridLayout(15, 1, 0, 0));
leftPanel = new JPanel(new GridLayout(15, 1, 0, 0));
iconLabel = new UILabel("<html><u><font color = 'rgb(61,153,249)'>" + Toolkit.i18nText("Fine-Design_Report_Community_Help") + "</font></u></html>");
UIToggleButton contentButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Basic_Templates_Content"));
contentButton.setSelected(true);
contentButton.setBorderPainted(false);
leftJpanel.add(contentButton);
leftJpanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, new Color(218, 218, 221)));
leftPanel.add(contentButton);
leftPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, new Color(218, 218, 221)));
//填充一下面板
int labelNum = 14;
for (int i = 0; i < labelNum; i++) {
leftJpanel.add(new UILabel(StringUtils.EMPTY));
for (int i = 0; i < FILL_COUNT; i++) {
leftPanel.add(new UILabel(StringUtils.EMPTY));
}
//添加帮助文档按钮及超链
iconLabel.setIcon(HELP_ICON);
iconLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Replace_Tooltip"));
//设置游标
iconLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
iconLabel.addMouseListener(new MouseClickListener() {
@Override
public void mouseClicked(MouseEvent e) {
BrowseUtils.browser(HELP_URL);
}
});
leftPanel.add(iconLabel);
}
public JPanel getLeftJpanel() {
return leftJpanel;
public JPanel getLeftPanel() {
return leftPanel;
}
public void setLeftJpanel(JPanel leftJpanel) {
this.leftJpanel = leftJpanel;
public void setLeftPanel(JPanel leftPanel) {
this.leftPanel = leftPanel;
}
}

2
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java

@ -102,8 +102,8 @@ public class ITTableEditor extends UITableModelAdapter {
public void add(List<? extends Info> list) {
for (Info info : list) {
addRow(info.getContent());
fireTableDataChanged();
}
fireTableDataChanged();
}
public enum ChooseIndex {

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);
}

22
designer-realize/src/main/java/com/fr/grid/AbstractGridHeaderMouseHandler.java

@ -38,6 +38,8 @@ import java.lang.reflect.Method;
public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
protected static final int FUZZY_EDGE = 10;
protected static final int SEPARATOR_GAP = 5;
//只选中一个
private static final int ONLY_SELECT_ONE = 1;
protected GridHeader gHeader;
private int dragType = GridUtils.DRAG_NONE;
@ -109,7 +111,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
if (between(evt, tmpSize1, tmpSize2)) {
if (index >= dragIndex) {
try {
if(method != null) {
if (method != null) {
method.invoke(report, dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution));
}
} catch (Exception e) {
@ -118,7 +120,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
//sizeList.set(dragIndex, FU.valueOfPix(evtOffset(evt, oldEndValueSize), resolution));
} else {
try {
if(method != null) {
if (method != null) {
method.invoke(report, index, FU.valueOfPix(evtOffset(evt, (int) tmpSize1), resolution));
}
} catch (Exception e) {
@ -128,7 +130,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
// from all to do.
for (int h = (dragIndex - 1); h > index; h--) {
try {
if(method != null) {
if (method != null) {
method.invoke(report, h, UNIT.ZERO);
}
} catch (Exception e) {
@ -219,7 +221,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
ePane.getGrid().stopEditing();// james 停止当前的所有编辑
// peter:选中格子位置.
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(ePane, evt.getX(), evt.getY(),resolution);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(ePane, evt.getX(), evt.getY(), resolution);
iterateScrollBar(ePane, evt, PRESS_ACTION);
@ -227,7 +229,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
if (SwingUtilities.isRightMouseButton(evt)) {
Selection cs = ePane.getSelection();
resetSelectionByRightButton(selectedCellPoint, cs, ePane);
checkEndMultiSelectIndex(cs);
UIPopupMenu popupMenu = createPopupMenu(ePane, evt, Math.max(dragIndex, Math.max(this.startMultiSelectIndex, this.endMultiSelectIndex)));
if (popupMenu != null) {
GUICoreUtils.showPopupMenu(popupMenu, gHeader, evt.getX() + 1, evt.getY() + 1);
@ -246,6 +248,16 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
ePane.repaint();
}
/**
* 如果行列中有只选中一个的情况更新下endIndex防止列宽或行宽不匹配
* @param selection 与ElementCasePane绑定的选择对象
*/
private void checkEndMultiSelectIndex(Selection selection) {
if (selection.getSelectedColumns().length == ONLY_SELECT_ONE || selection.getSelectedRows().length == ONLY_SELECT_ONE) {
this.endMultiSelectIndex = this.startMultiSelectIndex;
}
}
protected abstract void resetSelectionByRightButton(ColumnRow mouseSelectedColumnRow, Selection cs, ElementCasePane ePane);

Loading…
Cancel
Save