📄 abstractfilterui.java
字号:
package com.cownew.PIS.ui.commonUI.filterUI;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
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.utils.PISAbstractAction;
import com.cownew.ctk.ui.swing.BeanListCellRenderer;
import com.cownew.ctk.ui.swing.JCownewDialog;
abstract public class AbstractFilterUI extends JCownewDialog
{
private JPanel panelSolution;
private JPanel panelMain;
private JToolBar toolBarSolution;
private JButton btnAddNewSolution;
private JButton btnSaveSolution;
private JButton btnDeleteSolution;
private JScrollPane jScrollPane;
private JPanel panelButton;
private JTabbedPane panelTab;
private JButton btnOK;
private JButton btnCancel;
protected JList listSolution;
protected JScrollPane panelSysDef;
protected Component sysDefFilterComponent;
protected ActionAddNewSolution actionAddNewSolution;
protected ActionDelSolution actionDelSolution;
protected ActionSaveSolution actionSaveSolution;
protected static final String COL_PROPERTY = "属性";
protected static final String COL_SORTTYPE = "排序方式";
protected JPanel panelSort;
protected JToolBar toolBarSort;
protected JScrollPane jScrollPaneSort;
protected JTable tableSort;
protected JButton btnSortAddNew;
protected JButton btnSortDelete;
public AbstractFilterUI(Component sysDefFilterComponent)
{
super(MainFrame.getMainFrame(),true);
this.sysDefFilterComponent = sysDefFilterComponent;
setTitle("数据过滤");
initialize();
}
protected void initialize()
{
actionAddNewSolution = new ActionAddNewSolution("新增");
actionDelSolution = new ActionDelSolution("删除");
actionSaveSolution = new ActionSaveSolution("保存");
getContentPane().setLayout(new BorderLayout());
setSize(700, 300);
getContentPane().add(getPanelSolution(), BorderLayout.WEST);
getContentPane().add(getPanelMain(), BorderLayout.CENTER);
}
/**
* This method initializes panelSolution
*
* @return javax.swing.JPanel
*/
private JPanel getPanelSolution()
{
if (panelSolution == null)
{
panelSolution = new JPanel();
panelSolution.setLayout(new BorderLayout());
panelSolution.setPreferredSize(new Dimension(150, 50));
panelSolution.add(getToolBarSolution(), BorderLayout.NORTH);
panelSolution.add(getJScrollPane(), BorderLayout.CENTER);
}
return panelSolution;
}
/**
* This method initializes panelMain
*
* @return javax.swing.JPanel
*/
private JPanel getPanelMain()
{
if (panelMain == null)
{
panelMain = new JPanel();
panelMain.setLayout(new BorderLayout());
panelMain.add(getPanelButton(), BorderLayout.SOUTH);
panelMain.add(getPanelTab(), BorderLayout.CENTER);
}
return panelMain;
}
/**
* This method initializes toolBarSolution
*
* @return javax.swing.JToolBar
*/
private JToolBar getToolBarSolution()
{
if (toolBarSolution == null)
{
toolBarSolution = new JToolBar();
toolBarSolution.setFloatable(false);
toolBarSolution.setPreferredSize(new Dimension(10, 20));
toolBarSolution.add(getBtnAddNewSolution());
toolBarSolution.add(getBtnSaveSolution());
toolBarSolution.add(getBtnDeleteSolution());
}
return toolBarSolution;
}
/**
* This method initializes btnAddNew
*
* @return javax.swing.JButton
*/
private JButton getBtnAddNewSolution()
{
if (btnAddNewSolution == null)
{
btnAddNewSolution = new JButton();
btnAddNewSolution.setText("新增");
btnAddNewSolution.setAction(actionAddNewSolution);
}
return btnAddNewSolution;
}
/**
* This method initializes btnSave
*
* @return javax.swing.JButton
*/
private JButton getBtnSaveSolution()
{
if (btnSaveSolution == null)
{
btnSaveSolution = new JButton();
btnSaveSolution.setAction(actionSaveSolution);
btnSaveSolution.setText("保存");
}
return btnSaveSolution;
}
/**
* This method initializes btnDelete
*
* @return javax.swing.JButton
*/
private JButton getBtnDeleteSolution()
{
if (btnDeleteSolution == null)
{
btnDeleteSolution = new JButton();
btnDeleteSolution.setAction(actionDelSolution);
btnDeleteSolution.setText("删除");
}
return btnDeleteSolution;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane()
{
if (jScrollPane == null)
{
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getListSolution());
}
return jScrollPane;
}
/**
* This method initializes listSolution
*
* @return javax.swing.JList
*/
private JList getListSolution()
{
if (listSolution == null)
{
listSolution = new JList();
listSolution.setModel(new DefaultListModel());
listSolution.setCellRenderer(new BeanListCellRenderer("name"));
listSolution.addListSelectionListener(new ListSelectionListener(){
public void valueChanged(ListSelectionEvent e)
{
if(e.getValueIsAdjusting()==false)
{
try
{
listSolution_SelectChanged();
} catch (Exception ex)
{
ExceptionHandler.handle(ex);
}
}
}
});
}
return listSolution;
}
protected void listSolution_SelectChanged() throws Exception
{
}
/**
* This method initializes panelButton
*
* @return javax.swing.JPanel
*/
private JPanel getPanelButton()
{
if (panelButton == null)
{
panelButton = new JPanel();
panelButton.setLayout(new BorderLayout());
panelButton.setPreferredSize(new Dimension(0, 30));
panelButton.add(getBtnOK(), BorderLayout.WEST);
panelButton.add(getBtnCancel(), BorderLayout.EAST);
}
return panelButton;
}
/**
* This method initializes panelTab
*
* @return javax.swing.JTabbedPane
*/
private JTabbedPane getPanelTab()
{
if (panelTab == null)
{
panelTab = new JTabbedPane();
panelTab.addTab("预设条件", null, getPanelSysDef(), null);
panelTab.addTab("排序", null, getPanelSort(), null);
}
return panelTab;
}
/**
* This method initializes panelSysDef
*
* @return javax.swing.JPanel
*/
private JScrollPane getPanelSysDef()
{
if (panelSysDef == null)
{
panelSysDef = new JScrollPane();
panelSysDef.setViewportView(getSysDefFilterComponent());
}
return panelSysDef;
}
protected Component getSysDefFilterComponent()
{
return sysDefFilterComponent;
}
/**
* This method initializes btnOK
*
* @return javax.swing.JButton
*/
private JButton getBtnOK()
{
if (btnOK == null)
{
btnOK = createOKBtn();
btnOK.setText("确认");
}
return btnOK;
}
/**
* This method initializes btnCancel
*
* @return javax.swing.JButton
*/
private JButton getBtnCancel()
{
if (btnCancel == null)
{
btnCancel = createCancelBtn();
btnCancel.setText("取消");
}
return btnCancel;
}
protected class ActionAddNewSolution extends PISAbstractAction
{
public ActionAddNewSolution(String name, Icon icon)
{
super(name, icon);
}
public ActionAddNewSolution(String name)
{
super(name);
}
public void onActionPerformed(ActionEvent e) throws Exception
{
actionAddNewSolution_actionPerformed(e);
}
}
protected class ActionDelSolution extends PISAbstractAction
{
public void onActionPerformed(ActionEvent e) throws Exception
{
actionDelSolution_actionPerformed(e);
}
public ActionDelSolution(String name, Icon icon)
{
super(name, icon);
}
public ActionDelSolution(String name)
{
super(name);
}
}
protected class ActionSaveSolution extends PISAbstractAction
{
public void onActionPerformed(ActionEvent e) throws Exception
{
actionSaveSolution_actionPerformed(e);
}
public ActionSaveSolution(String name, Icon icon)
{
super(name, icon);
}
public ActionSaveSolution(String name)
{
super(name);
}
}
public void actionSaveSolution_actionPerformed(ActionEvent e) throws Exception
{
}
public void actionAddNewSolution_actionPerformed(ActionEvent e) throws Exception
{
}
public void actionDelSolution_actionPerformed(ActionEvent e) throws Exception
{
}
/**
* This method initializes panelSort
*
* @return javax.swing.JPanel
*/
private JPanel getPanelSort()
{
if (panelSort == null)
{
panelSort = new JPanel();
panelSort.setLayout(new BorderLayout());
panelSort.add(getToolBarSort(), BorderLayout.NORTH);
panelSort.add(getJScrollPaneSort(), BorderLayout.CENTER);
}
return panelSort;
}
/**
* This method initializes toolBarSort
*
* @return javax.swing.JToolBar
*/
private JToolBar getToolBarSort()
{
if (toolBarSort == null)
{
toolBarSort = new JToolBar();
toolBarSort.setFloatable(false);
toolBarSort.setPreferredSize(new Dimension(25, 25));
toolBarSort.add(getBtnSortAddNew());
toolBarSort.add(getBtnSortDelete());
}
return toolBarSort;
}
/**
* This method initializes jScrollPaneSort
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPaneSort()
{
if (jScrollPaneSort == null)
{
jScrollPaneSort = new JScrollPane();
jScrollPaneSort.setViewportView(getTableSort());
}
return jScrollPaneSort;
}
/**
* This method initializes tableSort
*
* @return javax.swing.JTable
*/
private JTable getTableSort()
{
if (tableSort == null)
{
tableSort = new JTable();
}
return tableSort;
}
/**
* This method initializes btnSortAddNew
*
* @return javax.swing.JButton
*/
private JButton getBtnSortAddNew()
{
if (btnSortAddNew == null)
{
btnSortAddNew = new JButton();
btnSortAddNew.setText("新增");
btnSortAddNew.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e)
{
btnSortAddNew_actionPerformed(e);
}
});
}
return btnSortAddNew;
}
/**
* This method initializes btnSortDelete
*
* @return javax.swing.JButton
*/
private JButton getBtnSortDelete()
{
if (btnSortDelete == null)
{
btnSortDelete = new JButton();
btnSortDelete.setText("删除");
btnSortDelete.setActionCommand("删除");
btnSortDelete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e)
{
btnSortDelete_actionPerformed(e);
}
});
}
return btnSortDelete;
}
protected void btnSortDelete_actionPerformed(ActionEvent e)
{
}
protected void btnSortAddNew_actionPerformed(ActionEvent e)
{
}
}
//@jve:decl-index=0:visual-constraint="10,10"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -