package com.hmsoft.model;

import java.util.List;

import javafx.scene.control.ComboBox;

/**
 * 
 * @author zq
 *
 */
public class StatisObj implements Comparable<StatisObj> {

	private Long schoolId;
	private String schoolName;
	private Integer count;
	private String courseShow;
	private List<Course> courseList;
	private ComboBox<Course> comboBox = new ComboBox<Course>();
	
	public StatisObj(Long schoolId, String schoolName, Integer count, List<Course> courseList) {
		this.schoolId = schoolId;
		this.schoolName = schoolName;
		this.count = count;
		this.courseList = courseList;
		this.comboBox.getItems().addAll(courseList);
		this.comboBox.setMinWidth(255);
		StringBuilder showSb = new StringBuilder();
		for (int i=0; i<courseList.size(); i++) {
			String courseStr = courseList.get(i).toString();
			if (i < courseList.size() - 1) {
				showSb.append(courseStr).append("\r\n");
			} else {
				showSb.append(courseStr);
			}
		}
		if (showSb.length() > 0) {
			showSb.substring(0, showSb.length() - "\r\n".length());
		}
		this.courseShow = showSb.toString();
	}
	
	public Long getSchoolId() {
		return schoolId;
	}
	public void setSchoolId(Long schoolId) {
		this.schoolId = schoolId;
	}
	public String getSchoolName() {
		return schoolName;
	}
	public void setSchoolName(String schoolName) {
		this.schoolName = schoolName;
	}
	public Integer getCount() {
		return count;
	}
	public void setCount(Integer count) {
		this.count = count;
	}
	public String getCourseShow() {
		return courseShow;
	}
	public void setCourseShow(String courseShow) {
		this.courseShow = courseShow;
	}
	public List<Course> getCourseList() {
		return courseList;
	}
	public void setCourseList(List<Course> courseList) {
		this.courseList = courseList;
	}
	
	public ComboBox<Course> getComboBox() {
		return comboBox;
	}

	public void setComboBox(ComboBox<Course> comboBox) {
		this.comboBox = comboBox;
	}

	@Override
	public int compareTo(StatisObj oth) {
		if (this.count > oth.count) {
			return 1;
		}
		return 0;
	}
	
}
