Browse Source

Pull request #12474: REPORT-96966 fix: 显示字段下拉框

Merge in DESIGN/design from ~SKY.LUO/design:feature/x to feature/x

* commit 'f8b241baa117c39c993433891a0ccc5ce6246f79':
  REPORT-96966 fix: 显示字段下拉框
feature/x
Sky.Luo-罗鹏乾 1 year ago
parent
commit
a93b6b72c5
  1. 13
      designer-base/src/main/java/com/fr/design/mainframe/widget/editors/DataBindingEditor.java
  2. 20
      designer-base/src/main/java/com/fr/design/mainframe/widget/editors/WidgetValueEditor.java
  3. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java

13
designer-base/src/main/java/com/fr/design/mainframe/widget/editors/DataBindingEditor.java

@ -29,8 +29,8 @@ public class DataBindingEditor extends Editor<DataBinding> {
private final static int HORI_GAP = 1; private final static int HORI_GAP = 1;
private final static int VER_GAP = 7; private final static int VER_GAP = 7;
private TableDataComboBox tableDataComboBox; protected TableDataComboBox tableDataComboBox;
private LazyComboBox columnNameComboBox; protected LazyComboBox columnNameComboBox;
private ItemListener tableDataComboBoxListener = new ItemListener() { private ItemListener tableDataComboBoxListener = new ItemListener() {
public void itemStateChanged(ItemEvent evt) { public void itemStateChanged(ItemEvent evt) {
boolean isInit = columnNameComboBox.getSelectedIndex() == -1; boolean isInit = columnNameComboBox.getSelectedIndex() == -1;
@ -87,9 +87,16 @@ public class DataBindingEditor extends Editor<DataBinding> {
} }
}); });
columnNameComboBox.setEditable(true); columnNameComboBox.setEditable(true);
addComboBoxesAndSetPosition();
columnNameComboBox.addItemListener(columnNameComboboxListener);
}
/**
* 根据需求不同调整下拉框的位置
*/
protected void addComboBoxesAndSetPosition() {
this.add(tableDataComboBox, BorderLayout.NORTH); this.add(tableDataComboBox, BorderLayout.NORTH);
this.add(columnNameComboBox, BorderLayout.CENTER); this.add(columnNameComboBox, BorderLayout.CENTER);
columnNameComboBox.addItemListener(columnNameComboboxListener);
} }
protected TableDataSource getTableDataSource() { protected TableDataSource getTableDataSource() {

20
designer-base/src/main/java/com/fr/design/mainframe/widget/editors/WidgetValueEditor.java

@ -5,6 +5,7 @@
package com.fr.design.mainframe.widget.editors; package com.fr.design.mainframe.widget.editors;
import java.awt.Component; import java.awt.Component;
import java.awt.BorderLayout;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
@ -30,6 +31,7 @@ public class WidgetValueEditor extends AbstractPropertyEditor {
/** /**
* 根据类型创建 * 根据类型创建
* 服务器 - 控件管理
* @param type 类型 * @param type 类型
* @param onlyServer 是否是服务器 * @param onlyServer 是否是服务器
* @return 编辑器 * @return 编辑器
@ -41,7 +43,7 @@ public class WidgetValueEditor extends AbstractPropertyEditor {
case DataControl.TYPE_FORMULA: case DataControl.TYPE_FORMULA:
return new FormulaEditor(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Parameter_Formula")); return new FormulaEditor(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Parameter_Formula"));
case DataControl.TYPE_DATABINDING: case DataControl.TYPE_DATABINDING:
return onlyServer ? new ServerDataBindingEditor() : new DataBindingEditor(); return onlyServer ? new WidgetValueServerDataBindingEditor() : new WidgetValueDataBindingEditor();
case DataControl.TYPE_STRING: case DataControl.TYPE_STRING:
return new TextEditor(); return new TextEditor();
case DataControl.TYPE_BOOLEAN: case DataControl.TYPE_BOOLEAN:
@ -70,6 +72,22 @@ public class WidgetValueEditor extends AbstractPropertyEditor {
} }
return editor; return editor;
} }
private static class WidgetValueDataBindingEditor extends DataBindingEditor {
@Override
protected void addComboBoxesAndSetPosition() {
this.add(tableDataComboBox, BorderLayout.CENTER);
this.add(columnNameComboBox, BorderLayout.EAST);
}
}
private static class WidgetValueServerDataBindingEditor extends ServerDataBindingEditor {
@Override
protected void addComboBoxesAndSetPosition() {
this.add(tableDataComboBox, BorderLayout.CENTER);
this.add(columnNameComboBox, BorderLayout.EAST);
}
}
public WidgetValueEditor(Object o) { public WidgetValueEditor(Object o) {
this(o, false); this(o, false);

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java

@ -63,7 +63,7 @@ public class FormWidgetValuePane extends JPanel {
/** /**
* 根据类型创建 * 根据类型创建
* * 设计器右侧控件设置 - 属性
* @param type 类型 * @param type 类型
* @param onlyServer 是否是服务器 * @param onlyServer 是否是服务器
* @return 编辑器 * @return 编辑器

Loading…
Cancel
Save