📄 abstractmeasureunitlistui.java
字号:
package com.cownew.PIS.basedata.client;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTable;
import javax.swing.JToolBar;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import com.cownew.PIS.framework.client.MainFrame;
import com.cownew.PIS.ui.base.ExceptionHandler;
import com.cownew.PIS.ui.commonUI.ListUI;
import com.cownew.PIS.ui.utils.PISAbstractAction;
import com.cownew.ctk.ui.swing.BeanListCellRenderer;
abstract public class AbstractMeasureUnitListUI extends ListUI
{
private JSplitPane splitPane;
private JPanel panelLeft;
private JPanel panelRight;
private JToolBar toolBarLeft;
private JList listLeft;
private JScrollPane jScrollPane;
private JTable tableMain;
private JButton btnLeftAddNew;
private JButton btnLeftEdit;
private JButton btnLeftDelete;
protected ActionLeftAddNew actionLeftAddNew;
protected ActionLeftEdit actionLeftEdit;
protected ActionLeftDelete actionLeftDelete;
protected ActionSetBaseUnit actionSetBaseUnit;
public AbstractMeasureUnitListUI() throws Exception
{
super();
}
protected void initialize()
{
super.initialize();
this.setLayout(new BorderLayout());
this.setSize(new Dimension(598, 221));
add(getSplitPane(), BorderLayout.CENTER);
}
protected void initAction()
{
super.initAction();
actionLeftAddNew = new ActionLeftAddNew("新增");
actionLeftEdit = new ActionLeftEdit("编辑");
actionLeftDelete = new ActionLeftDelete("删除");
actionSetBaseUnit = new ActionSetBaseUnit("设为基本计量单位");
}
protected void initToolBar(JToolBar tBar)
{
super.initToolBar(tBar);
JButton btnSetBaseUnit = new JButton();
btnSetBaseUnit.setAction(actionSetBaseUnit);
tBar.add(btnSetBaseUnit);
}
/**
* This method initializes splitPane
*
* @return javax.swing.JSplitPane
*/
private JSplitPane getSplitPane()
{
if (splitPane == null)
{
splitPane = new JSplitPane();
splitPane.setLeftComponent(getPanelLeft());
splitPane.setRightComponent(getPanelRight());
splitPane
.setDividerLocation(MainFrame.getMainFrame().getWidth() / 6);
}
return splitPane;
}
/**
* This method initializes panelLeft
*
* @return javax.swing.JPanel
*/
private JPanel getPanelLeft()
{
if (panelLeft == null)
{
panelLeft = new JPanel();
panelLeft.setLayout(new BorderLayout());
panelLeft.add(getToolBarLeft(), BorderLayout.NORTH);
panelLeft.add(getListLeft(), BorderLayout.CENTER);
}
return panelLeft;
}
/**
* This method initializes panelRight
*
* @return javax.swing.JPanel
*/
private JPanel getPanelRight()
{
if (panelRight == null)
{
panelRight = new JPanel();
panelRight.setLayout(new BorderLayout());
panelRight.add(getJScrollPane(), BorderLayout.CENTER);
}
return panelRight;
}
/**
* This method initializes toolBarLeft
*
* @return javax.swing.JToolBar
*/
private JToolBar getToolBarLeft()
{
if (toolBarLeft == null)
{
toolBarLeft = new JToolBar();
toolBarLeft.setFloatable(false);
toolBarLeft.setPreferredSize(new Dimension(20, 20));
toolBarLeft.add(getBtnLeftAddNew());
toolBarLeft.add(getBtnLeftEdit());
toolBarLeft.add(getBtnLeftDelete());
}
return toolBarLeft;
}
/**
* This method initializes listLeft
*
* @return javax.swing.JList
*/
protected JList getListLeft()
{
if (listLeft == null)
{
listLeft = new JList();
listLeft.setCellRenderer(new BeanListCellRenderer("name"));
listLeft.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e)
{
if (e.getValueIsAdjusting() == false)
{
try
{
listLeft_SelectChanged();
} catch (Exception ex)
{
ExceptionHandler.handle(ex);
}
}
}
});
}
return listLeft;
}
protected void listLeft_SelectChanged() throws Exception
{
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane()
{
if (jScrollPane == null)
{
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getTableMain());
}
return jScrollPane;
}
/**
* This method initializes tableMain
*
* @return javax.swing.JTable
*/
protected JTable getTableMain()
{
if (tableMain == null)
{
tableMain = new JTable();
}
return tableMain;
}
/**
* This method initializes btnLeftAddNew
*
* @return javax.swing.JButton
*/
private JButton getBtnLeftAddNew()
{
if (btnLeftAddNew == null)
{
btnLeftAddNew = new JButton();
btnLeftAddNew.setAction(actionLeftAddNew);
btnLeftAddNew.setText("新增");
}
return btnLeftAddNew;
}
/**
* This method initializes btnLeftEdit
*
* @return javax.swing.JButton
*/
private JButton getBtnLeftEdit()
{
if (btnLeftEdit == null)
{
btnLeftEdit = new JButton();
btnLeftEdit.setAction(actionLeftEdit);
btnLeftEdit.setText("编辑");
}
return btnLeftEdit;
}
/**
* This method initializes btnLeftDelete
*
* @return javax.swing.JButton
*/
private JButton getBtnLeftDelete()
{
if (btnLeftDelete == null)
{
btnLeftDelete = new JButton();
btnLeftDelete.setAction(actionLeftDelete);
btnLeftDelete.setText("删除");
}
return btnLeftDelete;
}
protected void actionLeftAddNew_onActionPerformed(ActionEvent e)
throws Exception
{
}
protected void actionLeftDelete_onActionPerformed(ActionEvent e)
throws Exception
{
}
protected void actionLeftEdit_onActionPerformed(ActionEvent e)
throws Exception
{
}
protected void actionSetBaseUnit_onActionPerformed(ActionEvent e)
throws Exception
{
}
protected class ActionLeftAddNew extends PISAbstractAction
{
public ActionLeftAddNew(String name, Icon icon)
{
super(name, icon);
}
public ActionLeftAddNew(String name)
{
super(name);
}
public void onActionPerformed(ActionEvent e) throws Exception
{
actionLeftAddNew_onActionPerformed(e);
}
}
protected class ActionLeftEdit extends PISAbstractAction
{
public ActionLeftEdit(String name, Icon icon)
{
super(name, icon);
}
public ActionLeftEdit(String name)
{
super(name);
}
public void onActionPerformed(ActionEvent e) throws Exception
{
actionLeftEdit_onActionPerformed(e);
}
}
protected class ActionLeftDelete extends PISAbstractAction
{
public ActionLeftDelete(String name, Icon icon)
{
super(name, icon);
}
public ActionLeftDelete(String name)
{
super(name);
}
public void onActionPerformed(ActionEvent e) throws Exception
{
actionLeftDelete_onActionPerformed(e);
}
}
protected class ActionSetBaseUnit extends PISAbstractAction
{
public ActionSetBaseUnit(String name, Icon icon)
{
super(name, icon);
}
public ActionSetBaseUnit(String name)
{
super(name);
}
public void onActionPerformed(ActionEvent e) throws Exception
{
actionSetBaseUnit_onActionPerformed(e);
}
}
} // @jve:decl-index=0:visual-constraint="10,10"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -