1 /*
2 * Copyright (c) 2001-2004,
3 * RedVerst Group, ISP RAS http://www.ispras.ru
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice, this
10 * list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 *
16 * 3. The names "ATP", "TreeDL", "RedVerst", "ISP RAS"
17 * may not be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
24 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 package com.unitesk.atp.messages;
33
34 import java.util.ArrayList;
35 import java.util.List;
36
37
38 /***
39 * <A href="mailto:demakov@ispras.ru">Alexey Demakov</A>
40 * @version $Id: ListMessageBox.java,v 1.3 2005/11/10 21:03:04 all-x Exp $
41 */
42 public class ListMessageBox extends NullMessageBox
43 {
44 protected List/*Message*/ errorMessageList = new ArrayList/*Message*/();
45 protected List/*Message*/ warningMessageList = new ArrayList/*Message*/();
46 protected List/*Message||String*/
47 infoMessageList = new ArrayList/*Message||String*/();
48
49 protected List/*String*/ errorStringList = new ArrayList/*String*/();
50 protected List/*String*/ warningStringList = new ArrayList/*String*/();
51 protected List/*String*/ infoStringList = new ArrayList/*String*/();
52
53 public ListMessageBox()
54 {
55 super();
56 }
57
58 public ListMessageBox( MessageStringManager sm )
59 {
60 super( sm );
61 }
62
63 public synchronized void error( Message message )
64 {
65 errorMessageList.add( message );
66 super.error( message );
67 }
68
69 public synchronized void warning( Message message )
70 {
71 warningMessageList.add( message );
72 super.warning( message );
73 }
74
75 protected synchronized void errorStr( String message )
76 {
77 errorStringList.add( message );
78 }
79
80 protected synchronized void warningStr( String message )
81 {
82 warningStringList.add( message );
83 }
84
85 protected synchronized void infoStr( String message )
86 {
87 infoStringList.add( message );
88 }
89
90 public synchronized void info( Message message )
91 {
92 infoMessageList.add( message );
93 super.info( message );
94 }
95
96 public synchronized void info( String message )
97 {
98 infoMessageList.add( message );
99 super.info( message );
100 }
101
102 public Message getError( int i )
103 {
104 return (Message)errorMessageList.get( i );
105 }
106
107 public String getErrorString( int i )
108 {
109 return (String)errorStringList.get( i );
110 }
111
112 public Message getWarning( int i )
113 {
114 return (Message)warningMessageList.get( i );
115 }
116
117 public String getWarningString( int i )
118 {
119 return (String)warningStringList.get( i );
120 }
121
122 public Message getInfo( int i )
123 {
124 return (Message)infoMessageList.get( i );
125 }
126
127 public String getInfoString( int i )
128 {
129 return (String)infoStringList.get( i );
130 }
131 }