Browse Source

REPORT-4604 设计器交互修改

单元格属性-其他-插入行策略 数字控件修改
master
MoMeak 7 years ago
parent
commit
d9a13704c3
  1. 2
      designer_base/src/com/fr/design/editor/ValueEditorPaneFactory.java
  2. 66
      designer_base/src/com/fr/design/editor/editor/SpinnerIntegerEditor.java

2
designer_base/src/com/fr/design/editor/ValueEditorPaneFactory.java

@ -202,7 +202,7 @@ public class ValueEditorPaneFactory {
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula"));
return new Editor[]{
new TextEditor(),
new IntegerEditor(),
new SpinnerIntegerEditor(),
new DoubleEditor(),
new DateEditor(true, Inter.getLocText("Date")),
new BooleanEditor(),

66
designer_base/src/com/fr/design/editor/editor/SpinnerIntegerEditor.java

@ -0,0 +1,66 @@
package com.fr.design.editor.editor;
import com.fr.base.Utils;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
public class SpinnerIntegerEditor extends Editor<Integer> {
private UISpinner spinner;
private String oldValue = StringUtils.EMPTY;
public SpinnerIntegerEditor(){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
spinner = new UISpinner(-Integer.MAX_VALUE, Integer.MAX_VALUE, 1, 0);
this.add(spinner, BorderLayout.CENTER);
this.spinner.addKeyListener(textKeyListener);
this.setName(Inter.getLocText("Parameter-Integer"));
}
@Override
public Integer getValue() {
return new Integer((int) this.spinner.getValue());
}
@Override
public void setValue(Integer value) {
if (value == null) {
value = new Integer(0);
}
this.spinner.setValue(value.intValue());
oldValue = Utils.objectToString(value);
}
@Override
public boolean accept(Object object) {
return object != null && object instanceof Integer;
}
public String getIconName() {
return "type_int";
}
KeyListener textKeyListener = new KeyAdapter() {
public void keyReleased(KeyEvent evt) {
int code = evt.getKeyCode();
if (code == KeyEvent.VK_ESCAPE) {
spinner.setValue(Double.parseDouble(oldValue));
}
if (code == KeyEvent.VK_ENTER) {
fireEditingStopped();
} else {
fireStateChanged();
}
}
};
}
Loading…
Cancel
Save