01: /*
02: * Jacareto Copyright (c) 2002-2005
03: * Applied Computer Science Research Group, Darmstadt University of
04: * Technology, Institute of Mathematics & Computer Science,
05: * Ludwigsburg University of Education, and Computer Based
06: * Learning Research Group, Aachen University. All rights reserved.
07: *
08: * Jacareto is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU General Public
10: * License as published by the Free Software Foundation; either
11: * version 2 of the License, or (at your option) any later version.
12: *
13: * Jacareto is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * General Public License for more details.
17: *
18: * You should have received a copy of the GNU General Public
19: * License along with Jacareto; if not, write to the Free
20: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21: *
22: */
23:
24: package jacareto.replay;
25:
26: import jacareto.record.SystemInfoRecordable;
27: import jacareto.struct.StructureElement;
28: import jacareto.system.Environment;
29:
30: /**
31: * A replayer which is responsible for system information. Tests if the system at replay time is
32: * the same as at capture time.
33: *
34: * @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
35: * @version 1.01
36: */
37: public class SystemInfoReplayer extends Replayer {
38: /**
39: * Creates a new replayer.
40: *
41: * @param env the environment
42: * @param replay the replay object
43: */
44: public SystemInfoReplayer(Environment env, Replay replay) {
45: super (env, replay);
46: }
47:
48: /**
49: * Returns whether or not this replayer is responsible for the given structure element. This is
50: * <code>true</code> if the element is an {@link SystemInfoRecordable}.
51: *
52: * @param element the structure element
53: *
54: * @return <code>true</code> if this replayer is responsible for the specified element;
55: * otherwise <code>false</code>.
56: */
57: public boolean handlesElement(StructureElement element) {
58: return (element != null)
59: && (element instanceof SystemInfoRecordable);
60: }
61:
62: /**
63: * Displays the annotation text with the logger.
64: *
65: * @param element the recordable this replayer should work with
66: *
67: * @return DOCUMENT ME!
68: */
69: public boolean replay(StructureElement element) {
70: SystemInfoRecordable storedInfo = (SystemInfoRecordable) element;
71: SystemInfoRecordable actualInfo = new SystemInfoRecordable(env);
72:
73: if ((storedInfo.getScreenWidth() != actualInfo.getScreenWidth())
74: || (storedInfo.getScreenHeight() != actualInfo
75: .getScreenHeight())) {
76: logger
77: .warn(language
78: .getString("Replayers.SystemInfoReplayer.Warn.Dimension"));
79: }
80:
81: if (!storedInfo.getLookAndFeelName().equals(
82: actualInfo.getLookAndFeelName())) {
83: logger
84: .warn(language
85: .getString("Replayers.SystemInfoReplayer.Warn.LookAndFeel"));
86: }
87:
88: if (!storedInfo.getJavaVersion().equals(
89: actualInfo.getJavaVersion())) {
90: logger
91: .warn(language
92: .getString("Replayers.SystemInfoReplayer.Warn.JavaVersion"));
93: }
94:
95: return true;
96: }
97: }
|