Browse Source

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

feature/10.0
方磊 3 years ago
parent
commit
9b8f884067
  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.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class FormMultiWidgetCardPane extends FormWidgetCardPane {
private MultiSelectionArrangement arrangement;
@ -129,20 +131,8 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
TableLayout.PREFERRED,
TableLayout.FILL
};
UITextField horizontalSpacingNumberField = new UIPositiveAndNegativeIntNumberField();
horizontalSpacingNumberField.addFocusListener(new FocusAdapter() {
@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);
}
});
UITextField horizontalSpacingNumberField = createIntNumberField(false);
UITextField verticalSpacingNumberField = createIntNumberField(true);
Component[][] components = new Component[][] {
new Component[] {
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);
}
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) {
if (StableUtils.isNumber(text)) {
if (isVertical) {

Loading…
Cancel
Save