package com.ht.ui.property;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

import com.ht.web.mongo.domain.User;

public class UserProperty {
	private User user;

	private StringProperty username;
	private StringProperty name;
	private StringProperty department;
	private StringProperty address;
	private StringProperty gender;
	private StringProperty email;
	private StringProperty telphone;
	private StringProperty group;

	public UserProperty() {
		this.username = new SimpleBeanStringProperty(null, "username");
		this.name = new SimpleBeanStringProperty(null, "name");
		this.department = new SimpleBeanStringProperty(null, "department");
		this.address = new SimpleBeanStringProperty(null, "address");
		this.gender = new SimpleBeanStringProperty(null, "gender");
		this.email = new SimpleBeanStringProperty(null, "email");
		this.telphone = new SimpleBeanStringProperty(null, "telphone");
		this.group = new SimpleStringProperty(null, "group");
	}

	public UserProperty(User user) {
		this.user = user;

		this.username = new SimpleBeanStringProperty(user, "username");
		this.name = new SimpleBeanStringProperty(user, "name");
		this.department = new SimpleBeanStringProperty(user, "department");
		this.address = new SimpleBeanStringProperty(user, "address");
		this.gender = new SimpleBeanStringProperty(user, "gender");
		this.email = new SimpleBeanStringProperty(user, "email");
		this.telphone = new SimpleBeanStringProperty(user, "telphone");
		this.group = new SimpleStringProperty(user.getGroup().getName());
		
	}

	public User getUser() {
		return user;
	}
	
	public void setUser(User user) {
		this.user = user;
	}

	public StringProperty nameProperty() {
		return name;
	}

	public StringProperty usernameProperty() {
		return username;
	}

	public StringProperty departmentProperty() {
		return department;
	}

	public StringProperty addressProperty() {
		return address;
	}

	public StringProperty genderProperty() {
		return gender;
	}

	public StringProperty emailProperty() {
		return email;
	}

	public StringProperty telphoneProperty() {
		return telphone;
	}

	public StringProperty groupProperty() {
		return group;
	}
}