1.1 --- a/src/main/java/ru/indvdum/mywork/vaadin/EditWorkDialog.java Tue Aug 23 14:48:38 2011 +0300
1.2 +++ b/src/main/java/ru/indvdum/mywork/vaadin/EditWorkDialog.java Tue Aug 23 16:21:44 2011 +0300
1.3 @@ -36,15 +36,16 @@
1.4 private TextField workHours = null;
1.5 private RichTextArea workResult = null;
1.6
1.7 - public EditWorkDialog(MyWorkApplication myApp, EditState state, Work work) throws Exception {
1.8 + public EditWorkDialog(MyWorkApplication myApp, Work work) throws Exception {
1.9 super();
1.10 this.myApp = myApp;
1.11 - this.state = state;
1.12 + if(work == 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 work");
1.19 - if(work != null)
1.20 - throw new Exception("Illegal argument: work must be null in creating state.");
1.21 work = new Work();
1.22 work.setHours(0f);
1.23 work.setResult("");
1.24 @@ -52,8 +53,6 @@
1.25 break;
1.26 case EDIT:
1.27 setCaption("Editing work");
1.28 - if(work == null)
1.29 - throw new Exception("Illegal argument: work must be not null in editing state.");
1.30 this.work = work;
1.31 break;
1.32 }