diff --git a/designer-base/src/com/fr/design/editor/editor/ColumnRowEditor.java b/designer-base/src/com/fr/design/editor/editor/ColumnRowEditor.java index d596b8c6e..2da3bc310 100644 --- a/designer-base/src/com/fr/design/editor/editor/ColumnRowEditor.java +++ b/designer-base/src/com/fr/design/editor/editor/ColumnRowEditor.java @@ -4,71 +4,78 @@ import com.fr.design.gui.columnrow.ColumnRowPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.stable.ColumnRow; -import java.awt.*; +import java.awt.BorderLayout; /** * the editor to edit ColumnRow * - * @editor zhou + * @author zhou * @since 2012-3-29下午6:01:37 */ public class ColumnRowEditor extends Editor { - private ColumnRowPane crPane; - - public ColumnRowEditor() { - this(""); - } - - public ColumnRowEditor(String name) { - this(null, name); - } - - - public ColumnRowEditor(ColumnRow value) { - this(value, ""); - } - - public ColumnRowEditor(ColumnRow value, String name) { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - crPane = new ColumnRowPane(); - this.add(crPane, BorderLayout.CENTER); - this.setValue(value); - this.setName(name); - } - - @Override - public ColumnRow getValue() { - return this.crPane.update(); - } - - @Override - public void setValue(ColumnRow value) { - if (value == null) { - value = ColumnRow.valueOf(0, 0); - } - - this.crPane.populate(value); - } - - @Override - public void setEnabled(boolean enabled) { - super.setEnabled(enabled); - - this.crPane.setEnabled(enabled); - } - - @Override - public void requestFocus() { - this.crPane.requestFocus(); - } - - public String getIconName() { - return "cell"; - } - - @Override - public boolean accept(Object object) { - return object instanceof ColumnRow; - } + private ColumnRowPane crPane; + + public ColumnRowEditor() { + this(""); + } + + public ColumnRowEditor(String name) { + this(null, name); + } + + + public ColumnRowEditor(ColumnRow value) { + this(value, ""); + } + + public ColumnRowEditor(ColumnRow value, String name) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + crPane = new ColumnRowPane(); + this.add(crPane, BorderLayout.CENTER); + this.setValue(value); + this.setName(name); + } + + @Override + public ColumnRow getValue() { + return this.crPane.update(); + } + + @Override + public void setValue(ColumnRow value) { + if (value == null) { + value = ColumnRow.valueOf(0, 0); + } + + this.crPane.populate(value); + } + + @Override + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + + this.crPane.setEnabled(enabled); + } + + @Override + public void requestFocus() { + this.crPane.requestFocus(); + } + + @Override + public String getIconName() { + return "cell"; + } + + @Override + public boolean accept(Object object) { + return object instanceof ColumnRow; + } + + @Override + public void clearData() { + super.clearData(); + this.setValue(null); + } } \ No newline at end of file diff --git a/designer-base/src/com/fr/design/editor/editor/TextEditor.java b/designer-base/src/com/fr/design/editor/editor/TextEditor.java index 8700db078..630f6956a 100644 --- a/designer-base/src/com/fr/design/editor/editor/TextEditor.java +++ b/designer-base/src/com/fr/design/editor/editor/TextEditor.java @@ -3,26 +3,31 @@ */ package com.fr.design.editor.editor; -import java.awt.BorderLayout; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; - import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.Inter; import com.fr.stable.StringUtils; +import java.awt.BorderLayout; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; + /** * CellEditor used to edit String object. * - * @editor zhou + * @author zhou * @since 2012-3-29下午6:00:43 */ public class TextEditor extends Editor { - private UITextField textField; // text field. - // the old value of text field. + /** + * text field. + */ + private UITextField textField; + /** + * the old value of text field. + */ private String oldValue = StringUtils.EMPTY; /** @@ -93,7 +98,7 @@ public class TextEditor extends Editor { value = StringUtils.EMPTY; } - oldValue = value.toString(); + oldValue = value; this.textField.setText(oldValue); } @@ -110,6 +115,7 @@ public class TextEditor extends Editor { /** * 请求焦点 */ + @Override public void requestFocus() { this.textField.requestFocus(); } @@ -133,10 +139,12 @@ public class TextEditor extends Editor { /** * 被选中时文本输入框请求焦点 */ + @Override public void selected() { this.textField.requestFocus(); } + @Override public String getIconName() { return "type_string"; } @@ -147,7 +155,15 @@ public class TextEditor extends Editor { * @param object 需要判断的object * @return 是字符类型则返回true */ + @Override public boolean accept(Object object) { return object instanceof String; } + + @Override + public void clearData() { + super.clearData(); + this.textField.setText(StringUtils.EMPTY); + this.oldValue = StringUtils.EMPTY; + } } \ No newline at end of file