Browse Source

REPORT-59523 【主题切换】拖入的新组件没有跟随主题

【问题原因】
新拖入的本地控件需强制跟随主题

【改动思路】
同上
fix-lag
Starryi 3 years ago
parent
commit
503d37c693
  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.Form;
import com.fr.form.main.WidgetGather; import com.fr.form.main.WidgetGather;
import com.fr.form.parameter.FormSubmitButton; import com.fr.form.parameter.FormSubmitButton;
import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.Button; import com.fr.form.ui.Button;
import com.fr.form.ui.CardAddButton; import com.fr.form.ui.CardAddButton;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
@ -232,7 +233,7 @@ public class XCreatorUtils {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
TemplateTheme theme = template.getTemplateTheme(); TemplateTheme theme = template.getTemplateTheme();
if (theme instanceof FormTheme) { if (theme instanceof FormTheme) {
setupTemplateTheme(creator, (FormTheme) theme, TemplateThemeCompatible.NONE); setupTemplateTheme(creator, true, (FormTheme) theme, TemplateThemeCompatible.NONE);
} }
return creator; return creator;
} }
@ -378,12 +379,15 @@ public class XCreatorUtils {
return null; 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); FineColorGather colorGather = new FineColorManager.FineColorReplaceByTheme(currentTemplateUsingTheme, compatible);
Form.traversalWidget(container.toData(), new WidgetGather() { Form.traversalWidget(container.toData(), new WidgetGather() {
@Override @Override
public void dealWith(Widget widget) { public void dealWith(Widget widget) {
TemplateThemeAware<FormTheme> themedWidget = (TemplateThemeAware) widget; TemplateThemeAware<FormTheme> themedWidget = (TemplateThemeAware) widget;
if (forceFollowingTheme && widget instanceof AbstractBorderStyleWidget) {
((AbstractBorderStyleWidget) widget).setBorderStyleFollowingTheme(true);
}
themedWidget.onTemplateUsingThemeChange(currentTemplateUsingTheme, compatible); 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(); creatorSource = no.getNameOption().createWidget();
} }
if (creatorSource != null) { if (creatorSource != null) {
XCreator xCreator = XCreatorUtils.createXCreator(creatorSource); XCreator xCreator = XCreatorUtils.createThemedXCreator(creatorSource);
WidgetToolBarPane.getTarget().startDraggingBean(xCreator); WidgetToolBarPane.getTarget().startDraggingBean(xCreator);
FormDesignerUtils.addWidgetProcessInfo(xCreator.toData()); FormDesignerUtils.addWidgetProcessInfo(xCreator.toData());
lastPressEvent = null; 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()) && boolean isCurrentUsingThemeSuitSharedComponent = StringUtils.isNotEmpty(theme.getName()) &&
StringUtils.isNotEmpty(suitableTemplateThemeName) && StringUtils.isNotEmpty(suitableTemplateThemeName) &&
StringUtils.equals(theme.getName(), 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; return creator;
} }

Loading…
Cancel
Save