ComboBoxConfig.java
1 |
/*
|
---|---|
2 |
** Module : ComboBoxConfig.java
|
3 |
** Abstract : stores combo box specific state
|
4 |
**
|
5 |
** Copyright (c) 2005-2015, Golden Code Development Corporation.
|
6 |
** ALL RIGHTS RESERVED. Use is subject to license terms.
|
7 |
**
|
8 |
** Golden Code Development Corporation
|
9 |
** CONFIDENTIAL
|
10 |
**
|
11 |
** -#- -I- --Date-- --JPRM-- ----------------Description-----------------
|
12 |
** 001 EVL 20050714 @21692 Creation based on general concept. Necessary
|
13 |
** modification to get compiled.
|
14 |
** 002 EVL 20050723 @21804 Adding one more attribute: innerLines.
|
15 |
** 003 SIY 20050831 @22491 Refactoring (see @@22394-22409)
|
16 |
** 004 NVS 20051116 @23343 Class access changed to public.
|
17 |
** 005 SIY 20051129 @23561 Moved item list member to parent class.
|
18 |
** 006 SIY 20060209 @24485 Major refactoring.
|
19 |
** 007 SIY 20060209 @24496 Fixed trap in setMaximumRowCount.
|
20 |
** 008 NVS 20060313 @25040 Moved format, setFormat() and getFormat() to
|
21 |
** the superclass, ControlSetConfig, so that
|
22 |
** format methods are available in SelectionList
|
23 |
** as well.
|
24 |
** 009 GES 20060803 @28397 Made externalizable for better performance.
|
25 |
** Many code standard cleanups.
|
26 |
** 010 EVL 20060809 @28497 Fix for DropDown line mismatch.
|
27 |
** 011 SIY 20061213 @31674 Encapsulated fields.
|
28 |
** 012 SIY 20100619 Switching to own implementation of character UI.
|
29 |
** 013 SIY 20100804 Changes in imports, some refactorings.
|
30 |
** 014 SIY 20111101 Moved from CHUI package. Minor
|
31 |
** cleanups/refactorings in preparation to GUI client.
|
32 |
** 015 SIY 20111202 Updated imports.
|
33 |
** 016 CA 20140926 Added shared widget configuration support, to allow GUI/ChUI
|
34 |
** concrete implementation for the same widget ID. Refactored the
|
35 |
** widget configuration classes: all fields were made public; these
|
36 |
** classes need to be as dumb as possible, all logic related to
|
37 |
** setting/getting a certain field should be at the widget or at the
|
38 |
** caller. Refs #2254
|
39 |
** 017 SVL 20141102 Added MAX-CHARS attribute.
|
40 |
** 018 GES 20141124 Fixed javadoc.
|
41 |
** 019 CA 20150105 Changes for SIDE-LABEL-HANDLE runtime support.
|
42 |
*/
|
43 |
|
44 |
package com.goldencode.p2j.ui; |
45 |
|
46 |
import java.io.*; |
47 |
|
48 |
/**
|
49 |
* Stores combo-box specific state.
|
50 |
*/
|
51 |
public class ComboBoxConfig |
52 |
extends ControlSetConfig
|
53 |
{ |
54 |
/** The Progress AUTO-ZAP attribute. */
|
55 |
public boolean autoZap = true; |
56 |
|
57 |
/** The number of text lines in the widget. */
|
58 |
public int innerLines = 0; |
59 |
|
60 |
/** The number of assignments to INNER-LINES since the last activation */
|
61 |
public int innerLinesAssignments = 0; |
62 |
|
63 |
/** The max value of INNER-LINES */
|
64 |
public int innerLinesLimit = 0; |
65 |
|
66 |
/** The adjustement of innerLinesLimit after the widget activation*/
|
67 |
public int innerLinesLimitDelta = 0; |
68 |
|
69 |
/** MAX-CHARS attribute. */
|
70 |
public int maxChars = 255; |
71 |
|
72 |
/**
|
73 |
* Default constructor (only used in de-serialization).
|
74 |
*/
|
75 |
public ComboBoxConfig()
|
76 |
{ |
77 |
possibleSideLabel = true;
|
78 |
} |
79 |
|
80 |
/**
|
81 |
* Create a new config and associate it with the given widget.
|
82 |
*
|
83 |
* @param id
|
84 |
* The ID of the widget to which this configuration belongs.
|
85 |
*/
|
86 |
protected ComboBoxConfig(int id) |
87 |
{ |
88 |
super(id);
|
89 |
|
90 |
possibleSideLabel = true;
|
91 |
} |
92 |
|
93 |
/**
|
94 |
* Create a new config and associate it with the given widget.
|
95 |
*
|
96 |
* @param id
|
97 |
* The ID of the widget to which this configuration belongs.
|
98 |
*/
|
99 |
protected ComboBoxConfig(WidgetId id)
|
100 |
{ |
101 |
super(id);
|
102 |
|
103 |
possibleSideLabel = true;
|
104 |
} |
105 |
|
106 |
/**
|
107 |
* Set new values from the provided configuration instance.
|
108 |
*
|
109 |
* @param config
|
110 |
* The instance from which to take values.
|
111 |
*/
|
112 |
@Override
|
113 |
public void applyConfig(WidgetConfig config) |
114 |
{ |
115 |
super.applyConfig(config);
|
116 |
|
117 |
ComboBoxConfig cfg = (ComboBoxConfig) config; |
118 |
|
119 |
autoZap = cfg.autoZap; |
120 |
innerLines = cfg.innerLines; |
121 |
maxChars = cfg.maxChars; |
122 |
innerLinesAssignments = cfg.innerLinesAssignments; |
123 |
innerLinesLimit = cfg.innerLinesLimit; |
124 |
innerLinesLimitDelta = cfg.innerLinesLimitDelta; |
125 |
} |
126 |
|
127 |
/**
|
128 |
* Replacement for the default object reading method. The latest
|
129 |
* state is read from the input source. The parent's state is
|
130 |
* read first.
|
131 |
*
|
132 |
* @param in
|
133 |
* The input source from which fields will be restored.
|
134 |
*
|
135 |
* @throws IOException
|
136 |
* In case of I/O errors.
|
137 |
* @throws ClassNotFoundException
|
138 |
* If payload can't be instantiated.
|
139 |
*/
|
140 |
@Override
|
141 |
public void readExternal(ObjectInput in) |
142 |
throws IOException, |
143 |
ClassNotFoundException
|
144 |
{ |
145 |
super.readExternal(in);
|
146 |
innerLines = in.readInt(); |
147 |
autoZap = in.readBoolean(); |
148 |
maxChars = in.readInt(); |
149 |
innerLinesAssignments = in.readInt(); |
150 |
innerLinesLimit = in.readInt(); |
151 |
innerLinesLimitDelta = in.readInt(); |
152 |
} |
153 |
|
154 |
/**
|
155 |
* Replacement for the default object writing method. The latest
|
156 |
* state is written to the output destination. The parent's state is
|
157 |
* written first.
|
158 |
*
|
159 |
* @param out
|
160 |
* The output destination to which fields will be saved.
|
161 |
*
|
162 |
* @throws IOException
|
163 |
* In case of I/O errors.
|
164 |
*/
|
165 |
@Override
|
166 |
public void writeExternal(ObjectOutput out) |
167 |
throws IOException |
168 |
{ |
169 |
super.writeExternal(out);
|
170 |
out.writeInt(innerLines); |
171 |
out.writeBoolean(autoZap); |
172 |
out.writeInt(maxChars); |
173 |
out.writeInt(innerLinesAssignments); |
174 |
out.writeInt(innerLinesLimit); |
175 |
out.writeInt(innerLinesLimitDelta); |
176 |
} |
177 |
} |