root / import / ext3D / trunk / install-extension3d / IzPack / src / lib / com / izforge / izpack / util / AbstractUIHandler.java @ 15280
History | View | Annotate | Download (3.67 KB)
1 | 15280 | rgaitan | /*
|
---|---|---|---|
2 | * $Id: AbstractUIHandler.java,v 1.1 2006/06/14 07:29:07 cesar Exp $
|
||
3 | * IzPack
|
||
4 | *
|
||
5 | * Copyright (C) 2001-2003 Tino Schwarze, Julien Ponge
|
||
6 | *
|
||
7 | * File : AbstractUIHandler.java
|
||
8 | * Description : An interface for user interaction.
|
||
9 | * Author's email : tino.schwarze@informatik.tu-chemnitz.de
|
||
10 | * Author's Website : http://www.tisc.de
|
||
11 | *
|
||
12 | * This program is free software; you can redistribute it and/or
|
||
13 | * modify it under the terms of the GNU General Public License
|
||
14 | * as published by the Free Software Foundation; either version 2
|
||
15 | * of the License, or any later version.
|
||
16 | *
|
||
17 | * This program is distributed in the hope that it will be useful,
|
||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
20 | * GNU General Public License for more details.
|
||
21 | *
|
||
22 | * You should have received a copy of the GNU General Public License
|
||
23 | * along with this program; if not, write to the Free Software
|
||
24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||
25 | */
|
||
26 | |||
27 | package com.izforge.izpack.util; |
||
28 | |||
29 | /**
|
||
30 | * This interface describes basic functionality neccessary for user interaction.
|
||
31 | *
|
||
32 | * All methods or functions which perform work and need to notify or ask the user
|
||
33 | * use a listener for such purposes. This way, we can separate UI from function.
|
||
34 | *
|
||
35 | */
|
||
36 | |||
37 | public interface AbstractUIHandler |
||
38 | { |
||
39 | /**
|
||
40 | * Notify the user about something.
|
||
41 | *
|
||
42 | * The difference between notification and warning is that a notification should not
|
||
43 | * need user interaction and can savely be ignored.
|
||
44 | *
|
||
45 | * @param message The notification.
|
||
46 | */
|
||
47 | public void emitNotification (String message); |
||
48 | |||
49 | /**
|
||
50 | * Warn the user about something.
|
||
51 | *
|
||
52 | * @param title The message title (used for dialog name, might not be displayed)
|
||
53 | * @param message The warning message.
|
||
54 | * @return true if the user decided not to continue
|
||
55 | */
|
||
56 | public boolean emitWarning (String title, String message); |
||
57 | |||
58 | /**
|
||
59 | * Notify the user of some error.
|
||
60 | *
|
||
61 | * @param title The message title (used for dialog name, might not be displayed)
|
||
62 | * @param message The error message.
|
||
63 | * @return true if the user decided not to continue
|
||
64 | */
|
||
65 | public void emitError (String title, String message); |
||
66 | |||
67 | // constants for asking questions
|
||
68 | // must all be >= 0!
|
||
69 | public static final int ANSWER_CANCEL = 45; |
||
70 | public static final int ANSWER_YES = 47; |
||
71 | public static final int ANSWER_NO = 49; |
||
72 | // values for choices to present to the user
|
||
73 | public static final int CHOICES_YES_NO = 37; |
||
74 | public static final int CHOICES_YES_NO_CANCEL = 38; |
||
75 | |||
76 | /**
|
||
77 | * Ask the user a question.
|
||
78 | *
|
||
79 | * @param title The title of the question (useful for dialogs). Might be null.
|
||
80 | * @param question The question.
|
||
81 | * @param choices The set of choices to present. Either CHOICES_YES_NO or
|
||
82 | * CHOICES_YES_NO_CANCEL
|
||
83 | *
|
||
84 | * @return The user's choice. (ANSWER_CANCEL, ANSWER_YES or ANSWER_NO)
|
||
85 | */
|
||
86 | public int askQuestion (String title, String question, int choices); |
||
87 | |||
88 | /**
|
||
89 | * Ask the user a question.
|
||
90 | *
|
||
91 | * @param title The title of the question (useful for dialogs). Might be null.
|
||
92 | * @param question The question.
|
||
93 | * @param choices The set of choices to present. Either CHOICES_YES_NO or
|
||
94 | * CHOICES_YES_NO_CANCEL
|
||
95 | * @param default_choice The default choice. One of ANSWER_CANCEL, ANSWER_YES
|
||
96 | * or ANSWER_NO.
|
||
97 | *
|
||
98 | * @return The user's choice. (ANSWER_CANCEL, ANSWER_YES or ANSWER_NO)
|
||
99 | */
|
||
100 | public int askQuestion (String title, String question, int choices, int default_choice); |
||
101 | |||
102 | } |