Browse Source

REPORT-83259 & REPORT-83263 【最强控件】控件样式跟随主题&开放自定义

feature/x
Bruce.Deng 2 years ago
parent
commit
e9c268f525
  1. 22
      designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java
  2. 25
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java
  3. 9
      designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java
  4. 10
      designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java
  5. 27
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
  6. 23
      designer-base/src/main/java/com/fr/design/mainframe/theme/processor/AbstractThemePreviewPaneProcessor.java
  7. 35
      designer-base/src/main/java/com/fr/design/mainframe/theme/processor/ThemePreviewPaneProcessor.java
  8. 34
      designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java
  9. 25
      designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java
  10. 47
      designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java
  11. 31
      designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  12. 3
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

22
designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java

@ -0,0 +1,22 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.stable.fun.mark.Mutable;
/**
* @author Bruce.Deng
* @version 11.0
* Created by Bruce.Deng on 2023/2/7
*/
public interface TemplateThemePaneProvider<T> extends Mutable {
String XML_TAG = "TemplateThemePaneProvider";
int CURRENT_LEVEL = 1;
String getTabName();
BasicBeanPane<T> getTab();
}

25
designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java

@ -0,0 +1,25 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.TemplateThemePaneProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author Bruce.Deng
* @version 11.0
* Created by Bruce.Deng on 2023/2/7
*/
@API(level = TemplateThemePaneProvider.CURRENT_LEVEL)
public abstract class AbstractTemplateThemePaneProvider extends AbstractProvider implements TemplateThemePaneProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

9
designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java

@ -4,12 +4,14 @@ import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemedComponentStyle; import com.fr.base.theme.settings.ThemedComponentStyle;
import com.fr.base.theme.settings.ThemedFormBodyStyle; import com.fr.base.theme.settings.ThemedFormBodyStyle;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.theme.edit.ChartStyleFormEditPane; import com.fr.design.mainframe.theme.edit.ChartStyleFormEditPane;
import com.fr.design.mainframe.theme.edit.ComponentStyleEditPane; import com.fr.design.mainframe.theme.edit.ComponentStyleEditPane;
import com.fr.design.mainframe.theme.edit.FormBodyStyleEditPane; import com.fr.design.mainframe.theme.edit.FormBodyStyleEditPane;
import com.fr.design.mainframe.theme.preview.FormThemePreviewPane; import com.fr.design.mainframe.theme.preview.FormThemePreviewPane;
import com.fr.design.mainframe.theme.processor.ThemePreviewPaneProcessor;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -31,7 +33,11 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane<FormTheme> {
} }
@Override @Override
public FormThemePreviewPane createThemePreviewPane() { public TemplateThemePreviewPane<FormTheme> createThemePreviewPane() {
ThemePreviewPaneProcessor processor = ExtraDesignClassManager.getInstance().getSingle(ThemePreviewPaneProcessor.XML_TAG);
if (processor != null) {
return processor.createFormThemePreviewPane();
}
return new FormThemePreviewPane(); return new FormThemePreviewPane();
} }
@ -61,6 +67,7 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane<FormTheme> {
componentStyleSettingPane = new ComponentStyleEditPane(); componentStyleSettingPane = new ComponentStyleEditPane();
addCustomEditorPane(i18nText("Fine-Design_Predefined_Component_Style"), componentStyleSettingPane); addCustomEditorPane(i18nText("Fine-Design_Predefined_Component_Style"), componentStyleSettingPane);
addExtraEditPane();
} }
@Override @Override

10
designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java

@ -2,10 +2,11 @@ package com.fr.design.mainframe.theme;
import com.fr.base.theme.ReportTheme; import com.fr.base.theme.ReportTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.theme.edit.ReportBodyStyleEditPane; import com.fr.design.mainframe.theme.edit.ReportBodyStyleEditPane;
import com.fr.design.mainframe.theme.preview.ReportThemePreviewPane; import com.fr.design.mainframe.theme.preview.ReportThemePreviewPane;
import javax.swing.JPanel; import com.fr.design.mainframe.theme.processor.ThemePreviewPaneProcessor;
/** /**
* @author Starryi * @author Starryi
@ -20,7 +21,11 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane<ReportTheme
} }
@Override @Override
public ReportThemePreviewPane createThemePreviewPane() { public TemplateThemePreviewPane<ReportTheme> createThemePreviewPane() {
ThemePreviewPaneProcessor processor = ExtraDesignClassManager.getInstance().getSingle(ThemePreviewPaneProcessor.XML_TAG);
if (processor != null) {
return processor.createReportThemePreviewPane();
}
return new ReportThemePreviewPane(); return new ReportThemePreviewPane();
} }
@ -44,6 +49,7 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane<ReportTheme
addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Template_Background"), reportBodyStyleSettingPane); addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Template_Background"), reportBodyStyleSettingPane);
addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Cell_Style"), createCellStyleSettingPane()); addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Cell_Style"), createCellStyleSettingPane());
addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Chart_Style"), createChartStyleSettingPane()); addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Chart_Style"), createChartStyleSettingPane());
addExtraEditPane();
} }
@Override @Override

27
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java

@ -1,13 +1,14 @@
package com.fr.design.mainframe.theme; package com.fr.design.mainframe.theme;
import com.fr.base.theme.FineColorFlushUtils;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.FineColorSynchronizer; import com.fr.base.theme.FineColorSynchronizer;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemedCellStyleList; import com.fr.base.theme.settings.ThemedCellStyleList;
import com.fr.base.theme.settings.ThemedColorScheme; import com.fr.base.theme.settings.ThemedColorScheme;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.TemplateThemePaneProvider;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
@ -34,7 +35,9 @@ import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* @author Starryi * @author Starryi
@ -52,6 +55,7 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
protected ColorListPane colorListPane; protected ColorListPane colorListPane;
protected CellStyleListEditPane cellStyleSettingPane; protected CellStyleListEditPane cellStyleSettingPane;
protected ChartStyleEditPane chartStyleSettingPane; protected ChartStyleEditPane chartStyleSettingPane;
protected final List<BasicBeanPane<T>> extraPaneList = new ArrayList<>();
protected boolean isPopulating = false; protected boolean isPopulating = false;
protected UITabbedPane uiTabbedPane; protected UITabbedPane uiTabbedPane;
@ -192,6 +196,18 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
}); });
uiTabbedPane.addTab(title, settingPane); uiTabbedPane.addTab(title, settingPane);
} }
protected void addExtraEditPane() {
Set<TemplateThemePaneProvider<T>> providers = ExtraDesignClassManager.getInstance().getArray(TemplateThemePaneProvider.XML_TAG);
if (providers != null) {
for (TemplateThemePaneProvider<T> provider : providers) {
BasicBeanPane<T> tab = provider.getTab();
extraPaneList.add(tab);
addCustomEditorPane(provider.getTabName(), tab);
}
}
}
protected JPanel createCellStyleSettingPane() { protected JPanel createCellStyleSettingPane() {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
cellStyleSettingPane = new CellStyleListEditPane(); cellStyleSettingPane = new CellStyleListEditPane();
@ -223,6 +239,9 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
colorListPane.populate(theme.getColorScheme().getColors()); colorListPane.populate(theme.getColorScheme().getColors());
populateBean4CustomEditors(theme); populateBean4CustomEditors(theme);
for (BasicBeanPane<T> pane : extraPaneList) {
pane.populateBean(theme);
}
isPopulating = false; isPopulating = false;
} }
@ -243,7 +262,9 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
theme.setColorScheme(colorScheme); theme.setColorScheme(colorScheme);
updateBean4CustomEditors(theme); updateBean4CustomEditors(theme);
for (BasicBeanPane<T> pane : extraPaneList) {
pane.updateBean(theme);
}
return theme; return theme;
} }

23
designer-base/src/main/java/com/fr/design/mainframe/theme/processor/AbstractThemePreviewPaneProcessor.java

@ -0,0 +1,23 @@
package com.fr.design.mainframe.theme.processor;
import com.fr.stable.fun.mark.API;
/**
* @author Bruce.Deng
* @version 11.0
* Created by Bruce.Deng on 2023/2/14
*/
@API(level = ThemePreviewPaneProcessor.CURRENT_LEVEL)
public abstract class AbstractThemePreviewPaneProcessor implements ThemePreviewPaneProcessor {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

35
designer-base/src/main/java/com/fr/design/mainframe/theme/processor/ThemePreviewPaneProcessor.java

@ -0,0 +1,35 @@
package com.fr.design.mainframe.theme.processor;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.ReportTheme;
import com.fr.design.mainframe.theme.TemplateThemePreviewPane;
import com.fr.stable.fun.mark.Immutable;
/**
* 主题样式预览界面接口
*
* @author Bruce.Deng
* @version 11.0
* Created by Bruce.Deng on 2023/2/14
*/
public interface ThemePreviewPaneProcessor extends Immutable {
String XML_TAG = "ThemePreviewPaneProcessor";
int CURRENT_LEVEL = 1;
/**
* 创建报表主题样式预览界面
*
* @return 报表主题样式预览界面
*/
TemplateThemePreviewPane<ReportTheme> createReportThemePreviewPane();
/**
* 创建决策报表主题样式预览界面
*
* @return 决策报表主题样式预览界面
*/
TemplateThemePreviewPane<FormTheme> createFormThemePreviewPane();
}

34
designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java

@ -0,0 +1,34 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.creator.XCreator;
import com.fr.stable.fun.mark.Mutable;
/**
* 控件属性面板的高级设置项扩展
*
* @author Bruce.Deng
* @version 11.0
* Created by Bruce.Deng on 2023/2/15
*/
public interface WidgetAdvancedPaneProvider<T> extends Mutable {
String XML_TAG = "WidgetAdvancedPaneProvider";
int CURRENT_LEVEL = 1;
/**
* 是否需要处理
*
* @param creator
* @return true:需要处理/false:不处理
*/
boolean accept(XCreator creator);
/**
* 创建控件高级设置项的追加面板
*
* @return 高级设置项追加面板
*/
BasicBeanPane<T> createExtraAdvancedPane();
}

25
designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java

@ -0,0 +1,25 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author Bruce.Deng
* @version 11.0
* Created by Bruce.Deng on 2023/2/15
*/
@API(level = WidgetAdvancedPaneProvider.CURRENT_LEVEL)
public abstract class AbstractWidgetAdvancedPaneProvider extends AbstractProvider implements WidgetAdvancedPaneProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

47
designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java

@ -2,6 +2,7 @@ package com.fr.design.parameter;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.CRPropertyDescriptor;
@ -13,6 +14,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fit.common.TemplateTool; import com.fr.design.fit.common.TemplateTool;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.ParameterExpandablePaneUIProvider; import com.fr.design.fun.ParameterExpandablePaneUIProvider;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -41,6 +43,8 @@ import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import java.util.Set; import java.util.Set;
/** /**
@ -59,6 +63,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
//是否是新设计模式下决策报表 //是否是新设计模式下决策报表
private boolean newForm; private boolean newForm;
private PropertyGroupPane extraPropertyGroupPane; private PropertyGroupPane extraPropertyGroupPane;
protected final List<BasicBeanPane<WParameterLayout>> extraPaneList = new ArrayList<>();
public RootDesignDefinePane(XCreator xCreator) { public RootDesignDefinePane(XCreator xCreator) {
super(xCreator); super(xCreator);
@ -144,7 +149,6 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
fireAfterEditor.setSelected(false); fireAfterEditor.setSelected(false);
} }
}); });
background = new AccessibleBackgroundEditor();
Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"),}; BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"),};
@ -159,7 +163,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), background}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), getBackgroundPane()},
new Component[]{displayReport, null}, new Component[]{displayReport, null},
new Component[]{useParamsTemplate, null}, new Component[]{useParamsTemplate, null},
new Component[]{fireAfterEditor, null}, new Component[]{fireAfterEditor, null},
@ -199,7 +203,6 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
fireAfterEditor.setSelected(false); fireAfterEditor.setSelected(false);
} }
}); });
background = new AccessibleBackgroundEditor();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
@ -208,7 +211,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), background}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), getBackgroundPane()},
new Component[]{displayReport, null}, new Component[]{displayReport, null},
new Component[]{useParamsTemplate, null}, new Component[]{useParamsTemplate, null},
new Component[]{fireAfterEditor, null}, new Component[]{fireAfterEditor, null},
@ -229,7 +232,13 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
@Override @Override
public void populateBean(WParameterLayout ob) { public void populateBean(WParameterLayout ob) {
labelNameTextField.setText(ob.getLabelName()); labelNameTextField.setText(ob.getLabelName());
if (extraPaneList.isEmpty()) {
background.setValue(ob.getBackground()); background.setValue(ob.getBackground());
} else {
for (BasicBeanPane<WParameterLayout> pane : extraPaneList) {
pane.populateBean(ob);
}
}
displayReport.setSelected(ob.isDelayDisplayContent()); displayReport.setSelected(ob.isDelayDisplayContent());
useParamsTemplate.setSelected(ob.isUseParamsTemplate()); useParamsTemplate.setSelected(ob.isUseParamsTemplate());
fireAfterEditor.setEnabled(ob.isUseParamsTemplate()); fireAfterEditor.setEnabled(ob.isUseParamsTemplate());
@ -277,8 +286,14 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
wParameterLayout.setParamsFireStopEdit(fireAfterEditor.isSelected()); wParameterLayout.setParamsFireStopEdit(fireAfterEditor.isSelected());
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected()); jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected());
wParameterLayout.setBackground((Background) background.getValue());
wParameterLayout.setPosition((Integer) hAlignmentPane.getSelectedItem()); wParameterLayout.setPosition((Integer) hAlignmentPane.getSelectedItem());
if (extraPaneList.isEmpty()) {
wParameterLayout.setBackground((Background) background.getValue());
} else {
for (BasicBeanPane<WParameterLayout> pane : extraPaneList) {
pane.updateBean(wParameterLayout);
}
}
return wParameterLayout; return wParameterLayout;
} }
@ -299,6 +314,13 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected()); jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected());
wParameterLayout.setBackground((Background) background.getValue()); wParameterLayout.setBackground((Background) background.getValue());
if (extraPaneList.isEmpty()) {
background.setValue(wParameterLayout.getBackground());
} else {
for (BasicBeanPane<WParameterLayout> pane : extraPaneList) {
pane.populateBean(wParameterLayout);
}
}
//设置参数模板面板的高度 //设置参数模板面板的高度
int height = (int) paraHeight.getTextField().getValue(); int height = (int) paraHeight.getTextField().getValue();
FormDesigner designer = TemplateTool.getCurrentEditingNewJForm().getFormDesign(); FormDesigner designer = TemplateTool.getCurrentEditingNewJForm().getFormDesign();
@ -331,4 +353,19 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
public DataCreatorUI dataUI() { public DataCreatorUI dataUI() {
return null; return null;
} }
private Component getBackgroundPane() {
Set<WidgetAdvancedPaneProvider<WParameterLayout>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
if (providers != null) {
for (WidgetAdvancedPaneProvider<WParameterLayout> provider : providers) {
if (provider.accept(creator)) {
BasicBeanPane<WParameterLayout> extraAdvancedPane = provider.createExtraAdvancedPane();
extraPaneList.add(extraAdvancedPane);
return extraAdvancedPane;
}
}
}
background = new AccessibleBackgroundEditor();
return background;
}
} }

31
designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java

@ -1,6 +1,7 @@
package com.fr.design.widget.ui.designer; package com.fr.design.widget.ui.designer;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.ErrorMsgTextFieldAdapter; import com.fr.design.beans.ErrorMsgTextFieldAdapter;
import com.fr.design.beans.UITextFieldAdapter; import com.fr.design.beans.UITextFieldAdapter;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
@ -12,6 +13,7 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.TextFieldAdapterProvider; import com.fr.design.fun.TextFieldAdapterProvider;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
@ -27,6 +29,9 @@ import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> { public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> {
protected UICheckBox allowBlankCheckBox; protected UICheckBox allowBlankCheckBox;
@ -35,7 +40,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
protected JPanel validatePane; protected JPanel validatePane;
protected FontSizeComboPane fontSizePane; protected FontSizeComboPane fontSizePane;
protected UITextField labelNameTextField; protected UITextField labelNameTextField;
protected final List<BasicBeanPane<T>> extraPaneList = new ArrayList<>();
public FieldEditorDefinePane(XCreator xCreator) { public FieldEditorDefinePane(XCreator xCreator) {
super(xCreator); super(xCreator);
@ -49,8 +54,9 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
fontSizePane = new FontSizeComboPane(); fontSizePane = new FontSizeComboPane();
JPanel contentPane = this.setFirstContentPane(); JPanel contentPane = this.setFirstContentPane();
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel jPanel = FRGUIPaneFactory.createYBoxEmptyBorderPane();
jPanel.add(contentPane, BorderLayout.CENTER); jPanel.add(contentPane);
this.addExtraAdvancedPane(jPanel, creator);
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
if (contentPane != null) { if (contentPane != null) {
UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, jPanel); UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, jPanel);
@ -59,12 +65,28 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
this.addValidatePane(); this.addValidatePane();
} }
protected void addExtraAdvancedPane(JPanel jPanel, XCreator xCreator) {
Set<WidgetAdvancedPaneProvider<T>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
if (providers != null) {
for (WidgetAdvancedPaneProvider<T> provider : providers) {
if (provider.accept(xCreator)) {
BasicBeanPane<T> extraAdvancedPane = provider.createExtraAdvancedPane();
extraPaneList.add(extraAdvancedPane);
jPanel.add(extraAdvancedPane);
}
}
}
}
@Override @Override
public void populateBean(T ob) { public void populateBean(T ob) {
this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); this.allowBlankCheckBox.setSelected(ob.isAllowBlank());
this.errorMsgTextField.setText(ob.getErrorMessage()); this.errorMsgTextField.setText(ob.getErrorMessage());
this.fontSizePane.setValue(ob.getFontSize()); this.fontSizePane.setValue(ob.getFontSize());
this.labelNameTextField.setText(ob.getLabelName()); this.labelNameTextField.setText(ob.getLabelName());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.populateBean(ob);
}
populateSubFieldEditorBean(ob); populateSubFieldEditorBean(ob);
} }
@ -78,6 +100,9 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
e.setErrorMessage(this.errorMsgTextField.getText()); e.setErrorMessage(this.errorMsgTextField.getText());
e.setFontSize(fontSizePane.getValue()); e.setFontSize(fontSizePane.getValue());
e.setLabelName(labelNameTextField.getText()); e.setLabelName(labelNameTextField.getText());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.updateBean(e);
}
return e; return e;
} }

3
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -1311,6 +1311,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName()); boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName());
getTarget().setTemplateTheme(newTheme, compatible); getTarget().setTemplateTheme(newTheme, compatible);
getTarget().getReportParameterAttr().onTemplateUsingThemeChange(newTheme, compatible);
setTarget((WorkBook) FineColorSynchronizer.flush(getTarget(), newTheme, compatible)); setTarget((WorkBook) FineColorSynchronizer.flush(getTarget(), newTheme, compatible));
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) { if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
@ -1318,6 +1319,8 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
reportComposite.setSelectedIndex(reportComposite.getSelectedIndex()); reportComposite.setSelectedIndex(reportComposite.getSelectedIndex());
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView(); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
// 刷新参数面板界面
populateReportParameterAttr();
} }
super.setTemplateTheme(newTheme, compatible); super.setTemplateTheme(newTheme, compatible);

Loading…
Cancel
Save