1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.magicproject.zone;
20
21 import java.io.IOException;
22 import java.io.InputStream;
23
24 import org.apache.commons.lang.StringUtils;
25
26 import net.sf.magicproject.tools.MToolKit;
27
28 /***
29 * Corresponds to the zone configuration : name and borderlayout constraints.
30 *
31 * @author <a href="mailto:fabdouglas@users.sourceforge.net">Fabrice Daugan </a>
32 * @since 0.93
33 */
34 public class ZoneConfiguration {
35
36 /***
37 * The zone name.
38 */
39 private final String zoneName;
40
41 /***
42 * The zone id.
43 */
44 private final int zoneId;
45
46 /***
47 * The layout constraint when this zone is controled by you.
48 */
49 private final String layoutConstraintYou;
50
51 /***
52 * The layout class name.
53 */
54 private final String layoutClass;
55
56 /***
57 * The layout constraint when this zone is controled by the opponent.
58 */
59 private final String layoutConstraintOpponent;
60
61 /***
62 * Create a new instance of this class from a steam.
63 *
64 * @param dbStream
65 * the stream containing the configuration.
66 * @param zoneId
67 * the zone id of this configuration.
68 * @throws IOException
69 * If some other I/O error occurs
70 */
71 ZoneConfiguration(InputStream dbStream, int zoneId) throws IOException {
72 this.zoneId = zoneId;
73 zoneName = MToolKit.readString(dbStream);
74 layoutClass = StringUtils.trimToNull(MToolKit.readString(dbStream));
75 layoutConstraintYou = MToolKit.readString(dbStream);
76 layoutConstraintOpponent = MToolKit.readString(dbStream);
77 }
78
79 /***
80 * The layout constraint when this zone is controled by the opponent.
81 *
82 * @return The layout constraint when this zone is controled by the opponent.
83 */
84 public String getLayoutConstraintOpponent() {
85 return this.layoutConstraintOpponent;
86 }
87
88 /***
89 * The layout constraint when this zone is controled by you.
90 *
91 * @return The layout constraint when this zone is controled by you.
92 */
93 public String getLayoutConstraintYou() {
94 return this.layoutConstraintYou;
95 }
96
97 /***
98 * The zone name.
99 *
100 * @return zone name.
101 */
102 public String getZoneName() {
103 return this.zoneName;
104 }
105
106 /***
107 * The zone id.
108 *
109 * @return zone id.
110 */
111 public int getZoneId() {
112 return this.zoneId;
113 }
114
115 /***
116 * The layout class name.
117 *
118 * @return The layout class name.
119 */
120 public String getLayoutClass() {
121 return this.layoutClass;
122 }
123 }