src/main/java/ru/indvdum/mywork/vaadin/EditTaskDialog.java
changeset 12 93ea5ae33f02
parent 11 e576975e68f7
child 14 1d1d4c94d251
     1.1 --- a/src/main/java/ru/indvdum/mywork/vaadin/EditTaskDialog.java	Tue Aug 23 14:48:38 2011 +0300
     1.2 +++ b/src/main/java/ru/indvdum/mywork/vaadin/EditTaskDialog.java	Tue Aug 23 16:21:44 2011 +0300
     1.3 @@ -22,15 +22,16 @@
     1.4  	private TextField taskName = null;
     1.5  	private RichTextArea taskDescription = null;
     1.6  
     1.7 -	public EditTaskDialog(MyWorkApplication myApp, EditState state, Task task) throws Exception {
     1.8 +	public EditTaskDialog(MyWorkApplication myApp, Task task) throws Exception {
     1.9  		super();
    1.10  		this.myApp = myApp;
    1.11 -		this.state = state;
    1.12 +		if(task == null)
    1.13 +			state = EditState.CREATE;
    1.14 +		else 
    1.15 +			state = EditState.EDIT;
    1.16  		switch(state){
    1.17  		case CREATE:
    1.18  			setCaption("Creating new task");
    1.19 -			if(task != null)
    1.20 -				throw new Exception("Illegal argument: task must be null in creating state.");
    1.21  			task = new Task();
    1.22  			task.setName("");
    1.23  			task.setDescription("");
    1.24 @@ -38,8 +39,6 @@
    1.25  			break;
    1.26  		case EDIT:
    1.27  			setCaption("Editing task");
    1.28 -			if(task == null)
    1.29 -				throw new Exception("Illegal argument: task must be not null in editing state.");
    1.30  			this.task = task;
    1.31  			break;
    1.32  		}