插件开发工具库,推荐依赖该工具库。
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.
 
 

86 lines
1.8 KiB

package com.fanruan.api.design.ui.editor;
import com.fanruan.api.util.StringKit;
import com.fr.design.gui.columnrow.ColumnRowPane;
import com.fr.stable.ColumnRow;
import javax.swing.*;
import java.awt.*;
/**
* @author richie
* @version 10.0
* Created by richie on 2019/11/4
* 用于编辑和展示单元格坐标的编辑器
*/
public class TypeColumnRowEditor extends BaseEditor<ColumnRow> {
private ColumnRowPane crPane;
public TypeColumnRowEditor() {
this(StringKit.EMPTY);
}
public TypeColumnRowEditor(String name) {
this(null, name);
}
public TypeColumnRowEditor(ColumnRow value) {
this(value, StringKit.EMPTY);
}
public TypeColumnRowEditor(ColumnRow value, String name) {
this.setLayout(new BorderLayout());
crPane = new ColumnRowPane();
this.add(crPane, BorderLayout.CENTER);
this.setValue(value);
this.setName(name);
}
@Override
public JComponent getSwingComponent() {
return crPane;
}
@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);
}
}