📄 caselistpanel.java
字号:
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package eti.bi.alphaminer.ui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import eti.bi.alphaminer.core.observer.Observer;
import eti.bi.common.Locale.Resource;
/**
* CaseListPanel is an Panel containing a combo box and a Case Tree.
*/
public class CaseListPanel extends JPanel implements Observer,ActionListener {
/**
*
*/
private static final long serialVersionUID = 1L;
/* Option codes */
/* Parent frame (ManagementWindow) containing this Panel */
private ManagementWindow m_Container;
private String[] groupList =
{
Resource.srcStr("m_LabelIndustry"),
Resource.srcStr("m_LabelProblemType"),
Resource.srcStr("m_LabelBusinessObjective"),
Resource.srcStr("m_LabelDataMiningGoal"),
Resource.srcStr("m_LabelCompanyname") };
private int m_CurrentGroup = 4;
private JPanel jPanel1;
private JScrollPane jScrollPane1;
private CaseListTree m_TreeCaseList;
private JComboBox jComboBox1;
private JLabel jLabel1;
private JPanel jPanel3;
/**
* Constructs a CaseListPanel.
* @param a_Window the ManagementWindow this CaseListPanel belongs to.
*/
public CaseListPanel(ManagementWindow a_Window) {
m_Container = a_Window;
createCaseListPanel();
}
/**
* Gets the CaseListTree shown in this CaseListPanel.
* @return CaseListTree
*/
public CaseListTree getCaseListTree() {
return m_TreeCaseList;
}
/**
* @see java.awt.event.ActionListener#actionPerformed(ActionEvent)
*/
public void actionPerformed(ActionEvent e) {
JComboBox box = (JComboBox) e.getSource();
int selectedIndex = box.getSelectedIndex();
if(selectedIndex>=0&&selectedIndex<groupList.length){
if (m_CurrentGroup != selectedIndex) {
m_CurrentGroup = selectedIndex;
String selectedGroup = groupList[box.getSelectedIndex()];
m_TreeCaseList.setCurrentGroup(selectedGroup);
m_TreeCaseList.setTreeModel();
}
}
}
/**
* Creates CaseListPanel.
*/
private void createCaseListPanel() {
jPanel1 = new JPanel();
jScrollPane1 = new JScrollPane();
m_TreeCaseList = new CaseListTree(m_Container);
jComboBox1 = new JComboBox(groupList);
jLabel1 = new JLabel();
jPanel3 = new JPanel(new BorderLayout());
//<<18/02/2005 Mark Li: Create the Case List tree
// m_TreeCaseList.setTreeModel(true);
//18/02/2005 Mark Li: Create the Case List tree>>
m_TreeCaseList.registerInterest(m_Container.getCaseInformationPanel());
m_TreeCaseList.registerInterest(
m_Container.getApplicationWindow().getMenuBarHandler());
m_TreeCaseList.registerInterest(
m_Container.getApplicationWindow().getToolBarHandler());
jComboBox1.addActionListener(this);
jPanel1.setPreferredSize(new Dimension(184, 35));
jPanel1.setMinimumSize(new Dimension(200, 35));
jPanel1.setBorder(
BorderFactory.createEtchedBorder(
Color.white,
new Color(148, 145, 140)));
this.setLayout(new BorderLayout());
jScrollPane1.setVerticalScrollBarPolicy(
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jScrollPane1.setMaximumSize(new Dimension(32767, 32767));
jScrollPane1.setPreferredSize(new Dimension(200, 300));
jScrollPane1.setRequestFocusEnabled(true);
jComboBox1.setMinimumSize(new Dimension(110, 23));
jComboBox1.setPreferredSize(new Dimension(110, 23));
jComboBox1.setMaximumRowCount(5);
jComboBox1.setSelectedIndex(m_CurrentGroup);
jLabel1.setText(Resource.srcStr("GroupWithText"));
jPanel3.setBorder(null);
jPanel3.setMinimumSize(new Dimension(200, 300));
jPanel3.setPreferredSize(new Dimension(200, 300));
jPanel1.add(jLabel1, null);
jPanel1.add(jComboBox1, null);
this.add(jPanel3, BorderLayout.CENTER);
jPanel3.add(jScrollPane1, BorderLayout.CENTER);
jScrollPane1.getViewport().add(m_TreeCaseList, null);
this.add(jPanel1, BorderLayout.NORTH);
}
//<<21/03/2005 Mark Li: Add new function to revome the node if press delete button
public void removeCaseListTreeNode(){
}
//21/03/2005 Mark Li: Add new function to revome the node if press delete button>>
public void sendNotify(String a_Message) {
if(a_Message.equals(Resource.CHANGE_LOCALE)) {
synchronized(this) {
//grouplist
int index = jComboBox1.getSelectedIndex();
if(index<0){
index = 0;
}
String[] newgroupList =
{
Resource.srcStr("m_LabelIndustry"),
Resource.srcStr("m_LabelProblemType"),
Resource.srcStr("m_LabelBusinessObjective"),
Resource.srcStr("m_LabelDataMiningGoal"),
Resource.srcStr("m_LabelCompanyname") };
groupList = newgroupList;
jComboBox1.removeAllItems();
for(int i=0;i<groupList.length;i++){
jComboBox1.addItem(groupList[i]);
}
jComboBox1.setSelectedIndex(index);
//TreeCaseList
//
jLabel1.setText(Resource.srcStr("GroupWithText"));
}
}
}
public void sendNotify(int a_Message) {
// TODO Auto-generated method stub
}
public void sendNotify(int a_Message, Object a_Object) {
// TODO Auto-generated method stub
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -