示教器代码部分
package composite.ProgramSelect;
import java.awt.event.ActionEvent;
import com.keba.kemro.kvs.teach.data.project.KvtProject;
import com.keba.kemro.kvs.teach.data.project.KvtProjectAdministrator;
import com.keba.kemro.plc.service.HmiVariableService;
public class ProgramSelect extends ProgramSelect_generated {
private static final long serialVersionUID = 1L;
private KvtProject[] Prjs;
private KvtProject selectedPrj;
private String prjsName;
private String selectedProjectName;
private String selectedProgramName;
private String variableAddressProjectName =
"APPL.Application.GVL.gsSelectedProjectName";
private String variableAddressProgramName =
"APPL.Application.GVL.gsSelectedProgramName";//PersistentVars
private int prjSlectedIndex;
private int prgSlectedIndex;
public ProgramSelect() throws Exception
{
super();
//use textField to show the actual selected project and program
this.textField_Project.setVariable(variableAddressProjectName);
this.textField_Program.setVariable(variableAddressProgramName);
//Reaction on Component actions like pressed button
//Todo: register component to react here
//<component>.addActionListener(this);
}
public void onShow() {
super.onShow();
try
{
//get all projects and put them into taxtSelectList_Project
Prjs = KvtProjectAdministrator.getAllProjects();
prjsName = Prjs[0].getName();
if (Prjs != null) {
for (int i = 1; i < (Prjs.length); i++) {
if (Prjs[i] != null) {
prjsName = prjsName+";"+(Prjs[i].getName());
}
}
}
this.textSelectListStd_Project.setListTexts(prjsName);
}catch(Exception e)
{
e.printStackTrace();
}
//set listener
this.textSelectListStd_Project.addActionListener(this);
this.textSelectListStd_Program.addActionListener(this);
this.pushButton_Update.addActionListener(this);
}
/**
* This method reacts on action commands
*/
public void actionPerformed(ActionEvent ev)
{