Browse Source

Pull request #5855: REPORT-59523 【主题切换】拖入的新组件没有跟随主题

Merge in DESIGN/design from ~STARRYI/design:final/11.0 to final/11.0

* commit '503d37c69327968d1cc28eef69595da852cb526b':
  REPORT-59523 【主题切换】拖入的新组件没有跟随主题
persist/11.0
starryi 3 years ago
parent
commit
7a65d3f293
  1. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  2. 2
      designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java
  3. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java

8
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -28,6 +28,7 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.main.Form;
import com.fr.form.main.WidgetGather;
import com.fr.form.parameter.FormSubmitButton;
import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.Button;
import com.fr.form.ui.CardAddButton;
import com.fr.form.ui.CardSwitchButton;
@ -232,7 +233,7 @@ public class XCreatorUtils {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
TemplateTheme theme = template.getTemplateTheme();
if (theme instanceof FormTheme) {
setupTemplateTheme(creator, (FormTheme) theme, TemplateThemeCompatible.NONE);
setupTemplateTheme(creator, true, (FormTheme) theme, TemplateThemeCompatible.NONE);
}
return creator;
}
@ -378,12 +379,15 @@ public class XCreatorUtils {
return null;
}
public static void setupTemplateTheme(XCreator container, final FormTheme currentTemplateUsingTheme, TemplateThemeCompatible compatible) {
public static void setupTemplateTheme(XCreator container, final boolean forceFollowingTheme, final FormTheme currentTemplateUsingTheme, TemplateThemeCompatible compatible) {
FineColorGather colorGather = new FineColorManager.FineColorReplaceByTheme(currentTemplateUsingTheme, compatible);
Form.traversalWidget(container.toData(), new WidgetGather() {
@Override
public void dealWith(Widget widget) {
TemplateThemeAware<FormTheme> themedWidget = (TemplateThemeAware) widget;
if (forceFollowingTheme && widget instanceof AbstractBorderStyleWidget) {
((AbstractBorderStyleWidget) widget).setBorderStyleFollowingTheme(true);
}
themedWidget.onTemplateUsingThemeChange(currentTemplateUsingTheme, compatible);
}

2
designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java

@ -99,7 +99,7 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio
creatorSource = no.getNameOption().createWidget();
}
if (creatorSource != null) {
XCreator xCreator = XCreatorUtils.createXCreator(creatorSource);
XCreator xCreator = XCreatorUtils.createThemedXCreator(creatorSource);
WidgetToolBarPane.getTarget().startDraggingBean(xCreator);
FormDesignerUtils.addWidgetProcessInfo(xCreator.toData());
lastPressEvent = null;

2
designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java

@ -61,7 +61,7 @@ public class ShareComponentUtils {
boolean isCurrentUsingThemeSuitSharedComponent = StringUtils.isNotEmpty(theme.getName()) &&
StringUtils.isNotEmpty(suitableTemplateThemeName) &&
StringUtils.equals(theme.getName(), suitableTemplateThemeName);
XCreatorUtils.setupTemplateTheme(creator, (FormTheme) theme, isCurrentUsingThemeSuitSharedComponent ? TemplateThemeCompatible.NONE : TemplateThemeCompatible.ABSENT);
XCreatorUtils.setupTemplateTheme(creator, false, (FormTheme) theme, isCurrentUsingThemeSuitSharedComponent ? TemplateThemeCompatible.NONE : TemplateThemeCompatible.ABSENT);
}
return creator;
}

Loading…
Cancel
Save