Browse Source

REPORT-59097 【主题切换】悬浮元素默认样式,应该是跟随主题的默认

【问题原因】
设计器创建的悬浮元素样式均为当前模版主题中的"默认"样式

【改动思路】
同标题
fix-lag
Starryi 3 years ago
parent
commit
7890ad0d1b
  1. 41
      designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedFloatElement.java
  2. 3
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java
  3. 3
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java
  4. 3
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java
  5. 3
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java

41
designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedFloatElement.java

@ -0,0 +1,41 @@
package com.fr.design.mainframe.theme.utils;
import com.fr.base.NameStyle;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyle;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.JTemplate;
import com.fr.report.cell.FloatElement;
import com.fr.stable.unit.UNIT;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/9
*/
public class DefaultThemedFloatElement {
public static FloatElement createInstance() {
return themingFloatElement(new FloatElement());
}
public static FloatElement createInstance(Object value) {
return themingFloatElement(new FloatElement(value));
}
public static FloatElement createInstance(UNIT leftDistance, UNIT topDistance, UNIT width, UNIT height, Object value) {
return themingFloatElement(new FloatElement(leftDistance, topDistance, width, height, value));
}
private static FloatElement themingFloatElement(FloatElement floatElement) {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {
TemplateTheme theme = template.getTemplateTheme();
ThemedCellStyle themedCellStyle = theme.getCellStyleList().getUse4Default();
if (themedCellStyle != null) {
NameStyle nameStyle = NameStyle.getPassiveInstance(themedCellStyle.getName(), themedCellStyle.getStyle());
floatElement.setStyle(nameStyle);
}
}
return floatElement;
}
}

3
designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java

@ -13,6 +13,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartDialog; import com.fr.design.gui.chart.MiddleChartDialog;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.theme.utils.DefaultThemedFloatElement;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.grid.Grid; import com.fr.grid.Grid;
@ -90,7 +91,7 @@ public class ChartFloatAction extends ElementCaseAction {
public void doOk() { public void doOk() {
isRecordNeeded = true; isRecordNeeded = true;
FloatElement newFloatElement; FloatElement newFloatElement;
newFloatElement = new FloatElement(chartDialog.getChartCollection()); newFloatElement = DefaultThemedFloatElement.createInstance(chartDialog.getChartCollection());
newFloatElement.setWidth(new OLDPIX(BaseChartCollection.CHART_DEFAULT_WIDTH)); newFloatElement.setWidth(new OLDPIX(BaseChartCollection.CHART_DEFAULT_WIDTH));
newFloatElement.setHeight(new OLDPIX(BaseChartCollection.CHART_DEFAULT_HEIGHT)); newFloatElement.setHeight(new OLDPIX(BaseChartCollection.CHART_DEFAULT_HEIGHT));

3
designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java

@ -14,6 +14,7 @@ import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula; import com.fr.design.formula.UIFormula;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.theme.utils.DefaultThemedFloatElement;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.grid.Grid; import com.fr.grid.Grid;
@ -99,7 +100,7 @@ public class FormulaFloatAction extends ElementCaseAction {
} }
reportPane.stopEditing(); reportPane.stopEditing();
final FloatElement floatElement = new FloatElement(); final FloatElement floatElement = DefaultThemedFloatElement.createInstance();
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(BaseFormula.createFormulaBuilder().build()); formulaPane.populate(BaseFormula.createFormulaBuilder().build());

3
designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java

@ -12,6 +12,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.theme.utils.DefaultThemedFloatElement;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.report.SelectImagePane; import com.fr.design.report.SelectImagePane;
@ -73,7 +74,7 @@ public class ImageFloatAction extends ElementCaseAction {
reportPane.stopEditing(); reportPane.stopEditing();
final FloatElement floatElement = new FloatElement(); final FloatElement floatElement = DefaultThemedFloatElement.createInstance();
final SelectImagePane selectImagePane = new SelectImagePane(); final SelectImagePane selectImagePane = new SelectImagePane();
selectImagePane.populate(floatElement); selectImagePane.populate(floatElement);

3
designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java

@ -6,6 +6,7 @@ package com.fr.design.actions.insert.flot;
import com.fr.base.DynamicUnitList; import com.fr.base.DynamicUnitList;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.theme.utils.DefaultThemedFloatElement;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.grid.Grid; import com.fr.grid.Grid;
@ -59,7 +60,7 @@ public class TextBoxFloatAction extends AbstractShapeAction {
if (jws == null) { if (jws == null) {
return; return;
} }
FloatElement floatElement = new FloatElement("Text"); FloatElement floatElement = DefaultThemedFloatElement.createInstance("Text");
this.startDraw(floatElement); this.startDraw(floatElement);
doWithDrawingFloatElement(); doWithDrawingFloatElement();
} }

Loading…
Cancel
Save