3838class
3939 EG_CELL_FORMAT
4040
41- inherit
42-
43- ANY
44- redefine
45- default_create
46- end
47-
48- feature {NONE } -- Initialization
49-
50- default_create
51- do
52- create background_color
53- create background_color_style
54- create padding
55- create vertical_alignment
56- create text_format
57- create wrap_strategy
58- end
5941
6042feature -- Access
6143
6244 number_format : detachable EG_NUMBER_FORMAT
6345 -- A format describing how number values should be represented to the user.
6446
65- background_color : EG_COLOR
47+ background_color : detachable EG_COLOR
6648 -- The background color of the cell.
6749
68- background_color_style : EG_COLOR_STYLE
50+ background_color_style : detachable EG_COLOR_STYLE
6951 -- The background color of the cell. If backgroundColor is also set, this field takes precedence.
7052
7153 borders : detachable EG_BORDERS
7254 -- The borders of the cell.
7355
74- padding : EG_PADDING
56+ padding : detachable EG_PADDING
7557 -- The padding of the cell.
7658
7759 horizontal_alignment : detachable EG_HORIZONTAL_ALIGN
7860 -- The horizontal alignment of the value in the cell.
7961
80- vertical_alignment : EG_VERTICAL_ALIGN
62+ vertical_alignment : detachable EG_VERTICAL_ALIGN
8163 -- The vertical alignment of the value in the cell.
8264
83- wrap_strategy : EG_WRAP_STRATEGY
65+ wrap_strategy : detachable EG_WRAP_STRATEGY
8466 -- The wrap strategy for the value in the cell.
8567
8668 text_direction : detachable EG_TEXT_DIRECTION
8769 -- The direction of the text in the cell.
8870
89- text_format : EG_TEXT_FORMAT
71+ text_format : detachable EG_TEXT_FORMAT
9072 -- The format of the text in the cell (unless overridden by a format run).
9173
9274 hyperlink_display_type : detachable EG_HYPERLINK_DISPLAY_TYPE
@@ -97,64 +79,100 @@ feature -- Access
9779
9880feature -- Change Element
9981
100- set_number_format (a_format : EG_NUMBER_FORMAT )
82+ set_number_format (a_format : like number_format )
83+ -- Set `number_format` with `a_format`
10184 do
10285 number_format := a_format
86+ ensure
87+ number_format_set : number_format = a_format
10388 end
10489
105- set_background_color (a_bg_color : EG_COLOR )
90+ set_background_color (a_bg_color : like background_color )
91+ -- Set `background_color` with `a_bg_color`
10692 do
10793 background_color := a_bg_color
94+ ensure
95+ background_color_set : background_color = a_bg_color
10896 end
10997
110- set_background_color_style (a_bg_color_style : EG_COLOR_STYLE )
98+ set_background_color_style (a_bg_color_style : like background_color_style )
99+ -- Set `background_color_style` with `a_bg_colot_style`.
111100 do
112101 background_color_style := a_bg_color_style
102+ ensure
103+ background_color_style_set : background_color_style = a_bg_color_style
113104 end
114105
115- set_borders (a_borders : EG_BORDERS )
106+ set_borders (a_borders : like borders )
107+ -- Set `borders` with `a_borders`.
116108 do
117109 borders := a_borders
110+ ensure
111+ borders_set : borders = a_borders
118112 end
119113
120- set_padding (a_padding : EG_PADDING )
121- do
114+ set_padding (a_padding : like padding )
115+ -- Set `padding` with `a_padding`.
116+ do
122117 padding := a_padding
118+ ensure
119+ padding_set : padding = a_padding
123120 end
124121
125- set_horizontal_alignment (ha : EG_HORIZONTAL_ALIGN )
122+ set_horizontal_alignment (ha : like horizontal_alignment )
123+ -- Set `horizontal_aligment` with `ha`.
126124 do
127125 horizontal_alignment := ha
126+ ensure
127+ horizontal_alignment_set : horizontal_alignment = ha
128128 end
129129
130- set_vertical_alignment (a_val : EG_VERTICAL_ALIGN )
130+ set_vertical_alignment (a_val : like vertical_alignment )
131+ -- Set `vertical_aligment` with `a_val`.
131132 do
132133 vertical_alignment := a_val
134+ ensure
135+ vertical_alignment_set : vertical_alignment = a_val
133136 end
134137
135- set_wrap_strategy (a_val : EG_WRAP_STRATEGY )
138+ set_wrap_strategy (a_val : like wrap_strategy )
139+ -- Set `wrap_strategy` with `a_val`.
136140 do
137141 wrap_strategy := a_val
142+ ensure
143+ wrap_strategy_set : wrap_strategy = a_val
138144 end
139145
140- set_text_direction (a_val : EG_TEXT_DIRECTION )
146+ set_text_direction (a_val : like text_direction )
147+ -- Set `text_direction` with `a_val`
141148 do
142149 text_direction := a_val
150+ ensure
151+ text_direction_set : text_direction = a_val
143152 end
144153
145- set_text_format (a_val : EG_TEXT_FORMAT )
154+ set_text_format (a_val : like text_format )
155+ -- Set `text_format` with `a_val`.
146156 do
147157 text_format := a_val
158+ ensure
159+ text_format_set : text_format = a_val
148160 end
149161
150- set_hyperlink_display_type (a_val : EG_HYPERLINK_DISPLAY_TYPE )
162+ set_hyperlink_display_type (a_val : like hyperlink_display_type )
163+ -- Set `hyperlink_display_type` with `a_val`
151164 do
152165 hyperlink_display_type := a_val
166+ ensure
167+ hyperlink_display_type_set : hyperlink_display_type = a_val
153168 end
154169
155- set_text_rotation (a_val : EG_TEXT_ROTATION )
170+ set_text_rotation (a_val : like text_rotation )
171+ -- Set `text_rotation` with `a_val`
156172 do
157173 text_rotation := a_val
174+ ensure
175+ text_rotation_set : text_rotation = a_val
158176 end
159177
160178feature -- Eiffel to JSON
@@ -191,12 +209,21 @@ feature -- Eiffel to JSON
191209
192210 do
193211 create Result .make_empty
194- -- TODO
195212 if attached number_format as l_number_format then
196213 Result .put (l_number_format .to_json , " numberFormat" )
197214 end
198- Result .put (background_color .to_json , " backgroundColor" )
199- Result .put (background_color_style .to_json , " backgroundColorStyle" )
215+ if attached background_color as l_bg then
216+ Result .put (l_bg .to_json , " backgroundColor" )
217+ end
218+ if attached background_color_style as l_bgs then
219+ Result .put (l_bgs .to_json , " backgroundColorStyle" )
220+ end
221+ if attached borders as lb then
222+ Result .put (lb .to_json , " borders" )
223+ end
224+ if attached padding as l_padding then
225+ Result .put (l_padding .to_json , " padding" )
226+ end
200227
201228 end
202229end
0 commit comments