Browse Source

无任务,做短信事件插件发现的设计器bug

master
yaoh.wu 6 years ago
parent
commit
fe9584ccfe
  1. 125
      designer-base/src/com/fr/design/editor/editor/ColumnRowEditor.java
  2. 34
      designer-base/src/com/fr/design/editor/editor/TextEditor.java

125
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.design.layout.FRGUIPaneFactory;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import java.awt.*; import java.awt.BorderLayout;
/** /**
* the editor to edit ColumnRow * the editor to edit ColumnRow
* *
* @editor zhou * @author zhou
* @since 2012-3-29下午6:01:37 * @since 2012-3-29下午6:01:37
*/ */
public class ColumnRowEditor extends Editor<ColumnRow> { public class ColumnRowEditor extends Editor<ColumnRow> {
private ColumnRowPane crPane; private ColumnRowPane crPane;
public ColumnRowEditor() { public ColumnRowEditor() {
this(""); this("");
} }
public ColumnRowEditor(String name) { public ColumnRowEditor(String name) {
this(null, name); this(null, name);
} }
public ColumnRowEditor(ColumnRow value) { public ColumnRowEditor(ColumnRow value) {
this(value, ""); this(value, "");
} }
public ColumnRowEditor(ColumnRow value, String name) { public ColumnRowEditor(ColumnRow value, String name) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
crPane = new ColumnRowPane(); crPane = new ColumnRowPane();
this.add(crPane, BorderLayout.CENTER); this.add(crPane, BorderLayout.CENTER);
this.setValue(value); this.setValue(value);
this.setName(name); this.setName(name);
} }
@Override @Override
public ColumnRow getValue() { public ColumnRow getValue() {
return this.crPane.update(); return this.crPane.update();
} }
@Override @Override
public void setValue(ColumnRow value) { public void setValue(ColumnRow value) {
if (value == null) { if (value == null) {
value = ColumnRow.valueOf(0, 0); value = ColumnRow.valueOf(0, 0);
} }
this.crPane.populate(value); this.crPane.populate(value);
} }
@Override @Override
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
super.setEnabled(enabled); super.setEnabled(enabled);
this.crPane.setEnabled(enabled); this.crPane.setEnabled(enabled);
} }
@Override @Override
public void requestFocus() { public void requestFocus() {
this.crPane.requestFocus(); this.crPane.requestFocus();
} }
public String getIconName() { @Override
return "cell"; public String getIconName() {
} return "cell";
}
@Override
public boolean accept(Object object) { @Override
return object instanceof ColumnRow; public boolean accept(Object object) {
} return object instanceof ColumnRow;
}
@Override
public void clearData() {
super.clearData();
this.setValue(null);
}
} }

34
designer-base/src/com/fr/design/editor/editor/TextEditor.java

@ -3,26 +3,31 @@
*/ */
package com.fr.design.editor.editor; 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.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; 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. * CellEditor used to edit String object.
* *
* @editor zhou * @author zhou
* @since 2012-3-29下午6:00:43 * @since 2012-3-29下午6:00:43
*/ */
public class TextEditor extends Editor<String> { public class TextEditor extends Editor<String> {
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; private String oldValue = StringUtils.EMPTY;
/** /**
@ -93,7 +98,7 @@ public class TextEditor extends Editor<String> {
value = StringUtils.EMPTY; value = StringUtils.EMPTY;
} }
oldValue = value.toString(); oldValue = value;
this.textField.setText(oldValue); this.textField.setText(oldValue);
} }
@ -110,6 +115,7 @@ public class TextEditor extends Editor<String> {
/** /**
* 请求焦点 * 请求焦点
*/ */
@Override
public void requestFocus() { public void requestFocus() {
this.textField.requestFocus(); this.textField.requestFocus();
} }
@ -133,10 +139,12 @@ public class TextEditor extends Editor<String> {
/** /**
* 被选中时文本输入框请求焦点 * 被选中时文本输入框请求焦点
*/ */
@Override
public void selected() { public void selected() {
this.textField.requestFocus(); this.textField.requestFocus();
} }
@Override
public String getIconName() { public String getIconName() {
return "type_string"; return "type_string";
} }
@ -147,7 +155,15 @@ public class TextEditor extends Editor<String> {
* @param object 需要判断的object * @param object 需要判断的object
* @return 是字符类型则返回true * @return 是字符类型则返回true
*/ */
@Override
public boolean accept(Object object) { public boolean accept(Object object) {
return object instanceof String; return object instanceof String;
} }
@Override
public void clearData() {
super.clearData();
this.textField.setText(StringUtils.EMPTY);
this.oldValue = StringUtils.EMPTY;
}
} }
Loading…
Cancel
Save