From b75c879c5768dc3fa7c73c46522c4a85f24b737a Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" Date: Thu, 30 Jun 2022 20:11:06 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-72384=20&&=20REPORT-72443=201=E3=80=81?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A0=91=E4=BC=98=E5=8C=96V2=202=E3=80=81?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=80=A7=E8=83=BD=E4=BC=98=E5=8C=96=E5=86=85?= =?UTF-8?q?=E7=BD=AEV2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/ibutton/UIButtonGroup.java | 2 +- .../com/fr/design/gui/ibutton/UITabGroup.java | 2 +- .../TreeAttrChangeListener.java | 7 ++ .../itree/refreshabletree/TreeRootPane.java | 50 +++++++-- ...ckBoxDictPane.java => ReturnTypePane.java} | 91 +++++++-------- .../ui/designer/CheckBoxGroupDefinePane.java | 20 ++-- .../ui/designer/ComboCheckBoxDefinePane.java | 20 ++-- .../ui/designer/TreeEditorDefinePane.java | 68 +++--------- .../widget/ui/CheckBoxGroupDefinePane.java | 26 ++--- .../widget/ui/ComboCheckBoxDefinePane.java | 20 ++-- .../ui/TreeComboBoxEditorDefinePane.java | 104 ++++++++++-------- .../widget/ui/TreeEditorDefinePane.java | 17 ++- 12 files changed, 223 insertions(+), 204 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeAttrChangeListener.java rename designer-base/src/main/java/com/fr/design/widget/component/{CheckBoxDictPane.java => ReturnTypePane.java} (50%) diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java index a9b97d269..bd2e8b2af 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java @@ -296,7 +296,7 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver, UIOb return selectedIndex; } - protected void setSelectedIndex(int newSelectedIndex, boolean fireChanged) { + public void setSelectedIndex(int newSelectedIndex, boolean fireChanged) { if (selectedIndex != newSelectedIndex) { selectedIndex = newSelectedIndex; for (int i = 0; i < labelButtonList.size(); i++) { diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabGroup.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabGroup.java index d77259104..12ca00524 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabGroup.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabGroup.java @@ -63,7 +63,7 @@ public class UITabGroup extends UIButtonGroup { } @Override - protected void setSelectedIndex(int newSelectedIndex, boolean fireChanged) { + public void setSelectedIndex(int newSelectedIndex, boolean fireChanged) { super.setSelectedIndex(newSelectedIndex, false); tabChanged(newSelectedIndex); } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeAttrChangeListener.java b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeAttrChangeListener.java new file mode 100644 index 000000000..c31cfe529 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeAttrChangeListener.java @@ -0,0 +1,7 @@ +package com.fr.design.gui.itree.refreshabletree; + +import com.fr.data.impl.TreeAttr; + +public interface TreeAttrChangeListener { + void doChange(TreeAttr treeAttr); +} diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java index a848b06d6..691749fac 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java @@ -10,21 +10,24 @@ import javax.swing.BoxLayout; import javax.swing.JPanel; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; +import java.util.ArrayList; +import java.util.List; public class TreeRootPane extends BasicPane { + private final List listeners = new ArrayList<>(); + // 是否支持多选(checkBoxTree) //private JCheckBox multipleSelection; - private UICheckBox checkTypeCheckBox; + private final UICheckBox checkTypeCheckBox; // richer:加载的方式,支持异步加载和完全加载 - private UICheckBox loadTypeCheckBox; + private final UICheckBox loadTypeCheckBox; - private UICheckBox layerTypeCheckBox; + private final UICheckBox layerTypeCheckBox; - private UICheckBox returnFullPathCheckBox; + private final UICheckBox returnFullPathCheckBox; public TreeRootPane() { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); @@ -41,13 +44,6 @@ public class TreeRootPane extends BasicPane { checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); loadTypeCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Load_By_Async")); loadTypeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - loadTypeCheckBox.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - UICheckBox checkBox = (UICheckBox) e.getSource(); - doLoadTypeChange(checkBox.isSelected()); - } - }); loadTypePane.add(loadTypeCheckBox); this.add(loadTypePane); @@ -63,11 +59,27 @@ public class TreeRootPane extends BasicPane { checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); returnFullPathPane.add(returnFullPathCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Return_Full_Path"))); returnFullPathCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + addCheckBoxListener(); this.add(returnFullPathPane); } + private void addCheckBoxListener() { + loadTypeCheckBox.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + UICheckBox checkBox = (UICheckBox) e.getSource(); + doLoadTypeChange(checkBox.isSelected()); + } + }); + + checkTypeCheckBox.addActionListener(event->fireTreeAttrChangeListener()); + loadTypeCheckBox.addActionListener(event->fireTreeAttrChangeListener()); + layerTypeCheckBox.addActionListener(event->fireTreeAttrChangeListener()); + returnFullPathCheckBox.addActionListener(event->fireTreeAttrChangeListener()); + } + private void doLoadTypeChange(Boolean selected) { //给埋点插件提供一个方法,埋埋点用 } @@ -82,6 +94,7 @@ public class TreeRootPane extends BasicPane { loadTypeCheckBox.setSelected(treeAttr.isAjax()); layerTypeCheckBox.setSelected(treeAttr.isSelectLeafOnly()); returnFullPathCheckBox.setSelected(treeAttr.isReturnFullPath()); + fireTreeAttrChangeListener(); } public TreeAttr update() { @@ -93,4 +106,17 @@ public class TreeRootPane extends BasicPane { return treeAttr; } + + public void addTreeAttrChangeListener(TreeAttrChangeListener listener) { + listeners.add(listener); + } + + public void fireTreeAttrChangeListener() { + TreeAttr treeAttr = new TreeAttr(); + treeAttr.setMultipleSelection(checkTypeCheckBox.isSelected()); + treeAttr.setAjax(loadTypeCheckBox.isSelected()); + treeAttr.setSelectLeafOnly(layerTypeCheckBox.isSelected()); + treeAttr.setReturnFullPath(returnFullPathCheckBox.isSelected()); + listeners.forEach(listener -> listener.doChange(treeAttr)); + } } diff --git a/designer-base/src/main/java/com/fr/design/widget/component/CheckBoxDictPane.java b/designer-base/src/main/java/com/fr/design/widget/component/ReturnTypePane.java similarity index 50% rename from designer-base/src/main/java/com/fr/design/widget/component/CheckBoxDictPane.java rename to designer-base/src/main/java/com/fr/design/widget/component/ReturnTypePane.java index 9a76352f9..4f3b93a53 100644 --- a/designer-base/src/main/java/com/fr/design/widget/component/CheckBoxDictPane.java +++ b/designer-base/src/main/java/com/fr/design/widget/component/ReturnTypePane.java @@ -1,32 +1,29 @@ package com.fr.design.widget.component; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.ibutton.UIButtonGroup; -import com.fr.design.gui.ilable.UILabel; - -import javax.swing.*; - import com.fr.design.gui.icombobox.DictionaryComboBox; import com.fr.design.gui.icombobox.DictionaryConstants; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; -import com.fr.form.ui.CheckBoxGroup; -import com.fr.form.ui.ComboCheckBox; +import com.fr.form.ui.ReturnTypeProvider; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + +public class ReturnTypePane extends JPanel { -public class CheckBoxDictPane extends JPanel { - - private DictionaryComboBox delimiterComboBox; - private UIButtonGroup returnTypeComboBox; - private DictionaryComboBox startComboBox; - private DictionaryComboBox endComboBox; - private JPanel returnStringPane; - - public CheckBoxDictPane() { + private final DictionaryComboBox delimiterComboBox; + private final UIButtonGroup returnTypeComboBox; + private final DictionaryComboBox startComboBox; + private final DictionaryComboBox endComboBox; + private final JPanel returnStringPane; + + public ReturnTypePane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); delimiterComboBox = new DictionaryComboBox(DictionaryConstants.delimiters, DictionaryConstants.delimiterDisplays); delimiterComboBox.setEditable(true); @@ -36,18 +33,13 @@ public class CheckBoxDictPane extends JPanel { endComboBox.setEditable(true); Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Delimiter")), delimiterComboBox}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Combo_CheckBox_Start_Symbol")),startComboBox}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Combo_CheckBox_End_Symbol")),endComboBox} + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Combo_CheckBox_Start_Symbol")), startComboBox}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Combo_CheckBox_End_Symbol")), endComboBox} }; returnStringPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1); returnTypeComboBox = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Array"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_String")}); - returnTypeComboBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkVisible(returnTypeComboBox.getSelectedIndex()); - } - }); + returnTypeComboBox.addActionListener(e -> checkVisible(returnTypeComboBox.getSelectedIndex())); JPanel headPane = TableLayoutHelper.createGapTableLayoutPane( new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type")), returnTypeComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -57,34 +49,33 @@ public class CheckBoxDictPane extends JPanel { this.add(jPanel); } - public void checkVisible(int selectIndex){ - returnStringPane.setVisible(selectIndex == 1); + public void setReturnType(ReturnType returnType) { + int selectIndex = returnType == ReturnType.ARRAY ? 0 : 1; + returnTypeComboBox.setSelectedIndex(selectIndex,true); + checkVisible(selectIndex); } - public void populate(ComboCheckBox comboCheckBox) { - this.delimiterComboBox.setSelectedItem(comboCheckBox.getDelimiter()); - this.returnTypeComboBox.setSelectedIndex(comboCheckBox.isReturnString() ? 1 : 0); - this.startComboBox.setSelectedItem(comboCheckBox.getStartSymbol()); - this.endComboBox.setSelectedItem(comboCheckBox.getEndSymbol()); - checkVisible(this.returnTypeComboBox.getSelectedIndex()); + public void checkVisible(int selectIndex) { + returnStringPane.setVisible(selectIndex == 1); } - public void update(ComboCheckBox comboCheckBox) { - comboCheckBox.setDelimiter((String)this.delimiterComboBox.getSelectedItem()); - comboCheckBox.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0); - comboCheckBox.setStartSymbol((String)this.startComboBox.getSelectedItem()); - comboCheckBox.setEndSymbol((String)this.endComboBox.getSelectedItem()); + + public void update(ReturnTypeProvider returnTypeProvider) { + returnTypeProvider.setDelimiter((String) this.delimiterComboBox.getSelectedItem()); + returnTypeProvider.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0); + returnTypeProvider.setStartSymbol((String) this.startComboBox.getSelectedItem()); + returnTypeProvider.setEndSymbol((String) this.endComboBox.getSelectedItem()); } - public void populate(CheckBoxGroup checkBoxGroup) { - this.delimiterComboBox.setSelectedItem(checkBoxGroup.getDelimiter()); - this.returnTypeComboBox.setSelectedIndex(checkBoxGroup.isReturnString() ? 1 : 0); - this.startComboBox.setSelectedItem(checkBoxGroup.getStartSymbol()); - this.endComboBox.setSelectedItem(checkBoxGroup.getEndSymbol()); + + public void populate(ReturnTypeProvider returnTypeProvider) { + this.delimiterComboBox.setSelectedItem(returnTypeProvider.getDelimiter()); + this.returnTypeComboBox.setSelectedIndex(returnTypeProvider.isReturnString() ? 1 : 0); + this.startComboBox.setSelectedItem(returnTypeProvider.getStartSymbol()); + this.endComboBox.setSelectedItem(returnTypeProvider.getEndSymbol()); checkVisible(this.returnTypeComboBox.getSelectedIndex()); } - public void update(CheckBoxGroup checkBoxGroup) { - checkBoxGroup.setDelimiter((String)this.delimiterComboBox.getSelectedItem()); - checkBoxGroup.setReturnString(this.returnTypeComboBox.getSelectedIndex() != 0); - checkBoxGroup.setStartSymbol((String)this.startComboBox.getSelectedItem()); - checkBoxGroup.setEndSymbol((String)this.endComboBox.getSelectedItem()); + + public enum ReturnType { + STRING, + ARRAY } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java index 74819ae45..579001b55 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java @@ -7,7 +7,7 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.present.dict.DictionaryPane; -import com.fr.design.widget.component.CheckBoxDictPane; +import com.fr.design.widget.component.ReturnTypePane; import com.fr.design.widget.ui.designer.btn.ButtonGroupDefinePane; import com.fr.form.ui.CheckBoxGroup; @@ -17,7 +17,7 @@ import java.awt.*; public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane { private DictionaryPane dictPane; - private CheckBoxDictPane checkBoxDictPane; + private ReturnTypePane returnTypePane; private UICheckBox checkbox; public CheckBoxGroupDefinePane(XCreator xCreator) { @@ -40,12 +40,12 @@ public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane { - private UICheckBox supportTagCheckBox; - private CheckBoxDictPane checkBoxDictPane; - private UITextField waterMarkDictPane; - private UICheckBox removeRepeatCheckBox; + private UICheckBox supportTagCheckBox; + private ReturnTypePane returnTypePane; + private UITextField waterMarkDictPane; + private UICheckBox removeRepeatCheckBox; public ComboCheckBoxDefinePane(XCreator xCreator) { super(xCreator); @@ -40,13 +40,13 @@ public class ComboCheckBoxDefinePane extends DictEditorDefinePane public JPanel createOtherPane(){ supportTagCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Support_Tag"), true); supportTagCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - checkBoxDictPane = new CheckBoxDictPane(); + returnTypePane = new ReturnTypePane(); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ new Component[]{supportTagCheckBox, null }, - new Component[]{checkBoxDictPane, null}, + new Component[]{returnTypePane, null}, }; double[] rowSize = {p, p}; double[] columnSize = {p, f}; @@ -56,7 +56,7 @@ public class ComboCheckBoxDefinePane extends DictEditorDefinePane } protected void populateSubDictionaryEditorBean(ComboCheckBox ob){ - this.checkBoxDictPane.populate(ob); + this.returnTypePane.populate(ob); waterMarkDictPane.setText(ob.getWaterMark()); formWidgetValuePane.populate(ob); this.supportTagCheckBox.setSelected(ob.isSupportTag()); @@ -65,7 +65,7 @@ public class ComboCheckBoxDefinePane extends DictEditorDefinePane protected ComboCheckBox updateSubDictionaryEditorBean(){ ComboCheckBox combo = (ComboCheckBox) creator.toData(); - checkBoxDictPane.update(combo); + returnTypePane.update(combo); formWidgetValuePane.update(combo); combo.setWaterMark(waterMarkDictPane.getText()); combo.setSupportTag(this.supportTagCheckBox.isSelected()); @@ -77,7 +77,7 @@ public class ComboCheckBoxDefinePane extends DictEditorDefinePane public DataCreatorUI dataUI() { return null; } - + @Override public String title4PopupWindow() { return "ComboCheckBox"; diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java index 9746c605d..13049e4c9 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java @@ -1,78 +1,50 @@ package com.fr.design.widget.ui.designer; import com.fr.design.data.DataCreatorUI; -import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; -import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itree.refreshabletree.TreeRootPane; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.widget.accessibles.AccessibleTreeModelEditor; +import com.fr.design.widget.component.ReturnTypePane; import com.fr.form.ui.TreeEditor; import javax.swing.BorderFactory; import javax.swing.JPanel; +import java.awt.BorderLayout; import java.awt.Component; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; /* * richer:tree editor */ public class TreeEditorDefinePane extends CustomWritableRepeatEditorPane { + private ReturnTypePane returnTypePane; protected TreeRootPane treeRootPane; - private UICheckBox mutiSelect; - private UICheckBox loadAsync; - private UICheckBox returnLeaf; - private UICheckBox returnPath; private AccessibleTreeModelEditor accessibleTreeModelEditor; public TreeEditorDefinePane(XCreator xCreator) { super(xCreator); - treeRootPane = new TreeRootPane(); } public JPanel createOtherPane() { - mutiSelect = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Mutiple_Selection_Or_Not")); - mutiSelect.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - - loadAsync = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Load_By_Async")); - loadAsync.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - loadAsync.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - UICheckBox checkBox = (UICheckBox) e.getSource(); - doLoadTypeChange(checkBox.isSelected()); + treeRootPane = new TreeRootPane(); + returnTypePane = new ReturnTypePane(); + JPanel panel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + panel.add(treeRootPane, BorderLayout.NORTH); + returnTypePane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + panel.add(returnTypePane, BorderLayout.CENTER); + treeRootPane.addTreeAttrChangeListener(treeAttr -> { + boolean showReturnTypePane = treeAttr.isMultipleSelection() && !treeAttr.isReturnFullPath(); + returnTypePane.setVisible(showReturnTypePane); + if (!showReturnTypePane) { + returnTypePane.setReturnType(ReturnTypePane.ReturnType.ARRAY); } }); - returnLeaf = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Return_Leaf")); - returnLeaf.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - - returnPath = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Return_Path")); - returnPath.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - Component[][] components = new Component[][]{ - new Component[]{mutiSelect}, - new Component[]{loadAsync}, - new Component[]{returnLeaf}, - new Component[]{returnPath} - }; - double[] rowSize = {p, p, p, p}; - double[] columnSize = {p}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); return panel; } - private void doLoadTypeChange(Boolean selected) { - //给埋点插件提供一个方法,埋埋点用 - } - @Override public String title4PopupWindow() { return "tree"; @@ -89,10 +61,7 @@ public class TreeEditorDefinePane extends CustomWritableRepeatEditorPane { - CheckBoxDictPane checkBoxDictPane; + private ReturnTypePane returnTypePane; private UICheckBox checkbox; private ButtonGroupDictPane buttonGroupDictPane; @@ -28,25 +28,25 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane { - private CheckBoxDictPane checkBoxDictPane; + private ReturnTypePane returnTypePane; private AccessibleDictionaryEditor dictPane; - private UICheckBox supportTagCheckBox; + private UICheckBox supportTagCheckBox; public ComboCheckBoxDefinePane() { super.initComponents(); @@ -28,7 +28,7 @@ public class ComboCheckBoxDefinePane extends CustomWritableRepeatEditorPane { - protected AccessibleTreeModelEditor treeSettingPane; - protected TreeRootPane treeRootPane; + protected AccessibleTreeModelEditor treeSettingPane; - public TreeComboBoxEditorDefinePane() { - this.initComponents(); - } + private ReturnTypePane returnTypePane; + protected TreeRootPane treeRootPane; + public TreeComboBoxEditorDefinePane() { + this.initComponents(); + } - @Override - protected JPanel setForthContentPane() { - JPanel content = FRGUIPaneFactory.createBorderLayout_L_Pane(); - content.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - treeRootPane = new TreeRootPane(); - content.add(treeRootPane, BorderLayout.NORTH); - return content; - } - @Override - protected JPanel setFirstContentPane() { - treeSettingPane = new AccessibleTreeModelEditor(); - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - JPanel north = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Create_Tree")), treeSettingPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1); - north.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - JPanel center = super.setFirstContentPane(); - jPanel.add(north, BorderLayout.NORTH); - jPanel.add(center, BorderLayout.CENTER); - return jPanel; - } + @Override + protected JPanel setForthContentPane() { + JPanel content = FRGUIPaneFactory.createBorderLayout_L_Pane(); + treeRootPane = new TreeRootPane(); + returnTypePane = new ReturnTypePane(); + content.add(treeRootPane, BorderLayout.NORTH); + returnTypePane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + content.add(returnTypePane, BorderLayout.CENTER); + treeRootPane.addTreeAttrChangeListener(treeAttr -> { + boolean showReturnTypePane = treeAttr.isMultipleSelection() && !treeAttr.isReturnFullPath(); + returnTypePane.setVisible(showReturnTypePane); + if (!showReturnTypePane) { + returnTypePane.setReturnType(ReturnTypePane.ReturnType.ARRAY); + } + }); + content.add(treeRootPane, BorderLayout.NORTH); + return content; + } + @Override + protected JPanel setFirstContentPane() { + treeSettingPane = new AccessibleTreeModelEditor(); + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel north = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Create_Tree")), treeSettingPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1); + north.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + JPanel center = super.setFirstContentPane(); + jPanel.add(north, BorderLayout.NORTH); + jPanel.add(center, BorderLayout.CENTER); + return jPanel; + } - @Override - protected String title4PopupWindow() { - return "treecombobox"; - } + @Override + protected String title4PopupWindow() { + return "treecombobox"; + } - @Override - protected void populateSubCustomWritableRepeatEditorBean(TreeEditor e) { - treeSettingPane.setValue(e.getBuildModelConfig()); - treeRootPane.populate(e.getTreeAttr()); - } + @Override + protected void populateSubCustomWritableRepeatEditorBean(TreeEditor e) { + treeSettingPane.setValue(e.getBuildModelConfig()); + treeRootPane.populate(e.getTreeAttr()); + returnTypePane.populate(e); + } - @Override - protected TreeComboBoxEditor updateSubCustomWritableRepeatEditorBean() { - TreeComboBoxEditor editor = new TreeComboBoxEditor(); - editor.setBuildModelConfig(treeSettingPane.getValue()); - editor.setTreeAttr(treeRootPane.update()); - return editor; - } + @Override + protected TreeComboBoxEditor updateSubCustomWritableRepeatEditorBean() { + TreeComboBoxEditor editor = new TreeComboBoxEditor(); + editor.setBuildModelConfig(treeSettingPane.getValue()); + editor.setTreeAttr(treeRootPane.update()); + returnTypePane.update(editor); + return editor; + } - @Override - public DataCreatorUI dataUI() { - return null; - } + @Override + public DataCreatorUI dataUI() { + return null; + } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/TreeEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/TreeEditorDefinePane.java index 89e54cdc8..086ef8883 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/TreeEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/TreeEditorDefinePane.java @@ -8,6 +8,7 @@ import com.fr.design.gui.itree.refreshabletree.TreeRootPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.accessibles.AccessibleTreeModelEditor; +import com.fr.design.widget.component.ReturnTypePane; import com.fr.form.ui.TreeEditor; @@ -19,6 +20,8 @@ import java.awt.*; * richer:tree editor */ public class TreeEditorDefinePane extends FieldEditorDefinePane { + private ReturnTypePane returnTypePane; + protected TreeRootPane treeRootPane; private AccessibleTreeModelEditor accessibleTreeModelEditor; @@ -32,6 +35,7 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane { protected void populateSubFieldEditorBean(TreeEditor e) { this.accessibleTreeModelEditor.setValue(e.getBuildModelConfig()); treeRootPane.populate(e.getTreeAttr()); + returnTypePane.populate(e); if (this.removeRepeatCheckBox != null) { this.removeRepeatCheckBox.setSelected(e.isRemoveRepeat()); } @@ -42,6 +46,7 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane { TreeEditor editor = new TreeEditor(); editor.setBuildModelConfig(accessibleTreeModelEditor.getValue()); editor.setTreeAttr(treeRootPane.update()); + returnTypePane.update(editor); if (this.removeRepeatCheckBox != null) { editor.setRemoveRepeat(this.removeRepeatCheckBox.isSelected()); } @@ -75,9 +80,19 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane { protected JPanel setThirdContentPane() { JPanel content = FRGUIPaneFactory.createBorderLayout_L_Pane(); - content.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); treeRootPane = new TreeRootPane(); + returnTypePane = new ReturnTypePane(); content.add(treeRootPane, BorderLayout.NORTH); + returnTypePane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + content.add(returnTypePane, BorderLayout.CENTER); + treeRootPane.addTreeAttrChangeListener(treeAttr -> { + boolean showReturnTypePane = treeAttr.isMultipleSelection() && !treeAttr.isReturnFullPath(); + returnTypePane.setVisible(showReturnTypePane); + if (!showReturnTypePane) { + returnTypePane.setReturnType(ReturnTypePane.ReturnType.ARRAY); + } + }); + //content.add(treeRootPane, BorderLayout.NORTH); return content; }