Exemple #1
0
 // 查询方法
 private void query(String name) {
   // 通过service方法查找结果
   Vector<Type> types = (Vector<Type>) service.query(name);
   // 转换数据格式
   Vector<Vector> datas = changeDatas(types);
   // 设置数据
   setDatas(datas);
   // 刷新列表
   refreshTable();
 }
Exemple #2
0
 // 修改一个种类
 private void update() {
   String typeId = this.typeId.getText();
   String typeName = this.typeName.getText();
   String intro = this.intro.getText();
   Type type = new Type(typeId, typeName, intro);
   service.update(type);
   // 重新读取数据
   setViewDatas();
   // 刷新列表
   refreshTable();
 }
Exemple #3
0
 // 新增一个种类
 private void add() {
   String typeName = this.typeName.getText();
   String intro = this.intro.getText();
   Type type = new Type(null, typeName, intro);
   // 调用业务方法新增一个种类
   type = service.add(type);
   // 重新读取数据
   setViewDatas();
   // 刷新列表
   clear();
 }
Exemple #4
0
 /*
  * 实现父类方法, 查询数据库并返回对应的数据格式, 调用父类的setDatas方法设置数据集合
  */
 public void setViewDatas() {
   Vector<Type> types = (Vector<Type>) service.getAll();
   Vector<Vector> datas = changeDatas(types);
   setDatas(datas);
 }
Exemple #5
0
 // 查看一个种类
 public void view(String id) {
   Type data = service.get(id);
   typeId.setText(data.getID());
   typeName.setText(data.getTYPE_NAME());
   intro.setText(data.getTYPE_INTRO());
 }