diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index 5e7807698a..9b30a42d45 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -19,6 +19,7 @@ import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.fit.common.TemplateTool; import com.fr.design.fun.ChartWidgetOptionProvider; import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.fun.ParameterWidgetOptionProvider; @@ -39,6 +40,7 @@ import com.fr.form.ui.ComboCheckBox; import com.fr.form.ui.DateEditor; import com.fr.form.ui.EditorHolder; import com.fr.form.ui.ElementCaseEditor; +import com.fr.form.ui.FieldEditor; import com.fr.form.ui.FileEditor; import com.fr.form.ui.FreeButton; import com.fr.form.ui.IframeEditor; @@ -51,6 +53,7 @@ import com.fr.form.ui.Radio; import com.fr.form.ui.RadioGroup; import com.fr.form.ui.TextArea; import com.fr.form.ui.TextEditor; +import com.fr.form.ui.ToggleButton; import com.fr.form.ui.TreeComboBoxEditor; import com.fr.form.ui.TreeEditor; import com.fr.form.ui.Widget; @@ -236,14 +239,30 @@ public class XCreatorUtils { } public static XCreator createThemedXCreator(Widget widget) { + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); TemplateTheme theme = template.getTemplateTheme(); if (theme instanceof FormTheme) { widget = setupTemplateTheme(widget, true, (FormTheme) theme, TemplateThemeCompatible.NONE); } + if (TemplateTool.isCurrentEditingNewJForm()){ + resetWidgetDefaultProperty(widget); + } return createXCreator(widget); } + /** + * 新表单下控件的字体默认都为9pt + * @param widget 控件 + */ + private static void resetWidgetDefaultProperty(Widget widget) { + if (widget.acceptType(FieldEditor.class)) { + ((FieldEditor) widget).setFontSize(Widget.DEFAULT_FONT_PT_SIZE); + } else if (widget.acceptType(ToggleButton.class)) { + ((ToggleButton) widget).setFontSize(Widget.DEFAULT_FONT_PT_SIZE); + } + } + /** * 创建creator *