View Javadoc

1   /*
2    * Created on Mar 15, 2005. Copyright 1999-2006 Faculty of Mathematics, Physics
3    * and Informatics, Comenius University, Bratislava. This file is protected by
4    * the Mozilla Public License version 1.1 (the "License"); you may not use this
5    * file except in compliance with the License. You may obtain a copy of the
6    * License at http://euromath2.sourceforge.net/license.html Unless required by
7    * applicable law or agreed to in writing, software distributed under the
8    * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
9    * OF ANY KIND, either express or implied. See the License for the specific
10   * language governing permissions and limitations under the License.
11   */
12  package sk.uniba.euromath.editor.wizards;
13  /***
14   * <p>
15   * Provides wizards for the MultiWizard class.
16   * </p>
17   * <p>
18   * The <code>hasNext()</code> will be queried only in case that the active
19   * wizard can finish - this is because next wizard may depend on the contents of
20   * active wizard.
21   * </p>
22   * <p>
23   * Initially the object is be positioned over first wizard (<code>current()</code>
24   * returns first wizard). If the provider does not contain any wizards then it
25   * may return <code>null</code>.
26   * </p>
27   * @author Martin Vysny
28   */
29  public interface IMultiWizardProvider {
30  	/***
31  	 * Called when all wizards (from first wizard to current wizard) have
32  	 * already been finished.
33  	 */
34  	public void performFinish();
35  	/***
36  	 * Called when all opened wizards (from first wizard to current wizard) have
37  	 * already been cancelled.
38  	 */
39  	public void performCancel();
40  	/***
41  	 * Provider should dispose any objects it collected. Wizards are disposed
42  	 * automatically by the <code>MultiWizard</code>.
43  	 */
44  	public void dispose();
45  	/***
46  	 * Sets the multi-wizard object instance, that'll navigate user through
47  	 * other wizards using this provider.
48  	 * @param wizard the wizard that'll use this provider.
49  	 */
50  	public void setWizard(MultiWizard wizard);
51  	/***
52  	 * Fetches the current wizard.
53  	 * @return current wizard. May return <code>null</code> only if the
54  	 * provider provides no wizards.
55  	 */
56  	public IWizard current();
57  	/***
58  	 * Fetches the next wizard. Function may fail even when
59  	 * <code>hasNext()</code> returned <code>true</code> - it may throw
60  	 * <code>ProviderException</code>.
61  	 * @return next wizard. The wizard does not have to be initialized -
62  	 * <code>MultiWizard</code> initializes it for you. Never
63  	 * <code>null</code>.
64  	 * @throws java.util.NoSuchElementException if there is no next wizard.
65  	 * @throws ProviderException if next wizard instance cannot be constructed
66  	 * thanks to some unexpected error. In such case, wizard stays at current
67  	 * page, exception is logged and an error dialog is shown.
68  	 */
69  	public IWizard next() throws ProviderException;
70  	/***
71  	 * Fetches the previous wizard. Current wizard is automatically disposed.
72  	 * @return previous wizard.
73  	 * @throws java.util.NoSuchElementException if current wizard is the first
74  	 * wizard.
75  	 */
76  	public IWizard previous();
77  	/***
78  	 * Checks if there is next wizard.
79  	 * @return <code>true</code> if there is next wizard or <code>false</code>
80  	 * if <code>next()</code> will fail.
81  	 */
82  	public boolean hasNext();
83  	/***
84  	 * Checks if there is previous wizard.
85  	 * @return <code>true</code> if there is previous wizard or
86  	 * <code>false</code> if <code>previous()</code> will fail.
87  	 */
88  	public boolean hasPrevious();
89  	/***
90  	 * Returns name of this wizard. Describes this wizard. Shown in the dialog.
91  	 * @return displayable wizard name, like 'New element contents'. If
92  	 * <code>null</code> then the name is collected from child wizards.
93  	 */
94  	public String getName();
95  }