KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > wizard > forms > AbstractWizardFinishForm


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.wizard.forms;
21
22 import java.util.Iterator JavaDoc;
23 import java.util.List JavaDoc;
24
25 import org.apache.commons.logging.Log;
26 import org.apache.commons.logging.LogFactory;
27
28 import com.sslexplorer.wizard.WizardActionStatus;
29
30 public class AbstractWizardFinishForm extends DefaultWizardForm {
31     
32     final static Log log = LogFactory.getLog(AbstractWizardFinishForm.class);
33
34     // Private statics for sequence attributes
35

36     // Private instance variables
37
private List JavaDoc actionStatus;
38     private int errors, warnings;
39
40     public AbstractWizardFinishForm(String JavaDoc pageName, String JavaDoc resourceBundle, String JavaDoc resourcePrefix) {
41         super(false, false, "/WEB-INF/jsp/tiles/wizardFinish.jspf",
42                 "", true, false,
43                 pageName, resourceBundle, resourcePrefix, 0);
44     }
45
46
47     public void setActionStatus(List JavaDoc actionStatus) {
48         this.actionStatus = actionStatus;
49         
50         errors = 0 ;
51         warnings = 0;
52         for(Iterator JavaDoc i = actionStatus.iterator(); i.hasNext(); ) {
53             WizardActionStatus status = (WizardActionStatus)i.next();
54             if(status.getStatus() == WizardActionStatus.COMPLETED_WITH_ERRORS) {
55                 errors++;
56             }
57             else if(status.getStatus() == WizardActionStatus.COMPLETED_WITH_WARNINGS) {
58                 warnings++;
59             }
60         }
61     }
62
63     public String JavaDoc getFocussedField() {
64         return errors > 0|| warnings > 0 ? "rerun" : "finish";
65     }
66     
67     public List JavaDoc getActionStatus() {
68         return actionStatus;
69     }
70     
71     public boolean getCompletedWithErrors() {
72         return errors > 0;
73     }
74     
75     public boolean getCompletedWithWarnings() {
76         return warnings > 0;
77     }
78     
79     public boolean getCompletedOk() {
80         return errors == 0 && warnings == 0;
81     }
82 }
83
Popular Tags