/** * 获得所有的tips提示,自动补全查询文本框 * * @return */ private Vector<String> getAllTips() { Vector<Vehicle> vehicles = vehicleblservice.getAll(); tips.clear(); for (Vehicle vehicle : vehicles) { tips.add(vehicle.getVehicle_num()); tips.add(vehicle.getLicense_plate_number()); } return tips; }
private void update() { // getvehicle方法已经保存了department Vehicle vehicle = getVehicle(); int vehicleId = Integer.parseInt(this.textField_vehicleId.getText()); vehicle.setId(vehicleId); boolean result = vehicleblservice.update(vehicle); // 重新读取数据 setViewDatas(); // 刷新列表, 清空表单 clear(); // 通知更新结果 if (result) { MainFrame.getLoglabel().setText("更新车辆信息成功"); logger.info("更新车辆信息成功"); } else { MainFrame.getLoglabel().setText("更新车辆信息失败"); logger.error("更新车辆信息失败"); } }
private void view() { int id = getSelectId(getJTable()); Vehicle vehicle = vehicleblservice.getById(id); MainFrame.getLoglabel().setText("查看车辆(车辆编号:" + vehicle.getVehicle_num() + ")"); this.textField_vehicleId.setText(id + ""); this.comboBox_showBusiness.setSelectedItem(makeDepartment(vehicle.getDepartment())); this.textField_vehicleNum.setText(vehicle.getVehicle_num()); this.textField_license.setText(vehicle.getLicense_plate_number()); this.textField_usetime.setText(DateUtil.getStringByDate(vehicle.getUsetime())); this.textField_vehicleinfo.setText(vehicle.getVehicle_info()); }
private Vector<Vector> changeDatas(Vector<Vehicle> vehicles) { Vector<Vector> view = new Vector<Vector>(); for (Vehicle vehicle : vehicles) { Vector v = new Vector(); v.add(vehicle.getId()); v.add(vehicle.getVehicle_num()); v.add(vehicle.getLicense_plate_number()); v.add(DateUtil.getStringByDate(vehicle.getUsetime())); v.add(vehicle.getDepartment().getDepartment_name()); view.add(v); } return view; }