Browse Source

REPORT-57868 解决单元格切换元素的异常问题

fix-lag
kuangshuai 3 years ago
parent
commit
5eaaf35d7f
  1. 8
      designer-realize/src/main/java/com/fr/design/actions/insert/cell/GeneralCellAction.java
  2. 9
      designer-realize/src/main/java/com/fr/design/cell/editor/TextCellEditor.java

8
designer-realize/src/main/java/com/fr/design/actions/insert/cell/GeneralCellAction.java

@ -10,6 +10,7 @@ import com.fr.design.menu.MenuKeySet;
import javax.swing.*;
import java.awt.event.ActionEvent;
/**
*
@ -52,4 +53,11 @@ public class GeneralCellAction extends AbstractCellAction implements WorkBookSup
public Class getCellValueClass() {
return String.class;
}
@Override
public void actionPerformed(ActionEvent evt) {
super.actionPerformed(evt);
this.getEditingComponent().getGrid().getCellEditor().stopCellEditing();
}
}

9
designer-realize/src/main/java/com/fr/design/cell/editor/TextCellEditor.java

@ -129,7 +129,7 @@ public class TextCellEditor extends AbstractCellEditor {
}
this.oldValue = Utils.objectToString(value);
this.textField.setText(oldValue);
resetTextWithoutDocumentListener(oldValue);
//peter:只读方式获得Style.
Style style = null;
if(cellElement != null) {
@ -176,4 +176,11 @@ public class TextCellEditor extends AbstractCellEditor {
public void keyReleased(KeyEvent evt) {
}
};
private void resetTextWithoutDocumentListener(String text) {
this.textField.getDocument().removeDocumentListener(documentlistener);
this.textField.setText(text);
this.textField.getDocument().addDocumentListener(documentlistener);
}
}
Loading…
Cancel
Save