Browse Source

Pull request #11649: REPORT-91591 单元格控件的自定义样式设置

Merge in DESIGN/design from ~JOHN.YING/design:feature/x to feature/x

* commit '991fbb1418d7772568b3f7859fc180c3e416009d':
  REPORT-91591 单元格控件的自定义样式设置--代码格式调整
  REPORT-91591 单元格控件的自定义样式设置
feature/x
John.Ying-应志浩 2 years ago
parent
commit
c9cf464089
  1. 79
      designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxDefinePane.java
  2. 19
      designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java
  3. 10
      designer-realize/src/main/java/com/fr/design/widget/ui/ComboBoxDefinePane.java
  4. 9
      designer-realize/src/main/java/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java
  5. 17
      designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java
  6. 18
      designer-realize/src/main/java/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java
  7. 71
      designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java
  8. 28
      designer-realize/src/main/java/com/fr/design/widget/ui/NumberEditorDefinePane.java
  9. 11
      designer-realize/src/main/java/com/fr/design/widget/ui/PasswordDefinePane.java
  10. 30
      designer-realize/src/main/java/com/fr/design/widget/ui/RadioGroupDefinePane.java
  11. 12
      designer-realize/src/main/java/com/fr/design/widget/ui/TextAreaDefinePane.java
  12. 22
      designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java
  13. 9
      designer-realize/src/main/java/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java
  14. 21
      designer-realize/src/main/java/com/fr/design/widget/ui/TreeEditorDefinePane.java

79
designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxDefinePane.java

@ -1,21 +1,35 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
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.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
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;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.CheckBox; import com.fr.form.ui.CheckBox;
import com.fr.general.GeneralContext;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JPanel;
import java.awt.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> { public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
private UITextField text; private UITextField text;
protected final List<BasicBeanPane<CheckBox>> extraPaneList = new ArrayList<>();
protected JPanel extraPane;
protected static double F = TableLayout.FILL;
protected static double P = TableLayout.PREFERRED;
public CheckBoxDefinePane() { public CheckBoxDefinePane() {
this.iniComponents(); this.iniComponents();
} }
@ -23,14 +37,14 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
private void iniComponents() { private void iniComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
text = new UITextField(); text = new UITextField();
double f = TableLayout.FILL; initExtraPane();
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text")), text}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text")), text},
new Component[]{extraPane, null},
}; };
double[] rowSize = {p}; double[] rowSize = {P,P};
double[] columnSize = {p, f}; double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}};
JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 24, pane); UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 24, pane);
@ -39,6 +53,51 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
this.add(uiExpandablePane); this.add(uiExpandablePane);
} }
protected void initExtraPane() {
initPluginListener();
refreshExtraAdvancedPane();
}
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<CheckBox>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<CheckBox> provider : providers) {
if (!provider.accept(CheckBox.class)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<CheckBox> pane : extraPaneList) {
extraPane.add(pane);
}
}
}
protected void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG));
}
/**
* 插入配置项面板
*
* @param index 插入的位置
* @param pane 配置项面板
*/
protected void insertShortCut(int index, BasicBeanPane<CheckBox> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "CheckBox"; return "CheckBox";
@ -47,12 +106,18 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
@Override @Override
public void populateBean(CheckBox check) { public void populateBean(CheckBox check) {
text.setText(check.getText()); text.setText(check.getText());
for (BasicBeanPane<CheckBox> pane : extraPaneList) {
pane.populateBean(check);
}
} }
@Override @Override
public CheckBox updateBean() { public CheckBox updateBean() {
CheckBox box = new CheckBox(); CheckBox box = new CheckBox();
box.setText(text.getText()); box.setText(text.getText());
for (BasicBeanPane<CheckBox> pane : extraPaneList) {
pane.updateBean(box);
}
return box; return box;
} }
} }

19
designer-realize/src/main/java/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java

@ -1,11 +1,19 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.*; import java.awt.*;
import java.util.Set;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants;
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.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.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
@ -43,21 +51,28 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane<CheckBoxGroup
returnTypePane = new ReturnTypePane(); returnTypePane = new ReturnTypePane();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
initExtraPane();
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{buttonGroupDictPane, null }, new Component[]{buttonGroupDictPane, null },
new Component[]{checkbox, null }, new Component[]{checkbox, null },
new Component[]{returnTypePane, null }, new Component[]{returnTypePane, null },
new Component[]{extraPane, null}
}; };
double[] rowSize = {p, p, p, p}; double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1},{1,1},{1,1}}; int[][] rowCount = {{1, 1},{1, 1},{1,1},{1,1},{1,1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
advancePane.add(panel); advancePane.add(panel);
return advancePane; return advancePane;
} }
@Override
protected void refreshExtraAdvancedPane() {
refreshExtraAdvancedPane(CheckBoxGroup.class);
}
@Override @Override
protected void populateSubFieldEditorBean(CheckBoxGroup ob) { protected void populateSubFieldEditorBean(CheckBoxGroup ob) {
returnTypePane.populate(ob); returnTypePane.populate(ob);

10
designer-realize/src/main/java/com/fr/design/widget/ui/ComboBoxDefinePane.java

@ -3,15 +3,20 @@ package com.fr.design.widget.ui;
import javax.swing.*; import javax.swing.*;
import com.fr.data.Dictionary; import com.fr.data.Dictionary;
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.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor;
import com.fr.form.ui.ComboBox; import com.fr.form.ui.ComboBox;
import java.awt.*; import java.awt.*;
import java.util.Set;
public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox> { public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox> {
protected AccessibleDictionaryEditor dictPane; protected AccessibleDictionaryEditor dictPane;
@ -33,6 +38,11 @@ public class ComboBoxDefinePane extends CustomWritableRepeatEditorPane<ComboBox>
return jPanel; return jPanel;
} }
@Override
protected void refreshExtraAdvancedPane() {
refreshExtraAdvancedPane(ComboBox.class);
}
protected void populateSubCustomWritableRepeatEditorBean(ComboBox e) { protected void populateSubCustomWritableRepeatEditorBean(ComboBox e) {
this.dictPane.setValue(e.getDictionary()); this.dictPane.setValue(e.getDictionary());
} }

9
designer-realize/src/main/java/com/fr/design/widget/ui/ComboCheckBoxDefinePane.java

@ -1,8 +1,11 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.data.Dictionary; import com.fr.data.Dictionary;
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.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.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -15,6 +18,7 @@ import com.fr.form.ui.ComboCheckBox;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.Set;
public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane<ComboCheckBox> { public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane<ComboCheckBox> {
private ReturnTypePane returnTypePane; private ReturnTypePane returnTypePane;
@ -49,6 +53,11 @@ public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane<Comb
return advancePane; return advancePane;
} }
@Override
protected void refreshExtraAdvancedPane() {
refreshExtraAdvancedPane(ComboCheckBox.class);
}
@Override @Override
protected void populateSubCustomWritableRepeatEditorBean(ComboCheckBox e) { protected void populateSubCustomWritableRepeatEditorBean(ComboCheckBox e) {
this.dictPane.setValue(e.getDictionary()); this.dictPane.setValue(e.getDictionary());

17
designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java

@ -2,9 +2,12 @@ package com.fr.design.widget.ui;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.data.core.FormatField; import com.fr.data.core.FormatField;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
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.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -28,6 +31,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Set;
public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> { public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> {
private UIButtonGroup returnTypeComboBox; private UIButtonGroup returnTypeComboBox;
@ -53,10 +57,8 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
protected JPanel setSecondContentPane() { protected JPanel setSecondContentPane() {
returnTypeComboBox = new UIButtonGroup<>(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date") , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_String")}); returnTypeComboBox = new UIButtonGroup<>(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date") , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_String")});
JPanel formatHead = createFormatHead(); JPanel formatHead = createFormatHead();
startDv = new DateValuePane(); startDv = new DateValuePane();
endDv = new DateValuePane(); endDv = new DateValuePane();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
UILabel formatLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Format")); UILabel formatLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Format"));
@ -65,23 +67,28 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
startDateLabel.setVerticalAlignment(SwingConstants.TOP); startDateLabel.setVerticalAlignment(SwingConstants.TOP);
UILabel endDateLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_End_Date")); UILabel endDateLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_End_Date"));
endDateLabel.setVerticalAlignment(SwingConstants.TOP); endDateLabel.setVerticalAlignment(SwingConstants.TOP);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{formatLabel, formatHead}, new Component[]{formatLabel, formatHead},
new Component[]{startDateLabel, startDv}, new Component[]{startDateLabel, startDv},
new Component[]{endDateLabel, endDv}, new Component[]{endDateLabel, endDv},
new Component[]{waterMarkDictPane, null}, new Component[]{waterMarkDictPane, null},
new Component[]{extraPane, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type")), returnTypeComboBox } new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type")), returnTypeComboBox }
}; };
double[] rowSize = {p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1, 1},{1, 1}}; int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1, 1},{1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
return panel; return panel;
} }
@Override
protected void refreshExtraAdvancedPane() {
refreshExtraAdvancedPane(DateEditor.class);
}
private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){ private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){
JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane();

18
designer-realize/src/main/java/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java

@ -1,7 +1,10 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.DirectWriteEditor; import com.fr.form.ui.DirectWriteEditor;
@ -9,6 +12,7 @@ import com.fr.form.ui.DirectWriteEditor;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
//richer:需要提供能否直接编辑的控件设置面板——下拉框、复选框、时间、日期、下拉树 //richer:需要提供能否直接编辑的控件设置面板——下拉框、复选框、时间、日期、下拉树
public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> extends FieldEditorDefinePane<T> { public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> extends FieldEditorDefinePane<T> {
public UICheckBox directWriteCheckBox; public UICheckBox directWriteCheckBox;
@ -25,9 +29,17 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
directWriteCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Edit"), false); directWriteCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Edit"), false);
directWriteCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); directWriteCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
waterMarkDictPane = new WaterMarkDictPane(); waterMarkDictPane = new WaterMarkDictPane();
contentPane.add(waterMarkDictPane, BorderLayout.NORTH); initExtraPane();
Component[][] components = new Component[][]{
new Component[]{waterMarkDictPane, null},
new Component[]{extraPane, null},
};
double[] rowSize = {P, P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
contentPane.add(panel, BorderLayout.NORTH);
JPanel otherContentPane = this.setSecondContentPane(); JPanel otherContentPane = this.setSecondContentPane();
if (otherContentPane != null) { if (otherContentPane != null) {
contentPane.add(otherContentPane, BorderLayout.CENTER); contentPane.add(otherContentPane, BorderLayout.CENTER);
@ -35,8 +47,6 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
return contentPane; return contentPane;
} }
public JPanel setValidatePane(){ public JPanel setValidatePane(){
JPanel otherContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel otherContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel jPanel = GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 0); JPanel jPanel = GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 0);

71
designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java

@ -1,18 +1,24 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
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;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
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.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.FieldEditor; import com.fr.form.ui.FieldEditor;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -20,6 +26,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;
@ -27,6 +36,11 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
protected ErrorMsgTextFieldAdapter errorMsgTextField; protected ErrorMsgTextFieldAdapter errorMsgTextField;
protected JPanel validatePane; protected JPanel validatePane;
protected final List<BasicBeanPane<T>> extraPaneList = new ArrayList<>();
protected JPanel extraPane;
protected static double F = TableLayout.FILL;
protected static double P = TableLayout.PREFERRED;
public FieldEditorDefinePane() { public FieldEditorDefinePane() {
this.initComponents(); this.initComponents();
} }
@ -60,11 +74,41 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
} }
} }
protected void initExtraPane() {
initPluginListener();
refreshExtraAdvancedPane();
}
protected void refreshExtraAdvancedPane() {
// do nothing
}
protected void refreshExtraAdvancedPane(Class cls) {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<T>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<T> provider : providers) {
if (!provider.accept(cls)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<T> pane : extraPaneList) {
extraPane.add(pane);
}
}
}
@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());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.populateBean(ob);
}
populateSubFieldEditorBean(ob); populateSubFieldEditorBean(ob);
} }
@ -76,7 +120,9 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
e.setAllowBlank(this.allowBlankCheckBox.isSelected()); e.setAllowBlank(this.allowBlankCheckBox.isSelected());
e.setErrorMessage(this.errorMsgTextField.getText()); e.setErrorMessage(this.errorMsgTextField.getText());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.updateBean(e);
}
return e; return e;
} }
@ -131,5 +177,26 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
return null; return null;
} }
/**
* 插入配置项面板
*
* @param index 插入的位置
* @param pane 配置项面板
*/
protected void insertShortCut(int index, BasicBeanPane<T> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
protected void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG));
}
} }

28
designer-realize/src/main/java/com/fr/design/widget/ui/NumberEditorDefinePane.java

@ -1,11 +1,19 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.component.NumberEditorValidatePane; import com.fr.design.widget.component.NumberEditorValidatePane;
import com.fr.form.ui.NumberEditor; import com.fr.form.ui.NumberEditor;
import java.awt.Component;
import java.awt.BorderLayout; import java.util.Set;
public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> { public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> {
/** /**
@ -29,10 +37,24 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane();
waterMarkDictPane = new WaterMarkDictPane(); waterMarkDictPane = new WaterMarkDictPane();
content.add(waterMarkDictPane, BorderLayout.CENTER); initExtraPane();
Component[][] components = new Component[][]{
new Component[]{waterMarkDictPane, null},
new Component[]{extraPane, null}
};
double[] rowSize = {P, P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
content.add(panel);
return content; return content;
} }
@Override
protected void refreshExtraAdvancedPane() {
refreshExtraAdvancedPane(NumberEditor.class);
}
public JPanel setValidatePane() { public JPanel setValidatePane() {
numberEditorValidatePane = new NumberEditorValidatePane(); numberEditorValidatePane = new NumberEditorValidatePane();
return numberEditorValidatePane; return numberEditorValidatePane;

11
designer-realize/src/main/java/com/fr/design/widget/ui/PasswordDefinePane.java

@ -1,10 +1,16 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegFieldPane;
import com.fr.design.gui.frpane.RegPane; import com.fr.design.gui.frpane.RegPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.Password; import com.fr.form.ui.Password;
import com.fr.form.ui.TextEditor; import com.fr.form.ui.TextEditor;
import java.util.Set;
public class PasswordDefinePane extends TextFieldEditorDefinePane { public class PasswordDefinePane extends TextFieldEditorDefinePane {
private static final long serialVersionUID = 4737910705071750562L; private static final long serialVersionUID = 4737910705071750562L;
@ -16,4 +22,9 @@ public class PasswordDefinePane extends TextFieldEditorDefinePane {
protected RegFieldPane createRegPane() { protected RegFieldPane createRegPane() {
return new RegFieldPane(RegPane.PASSWORD_REG_TYPE); return new RegFieldPane(RegPane.PASSWORD_REG_TYPE);
} }
@Override
protected void refreshExtraAdvancedPane() {
refreshExtraAdvancedPane(Password.class);
}
} }

30
designer-realize/src/main/java/com/fr/design/widget/ui/RadioGroupDefinePane.java

@ -1,9 +1,21 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants;
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.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.RadioGroup; import com.fr.form.ui.RadioGroup;
import java.awt.Component;
import java.util.Set;
public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> { public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> {
private ButtonGroupDictPane buttonGroupDictPane; private ButtonGroupDictPane buttonGroupDictPane;
@ -21,7 +33,23 @@ public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> {
@Override @Override
protected JPanel setFirstContentPane() { protected JPanel setFirstContentPane() {
buttonGroupDictPane = new ButtonGroupDictPane(); buttonGroupDictPane = new ButtonGroupDictPane();
return buttonGroupDictPane; initExtraPane();
Component[][] components = new Component[][]{
new Component[]{buttonGroupDictPane, null},
new Component[]{extraPane, null}
};
double[] rowSize = {P, P, P, P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane();
content.add(panel);
return content;
}
@Override
protected void refreshExtraAdvancedPane() {
refreshExtraAdvancedPane(RadioGroup.class);
} }
@Override @Override

12
designer-realize/src/main/java/com/fr/design/widget/ui/TextAreaDefinePane.java

@ -1,11 +1,18 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegFieldPane;
import com.fr.design.gui.frpane.RegPane; import com.fr.design.gui.frpane.RegPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.TextArea; import com.fr.form.ui.TextArea;
import com.fr.form.ui.TextEditor; import com.fr.form.ui.TextEditor;
import java.util.Set;
public class TextAreaDefinePane extends TextFieldEditorDefinePane { public class TextAreaDefinePane extends TextFieldEditorDefinePane {
@Override @Override
@ -16,4 +23,9 @@ public class TextAreaDefinePane extends TextFieldEditorDefinePane {
protected RegFieldPane createRegPane() { protected RegFieldPane createRegPane() {
return new RegFieldPane(RegPane.TEXTAREA_REG_TYPE); return new RegFieldPane(RegPane.TEXTAREA_REG_TYPE);
} }
@Override
protected void refreshExtraAdvancedPane() {
refreshExtraAdvancedPane(TextArea.class);
}
} }

22
designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java

@ -1,18 +1,23 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.RegPaneProvider; import com.fr.design.fun.RegPaneProvider;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegFieldPane;
import com.fr.design.gui.frpane.RegPane; import com.fr.design.gui.frpane.RegPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.TextEditor; import com.fr.form.ui.TextEditor;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.Component;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.util.Set;
public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor> { public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor> {
protected RegFieldPane regPane; protected RegFieldPane regPane;
@ -51,8 +56,17 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
waterMarkDictPane.removeInputKeyListener(this); waterMarkDictPane.removeInputKeyListener(this);
} }
}); });
initExtraPane();
Component[][] components = new Component[][]{
new Component[]{waterMarkDictPane, null},
new Component[]{extraPane, null}
};
double[] rowSize = {P, P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane();
content.add(waterMarkDictPane, BorderLayout.CENTER); content.add(panel);
return content; return content;
} }
@ -60,6 +74,10 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
return regPane; return regPane;
} }
@Override
protected void refreshExtraAdvancedPane() {
refreshExtraAdvancedPane(TextEditor.class);
}
protected RegFieldPane createRegPane() { protected RegFieldPane createRegPane() {
RegPaneProvider provider = ExtraDesignClassManager.getInstance().getSingle(RegPaneProvider.XML_TAG); RegPaneProvider provider = ExtraDesignClassManager.getInstance().getSingle(RegPaneProvider.XML_TAG);

9
designer-realize/src/main/java/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java

@ -1,12 +1,16 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.*; import java.awt.*;
import java.util.Set;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
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.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.TreeRootPane; import com.fr.design.gui.itree.refreshabletree.TreeRootPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -60,6 +64,11 @@ public class TreeComboBoxEditorDefinePane extends CustomWritableRepeatEditorPane
return jPanel; return jPanel;
} }
@Override
protected void refreshExtraAdvancedPane() {
refreshExtraAdvancedPane(TreeComboBoxEditor.class);
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {

21
designer-realize/src/main/java/com/fr/design/widget/ui/TreeEditorDefinePane.java

@ -1,7 +1,10 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
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.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.itree.refreshabletree.TreeRootPane; import com.fr.design.gui.itree.refreshabletree.TreeRootPane;
@ -14,6 +17,7 @@ import com.fr.form.ui.TreeEditor;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.Set;
/* /*
@ -65,11 +69,19 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane<TreeEditor> {
createTree.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); createTree.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane();
initExtraPane();
double[] rowSize = {P, P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1},{1, 1}};
Component[][] components = new Component[][]{
new Component[]{createTree, null},
new Component[]{extraPane, null},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
contentPane.add(contenter,BorderLayout.NORTH); contentPane.add(contenter,BorderLayout.NORTH);
removeRepeatCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Remove_Repeat_Data"), false); removeRepeatCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Remove_Repeat_Data"), false);
removeRepeatCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); removeRepeatCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
contenter.add(createTree, BorderLayout.NORTH); contenter.add(panel, BorderLayout.NORTH);
contenter.add(removeRepeatCheckBox, BorderLayout.CENTER); contenter.add(removeRepeatCheckBox, BorderLayout.CENTER);
JPanel otherContentPane = this.setThirdContentPane(); JPanel otherContentPane = this.setThirdContentPane();
if (otherContentPane != null) { if (otherContentPane != null) {
@ -78,6 +90,11 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane<TreeEditor> {
return contentPane; return contentPane;
} }
@Override
protected void refreshExtraAdvancedPane() {
refreshExtraAdvancedPane(TreeEditor.class);
}
protected JPanel setThirdContentPane() { protected JPanel setThirdContentPane() {
JPanel content = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel content = FRGUIPaneFactory.createBorderLayout_L_Pane();
treeRootPane = new TreeRootPane(); treeRootPane = new TreeRootPane();

Loading…
Cancel
Save