mirror of https://gitee.com/makejava/EasyCode.git
添加了表格列配置功能。
This commit is contained in:
parent
9e442375fc
commit
61effd1e00
|
@ -0,0 +1,65 @@
|
|||
package com.sjhy.plugin.entity;
|
||||
|
||||
import com.sjhy.plugin.comm.CommClone;
|
||||
|
||||
public class ColumnConfig extends CommClone<ColumnConfig> {
|
||||
private String title;
|
||||
private ColumnConfigType type;
|
||||
private String selectValue;
|
||||
|
||||
public ColumnConfig() {
|
||||
}
|
||||
|
||||
public ColumnConfig(String title, ColumnConfigType type) {
|
||||
this.title = title;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public ColumnConfig(String title, ColumnConfigType type, String selectValue) {
|
||||
this.title = title;
|
||||
this.type = type;
|
||||
this.selectValue = selectValue;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public ColumnConfigType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(ColumnConfigType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getSelectValue() {
|
||||
return selectValue;
|
||||
}
|
||||
|
||||
public void setSelectValue(String selectValue) {
|
||||
this.selectValue = selectValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
ColumnConfig that = (ColumnConfig) o;
|
||||
|
||||
return title.equals(that.title) && type == that.type && (selectValue != null ? selectValue.equals(that.selectValue) : that.selectValue == null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = title.hashCode();
|
||||
result = 31 * result + type.hashCode();
|
||||
result = 31 * result + (selectValue != null ? selectValue.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.sjhy.plugin.entity;
|
||||
|
||||
public class ColumnConfigGroup extends AbstractGroup<ColumnConfigGroup, ColumnConfig> {
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package com.sjhy.plugin.entity;
|
||||
|
||||
public enum ColumnConfigType {
|
||||
TEXT,SELECT,BOOLEAN
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.sjhy.plugin.service;
|
|||
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.sjhy.plugin.entity.ColumnConfigGroup;
|
||||
import com.sjhy.plugin.entity.TemplateGroup;
|
||||
import com.sjhy.plugin.entity.TypeMapperGroup;
|
||||
|
||||
|
@ -38,4 +39,12 @@ public interface ConfigService extends PersistentStateComponent<ConfigService> {
|
|||
Map<String, TemplateGroup> getTemplateGroupMap();
|
||||
|
||||
void setTemplateGroupMap(Map<String, TemplateGroup> templateGroupMap);
|
||||
|
||||
Map<String, ColumnConfigGroup> getColumnConfigGroupMap();
|
||||
|
||||
void setColumnConfigGroupMap(Map<String, ColumnConfigGroup> columnConfigGroupMap);
|
||||
|
||||
String getCurrColumnConfigGroupName();
|
||||
|
||||
void setCurrColumnConfigGroupName(String currColumnConfigGroupName);
|
||||
}
|
||||
|
|
|
@ -3,10 +3,7 @@ package com.sjhy.plugin.service.impl;
|
|||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
import com.intellij.util.xmlb.XmlSerializerUtil;
|
||||
import com.sjhy.plugin.entity.Template;
|
||||
import com.sjhy.plugin.entity.TemplateGroup;
|
||||
import com.sjhy.plugin.entity.TypeMapper;
|
||||
import com.sjhy.plugin.entity.TypeMapperGroup;
|
||||
import com.sjhy.plugin.entity.*;
|
||||
import com.sjhy.plugin.service.ConfigService;
|
||||
import com.sjhy.plugin.tool.FileUtils;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -26,6 +23,10 @@ public class ConfigServiceImpl implements ConfigService {
|
|||
private String currTemplateGroupName;
|
||||
//模板组
|
||||
private Map<String, TemplateGroup> templateGroupMap;
|
||||
//配置表组
|
||||
private Map<String, ColumnConfigGroup> columnConfigGroupMap;
|
||||
//当前配置表组名
|
||||
private String currColumnConfigGroupName;
|
||||
//默认编码
|
||||
private String encode;
|
||||
//作者
|
||||
|
@ -46,7 +47,7 @@ public class ConfigServiceImpl implements ConfigService {
|
|||
|
||||
@Override
|
||||
public void loadState(ConfigService configService) {
|
||||
if (configService==null || configService.getTemplateGroupMap()==null || configService.getTypeMapperGroupMap()==null) {
|
||||
if (configService==null || configService.getTemplateGroupMap()==null || configService.getTypeMapperGroupMap()==null || configService.getColumnConfigGroupMap()==null) {
|
||||
return;
|
||||
}
|
||||
//重点,没有数据时,不要序列化
|
||||
|
@ -56,6 +57,9 @@ public class ConfigServiceImpl implements ConfigService {
|
|||
if (configService.getTemplateGroupMap().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (configService.getColumnConfigGroupMap().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
//加载配置信息
|
||||
XmlSerializerUtil.copyBean(configService, this);
|
||||
}
|
||||
|
@ -76,6 +80,9 @@ public class ConfigServiceImpl implements ConfigService {
|
|||
if (this.currTypeMapperGroupName==null) {
|
||||
this.currTypeMapperGroupName = DEFAULT_NAME;
|
||||
}
|
||||
if (this.currColumnConfigGroupName==null) {
|
||||
this.currColumnConfigGroupName = DEFAULT_NAME;
|
||||
}
|
||||
//配置默认模板
|
||||
if (this.templateGroupMap==null) {
|
||||
this.templateGroupMap = new LinkedHashMap<>();
|
||||
|
@ -106,6 +113,17 @@ public class ConfigServiceImpl implements ConfigService {
|
|||
typeMapperGroup.setName(DEFAULT_NAME);
|
||||
typeMapperGroup.setElementList(typeMapperList);
|
||||
typeMapperGroupMap.put(DEFAULT_NAME, typeMapperGroup);
|
||||
|
||||
//初始化表配置
|
||||
if (this.columnConfigGroupMap==null) {
|
||||
this.columnConfigGroupMap = new LinkedHashMap<>();
|
||||
}
|
||||
ColumnConfigGroup columnConfigGroup = new ColumnConfigGroup();
|
||||
List<ColumnConfig> columnConfigList = new ArrayList<>();
|
||||
columnConfigList.add(new ColumnConfig("required", ColumnConfigType.BOOLEAN));
|
||||
columnConfigGroup.setName(DEFAULT_NAME);
|
||||
columnConfigGroup.setElementList(columnConfigList);
|
||||
columnConfigGroupMap.put(DEFAULT_NAME, columnConfigGroup);
|
||||
}
|
||||
|
||||
private String loadTemplate(String name) {
|
||||
|
@ -172,4 +190,24 @@ public class ConfigServiceImpl implements ConfigService {
|
|||
public void setTemplateGroupMap(Map<String, TemplateGroup> templateGroupMap) {
|
||||
this.templateGroupMap = templateGroupMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ColumnConfigGroup> getColumnConfigGroupMap() {
|
||||
return columnConfigGroupMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColumnConfigGroupMap(Map<String, ColumnConfigGroup> columnConfigGroupMap) {
|
||||
this.columnConfigGroupMap = columnConfigGroupMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrColumnConfigGroupName() {
|
||||
return currColumnConfigGroupName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrColumnConfigGroupName(String currColumnConfigGroupName) {
|
||||
this.currColumnConfigGroupName = currColumnConfigGroupName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.sjhy.plugin.ui.AbstractTableGroupPanel">
|
||||
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="479" height="440"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="ad63" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Group:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="34e02" class="javax.swing.JComboBox" binding="groupComboBox">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<scrollpane id="e31eb">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="2" col-span="3" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="873da" class="javax.swing.JTable" binding="table">
|
||||
<constraints/>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</scrollpane>
|
||||
<toolbar id="bf0d4">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<borderPainted value="false"/>
|
||||
<floatable value="false"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="450d2" class="javax.swing.JButton" binding="copyGroupButton">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<icon value="actions/copy.png"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="d1404" class="javax.swing.JButton" binding="deleteGroupButton">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<icon value="actions/delete.png"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</toolbar>
|
||||
<toolbar id="3dfe6">
|
||||
<constraints>
|
||||
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="-1" height="20"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<borderPainted value="false"/>
|
||||
<floatable value="false"/>
|
||||
<orientation value="1"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="cbe8d" class="javax.swing.JButton" binding="addItemButton">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<icon value="general/add.png"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="56e42" class="javax.swing.JButton" binding="deleteItemButton">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<icon value="actions/delete.png"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</toolbar>
|
||||
<vspacer id="dbc67">
|
||||
<constraints>
|
||||
<grid row="2" column="3" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
|
@ -0,0 +1,232 @@
|
|||
package com.sjhy.plugin.ui;
|
||||
|
||||
import com.intellij.ui.BooleanTableCellEditor;
|
||||
import com.intellij.util.ui.ComboBoxCellEditor;
|
||||
import com.sjhy.plugin.comm.CommClone;
|
||||
import com.sjhy.plugin.entity.AbstractGroup;
|
||||
import com.sjhy.plugin.entity.ColumnConfig;
|
||||
import com.sjhy.plugin.service.ConfigService;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableColumn;
|
||||
import java.util.*;
|
||||
|
||||
public abstract class AbstractTableGroupPanel<T extends AbstractGroup<T,E>, E extends CommClone> {
|
||||
private JPanel mainPanel;
|
||||
private JComboBox groupComboBox;
|
||||
private JTable table;
|
||||
private JButton copyGroupButton;
|
||||
private JButton deleteGroupButton;
|
||||
private JButton addItemButton;
|
||||
private JButton deleteItemButton;
|
||||
|
||||
private ColumnConfig[] columnConfigInfo;
|
||||
|
||||
private DefaultTableModel tableModel;
|
||||
|
||||
protected Map<String,T> group;
|
||||
protected String currGroupName;
|
||||
|
||||
private boolean initFlag;
|
||||
|
||||
|
||||
AbstractTableGroupPanel(Map<String, T> group, String currGroupName) {
|
||||
init(group, currGroupName);
|
||||
initEvent();
|
||||
}
|
||||
|
||||
protected AbstractGroup<T,E> getCurrGroup() {
|
||||
return this.group.get(this.currGroupName);
|
||||
}
|
||||
|
||||
//刷新类类型配置
|
||||
private void refreshEditorType() {
|
||||
for (ColumnConfig column : columnConfigInfo) {
|
||||
TableColumn tableColumn = table.getColumn(column.getTitle());
|
||||
switch (column.getType()) {
|
||||
case TEXT:
|
||||
break;
|
||||
case SELECT:
|
||||
tableColumn.setCellEditor(new ComboBoxCellEditor() {
|
||||
@Override
|
||||
protected List<String> getComboBoxItems() {
|
||||
return Arrays.asList(column.getSelectValue().split(","));
|
||||
}
|
||||
});
|
||||
break;
|
||||
case BOOLEAN:
|
||||
tableColumn.setCellEditor(new BooleanTableCellEditor());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void init(Map<String, T> group, String currGroupName) {
|
||||
this.group = group;
|
||||
this.currGroupName = currGroupName;
|
||||
initFlag = false;
|
||||
//初始化分组
|
||||
initGroup(group.keySet(), currGroupName);
|
||||
//初始化列
|
||||
columnConfigInfo = initColumn();
|
||||
tableModel = new DefaultTableModel();
|
||||
table.setModel(tableModel);
|
||||
for (ColumnConfig column : columnConfigInfo) {
|
||||
tableModel.addColumn(column.getTitle());
|
||||
}
|
||||
//初始化数据
|
||||
getCurrGroup().getElementList().forEach(e -> {
|
||||
tableModel.addRow(toRow(e));
|
||||
});
|
||||
table.setModel(tableModel);
|
||||
refreshEditorType();
|
||||
initFlag = true;
|
||||
}
|
||||
|
||||
private void initEvent() {
|
||||
//切换分组事件
|
||||
groupComboBox.addActionListener(e -> {
|
||||
if (!initFlag){
|
||||
return;
|
||||
}
|
||||
String groupName = (String) groupComboBox.getSelectedItem();
|
||||
if (groupName==null) {
|
||||
return;
|
||||
}
|
||||
if (currGroupName.equals(groupName)) {
|
||||
return;
|
||||
}
|
||||
init(group, groupName);
|
||||
});
|
||||
//复制分组事件
|
||||
copyGroupButton.addActionListener(e -> {
|
||||
if (!initFlag) {
|
||||
return;
|
||||
}
|
||||
String value = JOptionPane.showInputDialog(null, "Input Group Name:", currGroupName+" Copy");
|
||||
if (value==null) {
|
||||
return;
|
||||
}
|
||||
if (value.trim().length()==0){
|
||||
JOptionPane.showMessageDialog(null, "Group Name Can't Is Empty!");
|
||||
return;
|
||||
}
|
||||
if (group.containsKey(value)){
|
||||
JOptionPane.showMessageDialog(null, "Group Name Already exist!");
|
||||
return;
|
||||
}
|
||||
//noinspection unchecked
|
||||
T groupItem = group.get(currGroupName).clone();
|
||||
groupItem.setName(value);
|
||||
group.put(value, groupItem);
|
||||
init(group, value);
|
||||
});
|
||||
//删除分组事件
|
||||
deleteGroupButton.addActionListener(e -> {
|
||||
if (!initFlag) {
|
||||
return;
|
||||
}
|
||||
int result = JOptionPane.showConfirmDialog(null, "Confirm Delete Group "+currGroupName+"?", "Title Info", JOptionPane.OK_CANCEL_OPTION);
|
||||
if (result==0){
|
||||
if(ConfigService.DEFAULT_NAME.equals(currGroupName)){
|
||||
JOptionPane.showMessageDialog(null, "Can't Delete Default Group!");
|
||||
return;
|
||||
}
|
||||
group.remove(currGroupName);
|
||||
init(group, ConfigService.DEFAULT_NAME);
|
||||
}
|
||||
});
|
||||
//添加元素事件
|
||||
addItemButton.addActionListener(e -> {
|
||||
if (!initFlag) {
|
||||
return;
|
||||
}
|
||||
String value = JOptionPane.showInputDialog(null, "Input Item Name:", "Demo");
|
||||
if (value==null) {
|
||||
return;
|
||||
}
|
||||
if (value.trim().length()==0){
|
||||
JOptionPane.showMessageDialog(null, "Item Name Can't Is Empty!");
|
||||
return;
|
||||
}
|
||||
List<E> itemList = group.get(currGroupName).getElementList();
|
||||
for (E item : itemList) {
|
||||
if (getItemName(item).equals(value)){
|
||||
JOptionPane.showMessageDialog(null, "Item Name Already exist!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
itemList.add(createItem(value));
|
||||
init(group, currGroupName);
|
||||
});
|
||||
//删除元素
|
||||
deleteItemButton.addActionListener(e -> {
|
||||
if (!initFlag) {
|
||||
return;
|
||||
}
|
||||
List<E> itemList = group.get(currGroupName).getElementList();
|
||||
if (itemList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
int result = JOptionPane.showConfirmDialog(null, "Confirm Delete Selected Item?", "Title Info", JOptionPane.OK_CANCEL_OPTION);
|
||||
if (result==0) {
|
||||
int[] rows = table.getSelectedRows();
|
||||
for (int i = rows.length-1; i>=0; i--) {
|
||||
tableModel.removeRow(rows[i]);
|
||||
getCurrGroup().getElementList().remove(rows[i]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化分组
|
||||
@SuppressWarnings("unchecked")
|
||||
private void initGroup(Set<String> groupNameSet, String selectGroupName) {
|
||||
groupComboBox.removeAllItems();
|
||||
groupNameSet.forEach(groupComboBox::addItem);
|
||||
groupComboBox.setSelectedItem(selectGroupName);
|
||||
}
|
||||
|
||||
//用于数据回绑定
|
||||
protected void refresh() {
|
||||
if (tableModel==null){
|
||||
return;
|
||||
}
|
||||
Vector vector = tableModel.getDataVector();
|
||||
getCurrGroup().getElementList().clear();
|
||||
for (Object obj : vector) {
|
||||
if (obj instanceof Vector) {
|
||||
Vector item = (Vector) obj;
|
||||
Object[] itemArr = new Object[item.size()];
|
||||
int i = 0;
|
||||
for (Object obj2 : item) {
|
||||
if (obj2!=null && obj2 instanceof String) {
|
||||
String str = (String) obj2;
|
||||
str = str.trim();
|
||||
obj2 = str;
|
||||
if (str.isEmpty()){
|
||||
obj2 = null;
|
||||
}
|
||||
}
|
||||
itemArr[i++] = obj2;
|
||||
}
|
||||
getCurrGroup().getElementList().add(toItem(itemArr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract Object[] toRow(E item);
|
||||
|
||||
protected abstract E toItem(Object[] rowData);
|
||||
|
||||
protected abstract String getItemName(E item);
|
||||
|
||||
protected abstract E createItem(String value);
|
||||
|
||||
protected abstract ColumnConfig[] initColumn();
|
||||
|
||||
public JPanel getMainPanel() {
|
||||
return mainPanel;
|
||||
}
|
||||
}
|
|
@ -46,9 +46,10 @@ public class MainSetting extends ServiceComm implements Configurable, Configurab
|
|||
@NotNull
|
||||
@Override
|
||||
public Configurable[] getConfigurables() {
|
||||
Configurable[] result = new Configurable[2];
|
||||
Configurable[] result = new Configurable[3];
|
||||
result[0] = new TypeMapperSetting(configService);
|
||||
result[1] = new TemplateSettingPanel();
|
||||
result[2] = new TableSettingPanel();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
package com.sjhy.plugin.ui;
|
||||
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.sjhy.plugin.entity.ColumnConfig;
|
||||
import com.sjhy.plugin.entity.ColumnConfigGroup;
|
||||
import com.sjhy.plugin.entity.ColumnConfigType;
|
||||
import com.sjhy.plugin.service.ConfigService;
|
||||
import com.sjhy.plugin.tool.CloneUtils;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class TableSettingPanel extends AbstractTableGroupPanel<ColumnConfigGroup, ColumnConfig> implements Configurable {
|
||||
private ConfigService configService = ConfigService.getInstance();
|
||||
private CloneUtils cloneUtils = CloneUtils.getInstance();
|
||||
TableSettingPanel() {
|
||||
super(CloneUtils.getInstance().cloneMap(ConfigService.getInstance().getColumnConfigGroupMap()), ConfigService.getInstance().getCurrColumnConfigGroupName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object[] toRow(ColumnConfig item) {
|
||||
return new Object[]{item.getTitle(), item.getType().name(), item.getSelectValue()};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ColumnConfig toItem(Object[] rowData) {
|
||||
return new ColumnConfig((String) rowData[0], ColumnConfigType.valueOf((String) rowData[1]), (String) rowData[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getItemName(ColumnConfig item) {
|
||||
return item.getTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ColumnConfig createItem(String value) {
|
||||
return new ColumnConfig(value, ColumnConfigType.TEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ColumnConfig[] initColumn() {
|
||||
ColumnConfig[] columnConfigs = new ColumnConfig[3];
|
||||
columnConfigs[0] = new ColumnConfig("title", ColumnConfigType.TEXT);
|
||||
columnConfigs[1] = new ColumnConfig("type", ColumnConfigType.SELECT, "TEXT,SELECT,BOOLEAN");
|
||||
columnConfigs[2] = new ColumnConfig("selectValue", ColumnConfigType.TEXT);
|
||||
return columnConfigs;
|
||||
}
|
||||
|
||||
@Nls
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return "Table Editor Config";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JComponent createComponent() {
|
||||
return getMainPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
refresh();
|
||||
return !configService.getColumnConfigGroupMap().equals(group) || !configService.getCurrColumnConfigGroupName().equals(currGroupName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
configService.setColumnConfigGroupMap(group);
|
||||
configService.setCurrColumnConfigGroupName(currGroupName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
init(cloneUtils.cloneMap(configService.getColumnConfigGroupMap()), configService.getCurrColumnConfigGroupName());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue