Browse Source

Pull request #14979: REPORT-136473 & EPORT-136480 fix: 懒加载导致控件输入框事件异常

Merge in DESIGN/design from ~LEVY.XIE/design:fbp/release to fbp/release

* commit 'f2865d95ff13ee0dfdd84984a533a93ee52447ff':
  REPORT-136473 & EPORT-136480 fix: 懒加载导致控件输入框事件异常
fbp/merge
Levy.Xie-解安森 3 months ago
parent
commit
c468de9839
  1. 25
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/FormWidgetValuePane.java

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

@ -5,7 +5,6 @@ import com.fr.design.editor.editor.DateEditor;
import com.fr.design.editor.editor.DoubleEditor; import com.fr.design.editor.editor.DoubleEditor;
import com.fr.design.editor.editor.Editor; import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor; import com.fr.design.editor.editor.FormulaEditor;
import com.fr.design.gui.core.ReactiveCardPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.widget.editors.DataBindingEditor; import com.fr.design.mainframe.widget.editors.DataBindingEditor;
@ -19,6 +18,9 @@ import com.fr.form.ui.concept.data.ValueInitializer;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.column;
@ -34,20 +36,31 @@ import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP;
public class FormWidgetValuePane extends JPanel { public class FormWidgetValuePane extends JPanel {
private UIButtonGroup widgetValueHead; private UIButtonGroup widgetValueHead;
private Editor[] editor; private Editor[] editor;
private ReactiveCardPane customPane; private JPanel customPane;
private CardLayout cardLayout;
public FormWidgetValuePane(Object o, boolean onlyServer) { public FormWidgetValuePane(Object o, boolean onlyServer) {
DataControl widget = (DataControl) o; DataControl widget = (DataControl) o;
editor = createWidgetValueEditor(widget, onlyServer); editor = createWidgetValueEditor(widget, onlyServer);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
customPane = ReactiveCardPane.create(); cardLayout = new CardLayout();
customPane = new JPanel(cardLayout) {
@Override
public Dimension getPreferredSize() {
for (Component comp : getComponents()) {
if (comp.isVisible()) {
return comp.getPreferredSize();
}
}
return new Dimension(0, 0);
}
};
final String[] tabTitles = new String[editor.length]; final String[] tabTitles = new String[editor.length];
for (int i = 0; i < editor.length; i++) { for (int i = 0; i < editor.length; i++) {
Editor currentEditor = editor[i]; Editor currentEditor = editor[i];
customPane.addSupplier(editor[i].getName(), () -> currentEditor); customPane.add(currentEditor, editor[i].getName());
tabTitles[i] = editor[i].getName(); tabTitles[i] = editor[i].getName();
} }
customPane.select(editor[0].getName()).populate();
widgetValueHead = new UIButtonGroup(tabTitles); widgetValueHead = new UIButtonGroup(tabTitles);
UILabel widgetValueLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value")); UILabel widgetValueLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value"));
this.add(column(VERTICAL_GAP, this.add(column(VERTICAL_GAP,
@ -69,7 +82,7 @@ public class FormWidgetValuePane extends JPanel {
index = 0; index = 0;
widgetValueHead.setSelectedIndex(index); widgetValueHead.setSelectedIndex(index);
} }
customPane.select(editor[index].getName()).populate(); cardLayout.show(customPane, editor[index].getName());
} }

Loading…
Cancel
Save