Browse Source

Pull request #5366: REPORT-56929 【FRM布局推荐】组件复用-手动间距输入框目前不支持回车触发生效

Merge in DESIGN/design from ~FANGLEI/design10.0:feature/10.0 to feature/10.0

* commit '9b8f88406762c4eb9b677cf50cd9e427d1b84707':
  REPORT-56929 【FRM布局推荐】组件复用-手动间距输入框目前不支持回车触发生效
feature/10.0
fanglei 3 years ago
parent
commit
8f58c13c3b
  1. 37
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java

37
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java

@ -26,6 +26,8 @@ import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class FormMultiWidgetCardPane extends FormWidgetCardPane { public class FormMultiWidgetCardPane extends FormWidgetCardPane {
private MultiSelectionArrangement arrangement; private MultiSelectionArrangement arrangement;
@ -129,20 +131,8 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
TableLayout.PREFERRED, TableLayout.PREFERRED,
TableLayout.FILL TableLayout.FILL
}; };
UITextField horizontalSpacingNumberField = new UIPositiveAndNegativeIntNumberField(); UITextField horizontalSpacingNumberField = createIntNumberField(false);
horizontalSpacingNumberField.addFocusListener(new FocusAdapter() { UITextField verticalSpacingNumberField = createIntNumberField(true);
@Override
public void focusLost(FocusEvent e) {
distributionDoChange(horizontalSpacingNumberField.getText(), false);
}
});
UITextField verticalSpacingNumberField = new UIPositiveAndNegativeIntNumberField();
verticalSpacingNumberField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
distributionDoChange(verticalSpacingNumberField.getText(), true);
}
});
Component[][] components = new Component[][] { Component[][] components = new Component[][] {
new Component[] { new Component[] {
new UILabel(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_horizontal_spacing.png")), new UILabel(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_horizontal_spacing.png")),
@ -157,6 +147,25 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
return createTitleLayout(Toolkit.i18nText("Fine-Design_Multi_Selection_Manual_Spacing"), centerPane); return createTitleLayout(Toolkit.i18nText("Fine-Design_Multi_Selection_Manual_Spacing"), centerPane);
} }
private UIPositiveAndNegativeIntNumberField createIntNumberField(boolean isVertical) {
final UIPositiveAndNegativeIntNumberField intNumberField = new UIPositiveAndNegativeIntNumberField();
intNumberField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
distributionDoChange(intNumberField.getText(), isVertical);
}
});
intNumberField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
distributionDoChange(intNumberField.getText(), isVertical);
}
}
});
return intNumberField;
}
private void distributionDoChange(String text, boolean isVertical) { private void distributionDoChange(String text, boolean isVertical) {
if (StableUtils.isNumber(text)) { if (StableUtils.isNumber(text)) {
if (isVertical) { if (isVertical) {

Loading…
Cancel
Save