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.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<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();
}
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);
}
}

34
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<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;
/**
@ -93,7 +98,7 @@ public class TextEditor extends Editor<String> {
value = StringUtils.EMPTY;
}
oldValue = value.toString();
oldValue = value;
this.textField.setText(oldValue);
}
@ -110,6 +115,7 @@ public class TextEditor extends Editor<String> {
/**
* 请求焦点
*/
@Override
public void requestFocus() {
this.textField.requestFocus();
}
@ -133,10 +139,12 @@ public class TextEditor extends Editor<String> {
/**
* 被选中时文本输入框请求焦点
*/
@Override
public void selected() {
this.textField.requestFocus();
}
@Override
public String getIconName() {
return "type_string";
}
@ -147,7 +155,15 @@ public class TextEditor extends Editor<String> {
* @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;
}
}
Loading…
Cancel
Save