/*
* BasicDataDefineView.java
*
* Created on 2008年9月18日, 下午1:38
*/
package com.itown.rcp.basicdata.view;
import com.itown.rcp.basicdata.BasicDataDefine;
import com.itown.rcp.basicdata.BasicDataException;
import com.itown.rcp.basicdata.TreeBasicDataDefine;
import com.itown.rcp.basicdata.bl.SysCompoundBasicDataBL;
import com.itown.rcp.basicdata.bl.TableBasicDataBL;
import com.itown.rcp.basicdata.bl.TreeBasicDataBL;
import com.itown.rcp.basicdata.define.CompoundBasicDataDefine;
import com.itown.rcp.basicdata.entity.SysCompound;
import com.itown.rcp.basicdata.impl.BasicDataUtils;
import com.itown.rcp.basicdata.service.BasicDataDefineService;
import com.itown.rcp.basicdata.utils.CancelableTreeSelectionListener;
import com.itown.rcp.basicdata.utils.Execution;
import com.itown.rcp.basicdata.utils.SearchOperation;
import com.itown.rcp.basicdata.utils.TreeUserObject;
import com.itown.rcp.client.MessageBox;
import com.itown.rcp.client.test.AuthenticatedTestBase;
import com.itown.rcp.proxy.ServiceFactory;
import com.itown.rcp.swing.binding.BindingUtils;
import com.itown.rcp.swing.fsp.filter.FilterType;
import com.itown.rcp.swing.fsp.filter.OrFilterItem;
import com.itown.rcp.swing.fsp.filter.SimpleFilterItem;
import com.itown.rcp.swing.table.TableUtils;
import com.itown.rcp.swing.table.filter.FilterGroup;
import com.itown.rcp.sysmgr.utils.JTreeHelper;
import com.itown.rcp.sysmgr.utils.TableDataHelper;
import com.itown.rcp.view.AbstractView;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.text.JTextComponent;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.collections.map.LinkedMap;
import org.apache.commons.lang.StringUtils;
import org.itown.rcp.Menu;
import org.itown.rcp.action.Action;
import org.itown.rcp.util.ListItem;
import org.itown.rcp.util.MapComboBoxModel;
import org.itown.rcp.view.ModalResult;
import org.itown.rcp.datastore.helper.ModifiedTableData;
import org.itown.rcp.datastore.helper.ModifiedTableDataUtils;
import org.itown.rcp.datastore.helper.UUIDKeyGenerator;
import org.jdesktop.beansbinding.Binding;
import org.jdesktop.beansbinding.BindingGroup;
/**
*
* @author ywl
*/
@Menu(code = "010114")
public class BasicDataDefineView extends AbstractView {
protected FilterGroup filterGroup;
private TreeBasicDataBL treeBasicDataBL;
private SysCompoundBasicDataBL compoundBasicDataBL;
private TableBasicDataBL tablebl;
private Map<String, JComponent> propertyBindingMappping;
private Object curObject;
private BindingGroup bindingGroup;
private List<SysCompound> compoundItems;
private BasicDataDefine basicDataDefine;
private BasicDataDefineService service = ServiceFactory.getInstance().getService(BasicDataDefineService.class);
public BasicDataDefineView() {
initComponents();
setComponent(masterPanel);
Map items = new LinkedMap();
items.put(SearchOperation.LIKE, "包含");
items.put(SearchOperation.LLIKE, "左匹配");
items.put(SearchOperation.RLIKE, "右匹配");
items.put(SearchOperation.EQUALS, "等于");
operationTree.setModel(new MapComboBoxModel(items, false));
this.compoundCategoryTree.addTreeSelectionListener(new CompoundCategoryTSL());
this.bindCompoundItems();
}
@Override
public void viewOpened() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode("基础数据");
//String[] basicDataIds = BasicDataUtils.getBasicDataDefineNames();
String[] nts = BasicDataUtils.getDefineNameAndTitles();
if (nts != null && nts.length > 0) {
for (String nt : nts) {
String[] n = nt.split("<>");
BasicDataDefine basicDataDefine = BasicDataUtils.getBasicDataDefine(n[0]);
if (basicDataDefine != null) {
DefaultMutableTreeNode basicDataNode = new DefaultMutableTreeNode();
basicDataNode.setUserObject(new TreeUserObject(n[0], n[1], basicDataDefine));
root.add(basicDataNode);
}
}
}
basicDataDefineTree.setModel(new DefaultTreeModel(root));
basicDataDefineTree.addTreeSelectionListener(new CancelableTreeSelectionListener(new Execution() {
public boolean execute(TreeSelectionEvent e) {
JTree tree = (JTree) e.getSource();
//判断原来的基础数据是否已保存
TreePath old = e.getOldLeadSelectionPath();
System.out.println("old : " + old);
if (old != null) {
DefaultMutableTreeNode oldNode = (DefaultMutableTreeNode) old.getLastPathComponent();
if (!(oldNode.getUserObject() instanceof TreeUserObject)) {
return false;
}
TreeUserObject uo = (TreeUserObject) oldNode.getUserObject();
if (uo.getObject() != null) {
BasicDataDefine basicDataDefine = (BasicDataDefine) uo.getObject();
boolean isDirty = isDirty(basicDataDefine);
if (isDirty) {
int result = MessageBox.confirm("基础数据:" + basicDataDefine.getName() + "有数据未保存,现在保存吗?");
if (JOptionPane.YES_OPTION == result) {
try {
save();
} catch (Exception ex) {
MessageBox.prompt(ex.getMessage());
return true;
}
} else {
return true;
}
}
}
}
DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
if (node == null) {
return false;
}
if (!(node.getUserObject() instanceof TreeUserObject)) {
return false;
}
TreeUserObject uo = (TreeUserObject) node.getUserObject();
if (uo == null) {
return false;
}
if (uo.getObject() == null) {
return false;
}
BasicDataDefine bd = (BasicDataDefine) uo.getObject();
modifyBasicData(bd);
return false;
}
}));
buildTreeEidtAction();
buildCompoundEidtAction();
this.masterSplitPane.setRightComponent(this.emptyPanel);
modifyCompoundCategoryButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/edit.gif"))); // NOI18N
addCompoundCategoryButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/add.gif"))); // NOI18N
delCompoundCategoryButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/delete.gif"))); // NOI18N
modifyCompoundItemButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/edit.gif"))); // NOI18N
delCompoundItemButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/delete.gif"))); // NOI18N
addCompoundItemButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/add.gif"))); // NOI18N
saveAllTreeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/save.gif"))); // NOI18N
deleteTreeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/delete.gif"))); // NOI18N
addChildTreeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/add.gif"))); // NOI18N
}
@Override
public boolean isDirty() {
return isDirty(basicDataDefine);
}
private boolean isDirty(BasicDataDefine basicDataDefine) {
boolean isDirty = false;
if (basicDataDefine == null) {
return false;
}
if (basicDataDefine instanceof CompoundBasicDataDefine) {
//compoundBasicDataBL
} else if (basicDataDefine instanceof TreeBasicDataDefine) {
if (treeBasicDataBL != null) {
isDirty = treeBasicDataBL.isDirty();
}
} else {
isDirty = TableUtils.isDirty(mainTable);
}
return isDirty;
}
private TreeBasicDataBL getTreeBasicDataBL(TreeBasicDataDefine basicDataDefine) {
TreeBasicDataBL result = treeBasicDataBLMap.get(basicDataDefine);
if (result == null) {
result = new TreeBasicDataBL(this, basicDataDefine, basicDataTree, detailPanel);
treeBasicDataBLMap.put(basicDataDefine, result);
}
return result;
}
private SysCompoundBasicDataBL getCompoundBasicDataBL(CompoundBasicDataDefine basicData) {
if (this.compoundBasicDataBL == null) {
compoundBasicDataBL = new SysCompoundBasicDataBL(this, basicData, compoundCategoryTree);
}
return this.compoundBasicDataBL;
}
private TableBasicDataBL getTableBasicDataBL(BasicDataDefine basicData) {
TableBasicDataBL result = tableBasicDataBLMap.get(basicData);
if (result == null) {
result = new TableBasicDataBL(this, basicData);
tableBasicDataBLMap.put(basicData, result);
}
return result;
}
private void bindData(Object object) {
if (object == null) {
return;
}
curObject = object;
if (bindingGroup == null) {
bindingGroup = new BindingGroup();
}
bindingGroup.unbind();
//清除原有绑定
List<Binding> bindings = bindingGroup.getBindings();
if (bindings != null) {
for (Binding binding : bindings) {
bindingGroup.removeBinding(binding);
}
}
//DefaultBeanBinding.getInstance().buildBinding(bindingGroup, curObject, propertyBindingMappping);
BindingUtils.autoBindingByName(bindingGroup, object, this.detailPanel);
bindingGroup.bind();
syncComboBoxItem(curObject);
setControlStatus();
}
private void setControlStatus() {
JComponent codeComponent = this.propertyBindingMappping.get(treeBasicDataBL.getCodeProperty());
if (codeComponent != null) {
if (treeBasicDataBL.isNewObject(curObject)) {
codeComponent.setEnabled(true);
if (codeComponent.isEnabled()) {
codeComponent.requestFocus();
}
} else {
codeComponent.setEnabled(false);
}
}
}
class NameDocumentListener implements DocumentListener {
JTextComponent name;
JTree tree;
public NameDocumentListener(JTextComponent name, JTree tree) {
this.name = name;
this.tree = tree;
}
@Override
public void insertUpdate(DocumentEvent e) {
updateTreeNode();
}
@Override
public void removeUpdate(DocumentEvent e) {
updateTreeNode();
}
@Override
public void changedUpdate(DocumentEvent e) {
updateTreeNode();
}
void updateTreeNode() {
String value = name.getText();
DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
if (node == null) {
return;
}
TreeUserObject uo = (TreeUserObject) node.getUserObject();
uo.setValue(value);
DefaultTreeModel dtm = (DefaultTreeModel) tree.getModel();
dtm.nodeChanged(node);
}
}
class CodeDocumentListener implements DocumentListener {
JTextComponent code;
JTree tree;
String codeProperty;
String parentCodeProperty;
public CodeDocumentListener(JTextComponent code, JTree tree, String codeProperty, String parentCodeProperty) {
this.code = code;
this.tree = tree;
this.codeProperty = codeProperty;
this.parentCodeProperty = parentCodeProperty;
}
@Override
public void insertUpdate(DocumentEvent e) {
syncChildParentCode();
}
@Override
public void removeUpdate(DocumentEvent e) {
syncChildParentCode();
}
@Override
public void changedUpdate(DocumentEvent e) {
syncChildParentCode();
}
void syncChildParentCode() {
String value = code.getText();
DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
if (node == null) {
return;
}
TreeUserObject tuo = (TreeUserObject) node.getUserObject();
if (tuo != null && tuo.getObject() != null) {
syncChildParentCode(node, value);
}
}
private void syncChildParentCode(DefaultMutableTreeNode node, Object value) {
if (node.getChildCount() > 0 && value != null) {
for (int i = 0; i < node.getChildCount(); i++) {
DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) node.getChildAt(i);
TreeUserObject tuo = (TreeUserObject) childNode.getUserObject();
if (tuo != null && tuo.getObject() != null) {
try {
PropertyUtils.setProperty(tuo.getObject(), parentCodeProperty, value);
syncChildParentCode(childNode, PropertyUtils.getSimpleProperty(tuo.getObject(), codeProperty));
} catch (IllegalAccessException ex) {
throw new BasicDataException(ex.getMessage(), ex);
} catch (InvocationTargetException ex) {
throw new BasicDataException(ex.getMessage(), ex);
} catch (NoSuchMethodException ex) {
throw new BasicDataException(ex.getMessage(), ex);
}
}
}
}
}
}
private void syncComboBoxItem(Object entity) {
if (this.propertyBindingMappping != null) {
for (Entry<String, JComponent> entry : propertyBindingMappping.entrySet()) {
String propertyName = entry.getKey();
JComponent comp = entry.getValue();
if (comp instanceof JComboBox) {
this.setComboBoxItem((JComboBox) comp, treeBasicDataBL.getPropertyValue(entity, propertyName));
}
}
}
}
private void setComboBoxItem(JComboBox cb, Object value) {
if (value == null || cb == null) {
return;
}
int count = cb.getItemCount();
for (int i = 0; i < count; i++) {
if (cb.getItemAt(i) instanceof ListItem) {
ListItem item = (ListItem) cb.getItemAt(i);
if (item.getCode() != null && item.getCode().equals(value)) {
cb.setSelectedIndex(i);
return;
}
}
}
}
class BasicDataDefineTreeTSL implements TreeSelectionListener {
private TreePath curPath = null;
@Override
public void valueChanged(TreeSelectionEvent e) {
JTree tree = (JTree) e.getSource();
//判断原来的基础数据是否已保存
TreePath old = e.getOldLeadSelectionPath();
if (old != null) {
DefaultMutableTreeNode oldNode = (DefaultMutableTreeNode) old.getLastPathComponent();
TreeUserObject uo = (TreeUserObject) oldNode.getUserObject();
if (uo.getObject() != null) {
BasicDataDefine basicDataDefine = (BasicDataDefine) uo.getObject();
if (basicDataDefine instanceof CompoundBasicDataDefine) {
//compoundBasicDataBL = this.getCompoundBasicDataBL((CompoundBasicDataDefine) basicDataDefine);
} else if (basicDataDefine instanceof TreeBasicDataDefine) {
if (treeBasicDataBL != null) {
//MessageBox.confirm(""+treeBasicDataBL.isDirty());
}
} else {
//tablebl = getTableBasicDataBL(basicDataDefine);
}
}
}
DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
if (node == null) {
return;
}
TreeUserObject uo = (TreeUserObject) node.getUserObject();
if (uo == null) {
return;
}
if (uo.getObject() == null) {
return;
}
BasicDataDefine bd = (BasicDataDefine) uo.getObject();
modifyBasicData(bd);
}
}
// @Action(code = "001003")
// public void modify() {
// DefaultMutableTreeNode node = (DefaultMutableTreeNode) basicDataDefineTree.getLastSelectedPathComponent();
// if (node == null || node.isRoot() == true || !node.isLeaf() || node.getUserObject() == null || !(node.getUserObject() instanceof TreeUserObject)) {
// this.showMessageDialog("请选择要修改的基础数据。");
// return;
// }
// //treeBasicDataEditSplitPane.setr
// BasicData basicData = (BasicData) ((TreeUserObject) node.getUserObject()).getObject();
// if (basicData != null) {
// this.setParam("basicData", basicData);
// if (basicData instanceof TreeBasicData) {
// this.showModalView(EditTreeBasicDataView.class);
// }
// }
// }
Map<BasicDataDefine, TreeBasicDataBL> treeBasicDataBLMap = new HashMap<BasicDataDefine, TreeBasicDataBL>();
//tablebl
Map<BasicDataDefine, TableBasicDataBL> tableBasicDataBLMap = new HashMap<BasicDataDefine, TableBasicDataBL>();
public void modifyBasicData(BasicDataDefine basicDataDefine) {
this.basicDataDefine = basicDataDefine;
if (basicDataDefine == null) {
throw new BasicDataException("TABLE BASIC DATA 不允许为空");
}
if (basicDataDefine instanceof CompoundBasicDataDefine) {
this.compoundBasicDataBL = this.getCompoundBasicDataBL((CompoundBasicDataDefine) basicDataDefine);
this.masterSplitPane.setRightComponent(this.compoundSplitPane);
} else if (basicDataDefine instanceof TreeBasicDataDefine) {
treeBasicDataBL = getTreeBasicDataBL((TreeBasicDataDefine) basicDataDefine);
treeBasicDataBL.initTree();
this.masterSplitPane.setRightComponent(this.treeBasicDataEditPane);
} else {
tablebl = getTableBasicDataBL(basicDataDefine);
Class entityClass = basicDataDefine.getEntityClass();
tablebl.initTable(entityClass, mainTable, queryPanel);
this.masterSplitPane.setRightComponent(this.tableBasicDataEditPane);
}
}
@Action
public void clear() {
conditionTree.setText(null);
search();
}
@Action
public void close() {
closeView(true);
}
@Action
public void search() {
try {
if (basicDataDefine instanceof TreeBasicDataDefine) {
SearchOperation operationType = (SearchOperation) ((ListItem) operationTree.getSelectedItem()).getCode();
String conditionStr = conditionTree.getText();
if (StringUtils.isEmpty(conditionStr)) {
basicDataTree.setModel(new DefaultTreeModel(treeBasicDataBL.initTree()));
} else {
basicDataTree.setModel(new DefaultTreeModel(treeBasicDataBL.searchTree(conditionStr, operationType)));
}
}
} catch (Exception ex) {
logger.log(Level.SEVERE, ex.getMessage(), ex);
MessageBox.showError(ex.getMessage());
}
}
@Action
public void reset() {
conditionTextField.setText(null);
query();
}
@Action
public void add() {
Class entityClass = basicDataDefine.getEntityClass();
try {
Object entity = entityClass.newInstance();
EditBasicDataTableView editView = new EditBasicDataTableView(tablebl, entity, entityClass);
ModalResult modalResult = this.showModalView(editView);
//
if (ModalResult.OK.equals(modalResult)) {
TableUtils.appendRow(mainTable, entity);
}
} catch (InstantiationException ex) {
ex.printStackTrace();
} catch (IllegalAccessException ex) {
ex.printStackTrace();
}
}
@Action
public void delete() {
Object sc = TableUtils.getSelectedRow(mainTable);
if (sc != null) {
int result = JOptionPane.showConfirmDialog(null, "确认删除记录吗?",
"确认删除", JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.NO_OPTION) {
return;
}
TableUtils.deleteRow(mainTable, sc);
} else {
MessageBox.showError("请选择一行记录!");
// JOptionPane.showMessageDialog(
// null,
// "请选择一行记录!",
// "警告信息",
// JOptionPane.WARNING_MESSAGE);
}
}
@Action
public void modifyTable() {
Object selectedRow = TableUtils.getSelectedRow(mainTable);
Class entityClass = basicDataDefine.getEntityClass();
if (selectedRow == null) {
MessageBox.showError("请选择要修改的数据。");
return;
}
//避免选中多个,此时定位到第一个
mainTable.getSelectionModel().clearSelection();
TableUtils.setSelectedRow(mainTable, selectedRow);
boolean isAdd = TableUtils.isAdded(mainTable, selectedRow);
EditBasicDataTableView editView = new EditBasicDataTableView(tablebl, selectedRow, entityClass);
ModalResult modalResult = showModalView(editView);
if (ModalResult.OK.equals(modalResult)) {
if (isAdd) {
TableUtils.deleteRow(mainTable, selectedRow);
} else {
TableUtils.updateRow(mainTable, selectedRow);
}
}
}
@Action
public boolean saveTableData() {
Class entityClass = basicDataDefine.getEntityClass();
ModifiedTableData mtd = ModifiedTableDataUtils.buildModifiedTableData(mainTable);
String pk = basicDataDefine.getCodePropertyName();
service.write(entityClass, mtd, pk);
//清除状态
TableUtils.getObjectTableModel(mainTable).reset();
return true;
}
@Override
@Action
public boolean save() {
if (basicDataDefine != null) {
try {
if (basicDataDefine instanceof TreeBasicDataDefine) {
TreeBasicDataBL treeBL = this.getTreeBasicDataBL((TreeBasicDataDefine) basicDataDefine);
treeBL.saveAll();
} else if (basicDataDefine instanceof CompoundBasicDataDefine) {
this.getCompoundBasicDataBL((CompoundBasicDataDefine) basicDataDefine).saveAll();
} else {
saveTableData();
}
} catch (Exception ex) {
MessageBox.showError("保存失败.");
return false;
}
MessageBox.prompt("保存成功");
return true;
}
return true;
}
private OrFilterItem filterItem;
@Action
public void query() {
String condittion = conditionTextField.getText();
String operation = (String) ((ListItem) operationComboBox.getSelectedItem()).getCode();
FilterType filterType = null;
if (TableDataHelper.COMPARATE_TYPE_EQUALS.equals(operation)) {
filterType = FilterType.EQUAL;
} else if (TableDataHelper.COMPARATE_TYPE_LLIKE.equals(operation)) {
filterType = FilterType.END_WITH;
} else if (TableDataHelper.COMPARATE_TYPE_RLIKE.equals(operation)) {
filterType = FilterType.START_WITH;
} else {
filterType = FilterType.CONTAIN;
}
System.out.println("filterType:" + filterType);
if (filterItem != null) {
TableUtils.removeFilter(mainTable, filterItem);
}
if (StringUtils.isNotEmpty(condittion)) {
filterItem = new OrFilterItem(new SimpleFilterItem(basicDataDefine.getCodePropertyName(), filterType, condittion));
filterItem.or(new SimpleFilterItem(basicDataDefine.getNamePropertyName(), filterType, condittion));
TableUtils.setFilter(mainTable, filterItem);
}
// if (mainTableDataSet.isOpen()) {
// mainTableDataSet.post();
// }
// if (mainTableDataSet.getRow() >= 0) {
// UniversalData params = new UniversalDataImpl();
// params.addObject("EntityClass").setValue(basicData.getEntityClass());
// params.addValue("condittionCode").set(condittion);
// params.addValue("operationCode").set(operation);
// params.addValue("CodePropertyName").set(basicData.getCodePropertyName());
// params.addValue("NamePropertyName").set(basicData.getNamePropertyName());
// read(READ_QUERY, params, mainTableDataSet);
// }
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
emptyPanel = new javax.swing.JPanel();
treeBasicDataEditPane = new javax.swing.JScrollPane();
splitPane1 = new javax.swing.JSplitPane();
leftPanel = new javax.swing.JPanel();
searchPanel = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
operationTree = new javax.swing.JComboBox();
clearTreeButton = new javax.swing.JButton();
searchTreeButton = new javax.swing.JButton();
conditionTree = new javax.swing.JTextField();
jScrollPane2 = new javax.swing.JScrollPane();
basicDataTree = new org.itown.rcp.client.util.DnDTree();
rightPanel = new javax.swing.JPanel();
buttonPanel = new javax.swing.JPanel();
saveAllTreeButton = new javax.swing.JButton();
deleteTreeButton = new javax.swing.JButton();
addChildTreeButton = new javax.swing.JButton();
jScrollPane5 = new javax.swing.JScrollPane();
detailPanel = new javax.swing.JPanel();
compoundEditPane = new javax.swing.JScrollPane();
compoundSplitPane = new javax.swing.JSplitPane();
compoundLeftPanel = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
compoundCategoryTree = new javax.swing.JTree();
jPanel2 = new javax.swing.JPanel();
modifyCompoundCategoryButton = new javax.swing.JButton();
addCompoundCategoryButton = new javax.swing.JButton();
delCompoundCategoryButton = new javax.swing.JButton();
compoundRightPanel = new javax.swing.JPanel();
jScrollPane4 = new javax.swing.JScrollPane();
compoundItemTable = new javax.swing.JTable();
jPanel1 = new javax.swing.JPanel();
modifyCompoundItemButton = new javax.swing.JButton();
delCompoundItemButton = new javax.swing.JButton();
addCompoundItemButton = new javax.swing.JButton();
tableBasicDataEditPane = new javax.swing.JScrollPane();
viewPanel = new javax.swing.JPanel();
addButton = new javax.swing.JButton();
modifyButton = new javax.swing.JButton();
deleteButton = new javax.swing.JButton();
saveButton = new javax.swing.JButton();
mainTableScrollPanel = new javax.swing.JScrollPane();
mainTable = new javax.swing.JTable();
queryPanel = new javax.swing.JPanel();
queryButton = new javax.swing.JButton();
clearButton = new javax.swing.JButton();
conditionTextField = new javax.swing.JTextField();
operationComboBox = new javax.swing.JComboBox();
conditionLabel = new javax.swing.JLabel();
masterPanel = new javax.swing.JPanel();
masterSplitPane = new javax.swing.JSplitPane();
jScrollPane1 = new javax.swing.JScrollPane();
basicDataDefineTree = new javax.swing.JTree();
javax.swing.GroupLayout emptyPanelLayout = new javax.swing.GroupLayout(emptyPanel);
emptyPanel.setLayout(emptyPanelLayout);
emptyPanelLayout.setHorizontalGroup(
emptyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
emptyPanelLayout.setVerticalGroup(
emptyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
splitPane1.setDividerLocation(260);
jLabel1.setText("编码或名称:");
operationTree.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
clearTreeButton.setAction(getAction("clear"));
clearTreeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/congzhi.gif"))); // NOI18N
clearTreeButton.setText("重置");
searchTreeButton.setAction(getAction("search"));
searchTreeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/search.gif"))); // NOI18N
searchTreeButton.setText("查询");
searchTreeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
searchTreeButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout searchPanelLayout = new javax.swing.GroupLayout(searchPanel);
searchPanel.setLayout(searchPanelLayout);
searchPanelLayout.setHorizontalGroup(
searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(searchPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, searchPanelLayout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(operationTree, 0, 71, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
.addComponent(conditionTree, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(searchPanelLayout.createSequentialGroup()
.addComponent(searchTreeButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(clearTreeButton)))
.addContainerGap())
);
searchPanelLayout.setVerticalGroup(
searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(searchPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(operationTree, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(conditionTree, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(clearTreeButton)
.addComponent(searchTreeButton))
.addContainerGap())
);
//basicDataTree.setProcessor(new UserObjectProcessor(){
// public void process(DefaultMutableTreeNode droppedNode,DefaultMutableTreeNode dropNode){
// TreeUserObject tuo = droppedNode.getUserObject();
// TreeUserObject target = dropNode.getUserObject();
//
// System.out.println(""+tuo+","+target);
//
// }
//});
jScrollPane2.setViewportView(basicDataTree);
javax.swing.GroupLayout leftPanelLayout = new javax.swing.GroupLayout(leftPanel);
leftPanel.setLayout(leftPanelLayout);
leftPanelLayout.setHorizontalGroup(
leftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(searchPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 259, Short.MAX_VALUE)
);
leftPanelLayout.setVerticalGroup(
leftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(leftPanelLayout.createSequentialGroup()
.addComponent(searchPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE))
);
splitPane1.setLeftComponent(leftPanel);
saveAllTreeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/save.gif"))); // NOI18N
saveAllTreeButton.setText("保存");
deleteTreeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/delete.gif"))); // NOI18N
deleteTreeButton.setText("删除");
addChildTreeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/add.gif"))); // NOI18N
addChildTreeButton.setText("增加子节点");
addChildTreeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addChildTreeButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout buttonPanelLayout = new javax.swing.GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
buttonPanelLayout.setHorizontalGroup(
buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
.addContainerGap(113, Short.MAX_VALUE)
.addComponent(addChildTreeButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deleteTreeButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(saveAllTreeButton)
.addContainerGap())
);
buttonPanelLayout.setVerticalGroup(
buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(saveAllTreeButton)
.addComponent(deleteTreeButton)
.addComponent(addChildTreeButton))
.addContainerGap())
);
javax.swing.GroupLayout detailPanelLayout = new javax.swing.GroupLayout(detailPanel);
detailPanel.setLayout(detailPanelLayout);
detailPanelLayout.setHorizontalGroup(
detailPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 408, Short.MAX_VALUE)
);
detailPanelLayout.setVerticalGroup(
detailPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 333, Short.MAX_VALUE)
);
jScrollPane5.setViewportView(detailPanel);
javax.swing.GroupLayout rightPanelLayout = new javax.swing.GroupLayout(rightPanel);
rightPanel.setLayout(rightPanelLayout);
rightPanelLayout.setHorizontalGroup(
rightPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(rightPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE))
);
rightPanelLayout.setVerticalGroup(
rightPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, rightPanelLayout.createSequentialGroup()
.addContainerGap(339, Short.MAX_VALUE)
.addComponent(buttonPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(rightPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(rightPanelLayout.createSequentialGroup()
.addComponent(jScrollPane5)
.addGap(47, 47, 47)))
);
splitPane1.setRightComponent(rightPanel);
treeBasicDataEditPane.setViewportView(splitPane1);
compoundSplitPane.setDividerLocation(260);
compoundSplitPane.setPreferredSize(new java.awt.Dimension(862, 342));
jScrollPane3.setViewportView(compoundCategoryTree);
modifyCompoundCategoryButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/edit.gif"))); // NOI18N
modifyCompoundCategoryButton.setText("修改");
addCompoundCategoryButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/add.gif"))); // NOI18N
addCompoundCategoryButton.setText("增加");
delCompoundCategoryButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/delete.gif"))); // NOI18N
delCompoundCategoryButton.setText("删除");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(addCompoundCategoryButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(modifyCompoundCategoryButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(delCompoundCategoryButton)
.addGap(6, 6, 6))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(addCompoundCategoryButton)
.addComponent(modifyCompoundCategoryButton)
.addComponent(delCompoundCategoryButton))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout compoundLeftPanelLayout = new javax.swing.GroupLayout(compoundLeftPanel);
compoundLeftPanel.setLayout(compoundLeftPanelLayout);
compoundLeftPanelLayout.setHorizontalGroup(
compoundLeftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)
);
compoundLeftPanelLayout.setVerticalGroup(
compoundLeftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, compoundLeftPanelLayout.createSequentialGroup()
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 289, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
compoundSplitPane.setLeftComponent(compoundLeftPanel);
compoundRightPanel.setPreferredSize(new java.awt.Dimension(596, 240));
compoundItemTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane4.setViewportView(compoundItemTable);
modifyCompoundItemButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/edit.gif"))); // NOI18N
modifyCompoundItemButton.setText("修改");
delCompoundItemButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/delete.gif"))); // NOI18N
delCompoundItemButton.setText("删除");
delCompoundItemButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
delCompoundItemButtonActionPerformed(evt);
}
});
addCompoundItemButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/add.gif"))); // NOI18N
addCompoundItemButton.setText("增加");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(343, Short.MAX_VALUE)
.addComponent(addCompoundItemButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(modifyCompoundItemButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(delCompoundItemButton)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(delCompoundItemButton)
.addComponent(modifyCompoundItemButton)
.addComponent(addCompoundItemButton))
.addContainerGap(13, Short.MAX_VALUE))
);
javax.swing.GroupLayout compoundRightPanelLayout = new javax.swing.GroupLayout(compoundRightPanel);
compoundRightPanel.setLayout(compoundRightPanelLayout);
compoundRightPanelLayout.setHorizontalGroup(
compoundRightPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 596, Short.MAX_VALUE)
);
compoundRightPanelLayout.setVerticalGroup(
compoundRightPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(compoundRightPanelLayout.createSequentialGroup()
.addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
compoundSplitPane.setRightComponent(compoundRightPanel);
compoundEditPane.setViewportView(compoundSplitPane);
addButton.setAction(getAction("add"));
addButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/add.gif"))); // NOI18N
addButton.setText("增加");
modifyButton.setAction(getAction("modifyTable"));
modifyButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/edit.gif"))); // NOI18N
modifyButton.setText("修改");
deleteButton.setAction(getAction("delete"));
deleteButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/delete.gif"))); // NOI18N
deleteButton.setText("删除");
saveButton.setAction(getAction("save"));
saveButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/save.gif"))); // NOI18N
saveButton.setText("保存");
mainTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
mainTableScrollPanel.setViewportView(mainTable);
queryButton.setAction(getAction("query"));
queryButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/search.gif"))); // NOI18N
queryButton.setText("查询");
clearButton.setAction(getAction("reset"));
clearButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16_16/congzhi.gif"))); // NOI18N
clearButton.setText("重置");
Map items = new LinkedMap();
items.put(TableDataHelper.COMPARATE_TYPE_LIKE, "包含");
items.put(TableDataHelper.COMPARATE_TYPE_LLIKE, "左匹配");
items.put(TableDataHelper.COMPARATE_TYPE_RLIKE, "右匹配");
items.put(TableDataHelper.COMPARATE_TYPE_EQUALS, "等于");
operationComboBox.setModel(new MapComboBoxModel(items,false));
conditionLabel.setText("编码或名称:");
javax.swing.GroupLayout queryPanelLayout = new javax.swing.GroupLayout(queryPanel);
queryPanel.setLayout(queryPanelLayout);
queryPanelLayout.setHorizontalGroup(
queryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(queryPanelLayout.createSequentialGroup()
.addComponent(conditionLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(operationComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(conditionTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(queryButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(clearButton)
.addContainerGap())
);
queryPanelLayout.setVerticalGroup(
queryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(queryPanelLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(queryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(conditionLabel)
.addComponent(operationComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(conditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(clearButton)
.addComponent(queryButton)))
);
javax.swing.GroupLayout viewPanelLayout = new javax.swing.GroupLayout(viewPanel);
viewPanel.setLayout(viewPanelLayout);
viewPanelLayout.setHorizontalGroup(
viewPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, viewPanelLayout.createSequentialGroup()
.addContainerGap(449, Short.MAX_VALUE)
.addComponent(addButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(modifyButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deleteButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(saveButton)
.addContainerGap())
.addComponent(queryPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(viewPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mainTableScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 785, Short.MAX_VALUE))
);
viewPanelLayout.setVerticalGroup(
viewPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, viewPanelLayout.createSequentialGroup()
.addComponent(queryPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 288, Short.MAX_VALUE)
.addGroup(viewPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(saveButton)
.addComponent(deleteButton)
.addComponent(modifyButton)
.addComponent(addButton)))
.addGroup(viewPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(viewPanelLayout.createSequentialGroup()
.addGap(37, 37, 37)
.addComponent(mainTableScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 284, Short.MAX_VALUE)
.addGap(27, 27, 27)))
);
this.setComponent(viewPanel);
tableBasicDataEditPane.setViewportView(viewPanel);
masterSplitPane.setDividerLocation(300);
jScrollPane1.setViewportView(basicDataDefineTree);
masterSplitPane.setLeftComponent(jScrollPane1);
javax.swing.GroupLayout masterPanelLayout = new javax.swing.GroupLayout(masterPanel);
masterPanel.setLayout(masterPanelLayout);
masterPanelLayout.setHorizontalGroup(
masterPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(masterSplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 893, Short.MAX_VALUE)
);
masterPanelLayout.setVerticalGroup(
masterPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(masterSplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 431, Short.MAX_VALUE)
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(masterPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(5, 5, 5)
.addComponent(masterPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
}// </editor-fold>
private void addChildTreeButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void searchTreeButtonActionPerformed(java.awt.event.ActionEvent evt) {
searchTree();
}
private void delCompoundItemButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
// Variables declaration - do not modify
private javax.swing.JButton addButton;
private javax.swing.JButton addChildTreeButton;
private javax.swing.JButton addCompoundCategoryButton;
private javax.swing.JButton addCompoundItemButton;
private javax.swing.JTree basicDataDefineTree;
private org.itown.rcp.client.util.DnDTree basicDataTree;
private javax.swing.JPanel buttonPanel;
private javax.swing.JButton clearButton;
private javax.swing.JButton clearTreeButton;
private javax.swing.JTree compoundCategoryTree;
private javax.swing.JScrollPane compoundEditPane;
private javax.swing.JTable compoundItemTable;
private javax.swing.JPanel compoundLeftPanel;
private javax.swing.JPanel compoundRightPanel;
private javax.swing.JSplitPane compoundSplitPane;
private javax.swing.JLabel conditionLabel;
private javax.swing.JTextField conditionTextField;
private javax.swing.JTextField conditionTree;
private javax.swing.JButton delCompoundCategoryButton;
private javax.swing.JButton delCompoundItemButton;
private javax.swing.JButton deleteButton;
private javax.swing.JButton deleteTreeButton;
private javax.swing.JPanel detailPanel;
private javax.swing.JPanel emptyPanel;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JScrollPane jScrollPane5;
private javax.swing.JPanel leftPanel;
private javax.swing.JTable mainTable;
private javax.swing.JScrollPane mainTableScrollPanel;
private javax.swing.JPanel masterPanel;
private javax.swing.JSplitPane masterSplitPane;
private javax.swing.JButton modifyButton;
private javax.swing.JButton modifyCompoundCategoryButton;
private javax.swing.JButton modifyCompoundItemButton;
private javax.swing.JComboBox operationComboBox;
private javax.swing.JComboBox operationTree;
private javax.swing.JButton queryButton;
private javax.swing.JPanel queryPanel;
private javax.swing.JPanel rightPanel;
private javax.swing.JButton saveAllTreeButton;
private javax.swing.JButton saveButton;
private javax.swing.JPanel searchPanel;
private javax.swing.JButton searchTreeButton;
private javax.swing.JSplitPane splitPane1;
private javax.swing.JScrollPane tableBasicDataEditPane;
private javax.swing.JScrollPane treeBasicDataEditPane;
private javax.swing.JPanel viewPanel;
// End of variables declaration
private Logger logger = Logger.getLogger(this.getClass().getName());
@Action
public void addCompoundItem() {
if (this.curCategory == null) {
MessageBox.showError("请选择要操作的类别。");
return;
}
SysCompound newItem = new SysCompound();
newItem.setCategory(curCategory.getCategory());
newItem.setParentId(curCategory.getCompoundId());
newItem.setCompoundId(UUIDKeyGenerator.newInstance().generateKey());
ModifyCompoundView modifyCompoundView = new ModifyCompoundView(newItem, ModifyCompoundView.STATUS_ADD, true);
ModalResult result = this.showModalView(modifyCompoundView);
if (ModalResult.OK.equals(result)) {
newItem = modifyCompoundView.getCompound();
this.compoundItems.add(newItem);
this.compoundBasicDataBL.addItemToCache(newItem);
//this.handler.addNewObject(newSchema);
int lastIndex = compoundItems.size() - 1;
this.compoundItemTable.setRowSelectionInterval(lastIndex, lastIndex);
}
}
@Action
public void modifyCompoundItem() {
if (this.curCategory == null) {
MessageBox.showError("请选择要操作的类别。");
return;
}
int selectedRow = this.compoundItemTable.getSelectedRow();
if (selectedRow >= 0) {
SysCompound modifySchema = (SysCompound) this.compoundItems.get(selectedRow);
ModifyCompoundView modifyView = new ModifyCompoundView(modifySchema, ModifyCompoundView.STATUS_MODIFY, true);
ModalResult result = this.showModalView(modifyView);
if (ModalResult.OK.equals(result)) {
modifySchema = modifyView.getCompound();
compoundItems.remove(modifySchema);
compoundItems.add(selectedRow, modifySchema);
compoundItemTable.setRowSelectionInterval(selectedRow, selectedRow);
MessageBox.prompt("修改成功!");
}
} else {
MessageBox.showError("请选择要修改的数据。");
}
}
@Action
public void delCompoundItem() {
int selectedRow = this.compoundItemTable.getSelectedRow();
if (selectedRow >= 0) {
int isOk = this.showConfirmDialog("您确认要删除这条记录吗?");
if (1 == isOk) {
try {
SysCompound compound = (SysCompound) compoundItems.get(selectedRow);
delCompound(compound);
compoundBasicDataBL.removeCompoundFromCache(compound);
compoundItems.remove(selectedRow);
if (selectedRow < compoundItems.size()) {
compoundItemTable.getSelectionModel().setSelectionInterval(selectedRow, selectedRow);
} else if ((selectedRow - 1) >= 0) {
selectedRow--;
compoundItemTable.getSelectionModel().setSelectionInterval(selectedRow, selectedRow);
}
MessageBox.prompt("删除成功!");
} catch (Exception ex) {
MessageBox.showError(ex.getMessage());
}
}
} else {
MessageBox.prompt("请选择要删除的列。");
}
}
/**
* 删除数据
*
* @param obj
* @param deleteChildren
*/
public void delCompound(Object obj) {
// UniversalData params = new UniversalDataImpl();
// params.addObject("entity").setValue(obj);
// params.addValue("deleteChildren").set(true);
// params.addValue("codeProperty").set("compoundId");
// params.addValue("parentCodeProperty").set("parentId");
// invoke("basicdataService", "deleteBasicData", params);
service.removeEntity(obj, "compoundId", "parentId", true);
}
@Action
public void delCompoundCategory() {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) this.compoundCategoryTree.getLastSelectedPathComponent();
if (node == null) {
MessageBox.showError("请选择要删除的类别");
return;
}
if (node.isRoot() == true) {
MessageBox.showError("不能删除根节点");
return;
}
int isOk = this.showConfirmDialog("您确认要删除当前类别吗?");
if (1 == isOk) {
try {
TreeUserObject uo = (TreeUserObject) node.getUserObject();
SysCompound delSchema = (SysCompound) uo.getObject();
this.delCompound(delSchema);
JTreeHelper.removeNode(compoundCategoryTree, node);
MessageBox.prompt("类别" + delSchema.getName() + "已删除。");
} catch (Exception ex) {
logger.log(Level.SEVERE, ex.getMessage(), ex);
MessageBox.showError("类别删除失败:" + ex.getMessage());
}
}
}
@Action
public void modifyCompoundCategory() {
if (this.curCategory == null) {
MessageBox.showError("请选择要操作的类别。");
return;
}
DefaultMutableTreeNode node = (DefaultMutableTreeNode) this.compoundCategoryTree.getLastSelectedPathComponent();
SysCompound modifyCategory = curCategory;
ModifyCompoundView modifyView = new ModifyCompoundView(modifyCategory, ModifyCompoundView.STATUS_MODIFY, false);
ModalResult result = this.showModalView(modifyView);
if (ModalResult.OK.equals(result)) {
curCategory = modifyView.getCompound();
((TreeUserObject) node.getUserObject()).setValue(curCategory.getName());
DefaultTreeModel model = (DefaultTreeModel) compoundCategoryTree.getModel();
model.nodeChanged(node);
MessageBox.prompt("修改成功!");
}
}
@Action
public void addCompoundCategory() {
ModifyCompoundView midifyCompoundView = new ModifyCompoundView(null, ModifyCompoundView.STATUS_ADD, false);
ModalResult modalResult = this.showModalView(midifyCompoundView);
if (ModalResult.OK.equals(modalResult)) {
SysCompound newCategory = midifyCompoundView.getCompound();
DefaultTreeModel model = (DefaultTreeModel) this.compoundCategoryTree.getModel();
|