forked from fanruan/finekit
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.4 KiB
65 lines
1.4 KiB
6 years ago
|
package com.fanruan.api.design.ui.editor;
|
||
|
|
||
|
import com.fanruan.api.design.ui.component.UITextField;
|
||
|
import com.fanruan.api.util.StringKit;
|
||
|
|
||
|
import java.awt.*;
|
||
|
|
||
|
/**
|
||
|
* @author richie
|
||
|
* @version 10.0
|
||
|
* Created by richie on 2019/11/1
|
||
|
* 这是一个占位符编辑器,表示不选择值类型
|
||
|
*/
|
||
|
public class NoneEditor extends BaseEditor {
|
||
|
|
||
|
private UITextField textField;
|
||
|
private String displayValue;
|
||
|
|
||
|
public NoneEditor() {
|
||
|
this(null);
|
||
|
}
|
||
|
|
||
|
public NoneEditor(String displayValue, String name) {
|
||
|
this.setLayout(new BorderLayout());
|
||
|
this.displayValue = displayValue;
|
||
|
textField = new UITextField();
|
||
|
this.add(textField, BorderLayout.CENTER);
|
||
|
if (displayValue != null) {
|
||
|
textField.setText(displayValue);
|
||
|
}
|
||
|
textField.setEditable(false);
|
||
|
this.setName(name);
|
||
|
}
|
||
|
|
||
|
public NoneEditor(String displayValue) {
|
||
|
this(displayValue, StringKit.EMPTY);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public UITextField getSwingComponent() {
|
||
|
return textField;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean accept(Object object) {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Object getValue() {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void setValue(Object value) {
|
||
|
if (displayValue != null) {
|
||
|
textField.setText(displayValue);
|
||
|
textField.setEditable(false);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public String getIconName() {
|
||
|
return "type_none";
|
||
|
}
|
||
|
}
|