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.
87 lines
1.9 KiB
87 lines
1.9 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 com.fr.stable.ColumnRowGroup;
|
||
|
|
||
|
import javax.swing.*;
|
||
|
import java.awt.*;
|
||
|
|
||
|
/**
|
||
|
* @author richie
|
||
|
* @version 10.0
|
||
|
* Created by richie on 2019/11/4
|
||
|
* 用于编辑和展示行列集合的编辑器
|
||
|
*/
|
||
|
public class TypeColumnRowGroupEditor extends BaseEditor<ColumnRowGroup> {
|
||
|
|
||
|
private UITextField crEditor;
|
||
|
|
||
|
public TypeColumnRowGroupEditor() {
|
||
|
this(StringKit.EMPTY);
|
||
|
}
|
||
|
|
||
|
public TypeColumnRowGroupEditor(String name) {
|
||
|
this(null, name);
|
||
|
}
|
||
|
|
||
|
public TypeColumnRowGroupEditor(ColumnRowGroup value) {
|
||
|
this(value, StringKit.EMPTY);
|
||
|
}
|
||
|
|
||
|
public TypeColumnRowGroupEditor(ColumnRowGroup value, String name) {
|
||
|
this.setLayout(new BorderLayout());
|
||
|
crEditor = new UITextField();
|
||
|
this.add(crEditor, BorderLayout.CENTER);
|
||
|
this.setValue(value);
|
||
|
this.setName(name);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public JComponent getSwingComponent() {
|
||
|
return crEditor;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 是否接收/支持这个对象
|
||
|
*
|
||
|
* @param object 检测对象
|
||
|
* @return 是否支持
|
||
|
*/
|
||
|
public boolean accept(Object object) {
|
||
|
return object instanceof ColumnRowGroup;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public ColumnRowGroup getValue() {
|
||
|
return new ColumnRowGroup(this.crEditor.getText());
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void setValue(ColumnRowGroup value) {
|
||
|
if (value == null) {
|
||
|
this.crEditor.setText(StringKit.EMPTY);
|
||
|
} else {
|
||
|
this.crEditor.setText(value.toString());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void setEnabled(boolean enabled) {
|
||
|
super.setEnabled(enabled);
|
||
|
|
||
|
this.crEditor.setEnabled(enabled);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 获取焦点
|
||
|
*/
|
||
|
public void requestFocus() {
|
||
|
this.crEditor.requestFocus();
|
||
|
}
|
||
|
|
||
|
public String getIconName() {
|
||
|
return "cell_group";
|
||
|
}
|
||
|
}
|