Skip to content

Commit dc95de1

Browse files
committed
Added EG_STYLE
Uodated EG_BORDER
1 parent 2a717e6 commit dc95de1

File tree

2 files changed

+225
-0
lines changed

2 files changed

+225
-0
lines changed

sheets/src/objects/eg_border.e

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,39 @@ note
2222
class
2323
EG_BORDER
2424

25+
feature -- Access
26+
27+
style: detachable EG_STYLE
28+
-- The style of the border.
29+
30+
color: detachable EG_COLOR
31+
-- The color of the border.
32+
33+
color_style: detachable EG_COLOR_STYLE
34+
-- The color of the border. If color is also set, this field takes precedence.
35+
36+
feature -- Element Change
37+
38+
set_style (a_style: like style)
39+
do
40+
style := a_style
41+
end
42+
43+
set_color (a_color: like color)
44+
do
45+
color := a_color
46+
end
47+
48+
set_color_style (a_color_style: like color_style)
49+
do
50+
color_style := a_color_style
51+
end
52+
53+
feature -- Eiffel to JSON
54+
55+
to_json: JSON_OBJECT
56+
do
57+
create Result.make
58+
-- TODO
59+
end
2560
end

sheets/src/objects/eg_style.e

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
note
2+
description: "[
3+
The style of a border.
4+
5+
Enums
6+
STYLE_UNSPECIFIED The style is not specified. Do not use this.
7+
DOTTED The border is dotted.
8+
DASHED The border is dashed.
9+
SOLID The border is a thin solid line.
10+
SOLID_MEDIUM The border is a medium solid line.
11+
SOLID_THICK The border is a thick solid line.
12+
NONE No border. Used only when updating a border in order to erase it.
13+
DOUBLE The border is two solid lines.
14+
]"
15+
date: "$Date$"
16+
revision: "$Revision$"
17+
EIS: "name=", "src=https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#style", "protocol=uri"
18+
19+
class
20+
EG_STYLE
21+
22+
inherit
23+
24+
EG_ENUM
25+
redefine
26+
default_create
27+
end
28+
29+
create
30+
default_create
31+
32+
feature {NONE} -- Initialization
33+
34+
default_create
35+
do
36+
Precursor
37+
set_value (style_unspecified)
38+
end
39+
40+
style_unspecified: INTEGER = 1
41+
--The style is not specified. Do not use this.
42+
43+
dotted: INTEGER = 2
44+
-- The border is dotted.
45+
46+
dashed: INTEGER = 3
47+
-- The border is dashed.
48+
49+
solid: INTEGER = 4
50+
-- The border is a thin solid line.
51+
52+
solid_medium: INTEGER = 5
53+
-- The border is a medium solid line.
54+
55+
solid_thick: INTEGER = 6
56+
-- The border is a thick solid line.
57+
58+
none: INTEGER = 7
59+
-- No border. Used only when updating a border in order to erase it.
60+
61+
double : INTEGER = 8
62+
-- The border is two solid lines.
63+
64+
65+
feature -- Change Elements
66+
67+
set_dotted
68+
do
69+
set_value (dotted)
70+
ensure
71+
value_set_with_dotted: value = dotted
72+
end
73+
74+
set_dashed
75+
do
76+
set_value (dashed)
77+
ensure
78+
value_set_with_dashed: value = dashed
79+
end
80+
81+
set_solid
82+
do
83+
set_value (solid)
84+
ensure
85+
value_set_with_solid: value = solid
86+
end
87+
88+
set_solid_medium
89+
do
90+
set_value (solid_medium)
91+
ensure
92+
value_set_with_solid_medium: value = solid_medium
93+
end
94+
95+
set_solid_thick
96+
do
97+
set_value (solid_thick)
98+
ensure
99+
value_set_with_solid_thick: value = solid_thick
100+
end
101+
102+
set_none
103+
do
104+
set_value (none)
105+
ensure
106+
value_set_with_solid_none: value = none
107+
end
108+
109+
set_double
110+
do
111+
set_value (double)
112+
ensure
113+
value_set_with_double: value = double
114+
end
115+
116+
feature -- Status Report
117+
118+
is_dotted: BOOLEAN
119+
do
120+
Result := value = dotted
121+
end
122+
123+
is_dashed: BOOLEAN
124+
do
125+
Result := value = dashed
126+
end
127+
128+
is_solid: BOOLEAN
129+
do
130+
Result := value = solid
131+
end
132+
133+
is_solid_medium: BOOLEAN
134+
do
135+
Result := value = solid_medium
136+
end
137+
138+
is_solid_thick: BOOLEAN
139+
do
140+
Result := value = solid_thick
141+
end
142+
143+
is_none: BOOLEAN
144+
do
145+
Result := value = none
146+
end
147+
148+
is_double: BOOLEAN
149+
do
150+
Result := value = double
151+
end
152+
153+
154+
is_valid_value (a_value: INTEGER): BOOLEAN
155+
-- Can `a_value' be used in a `set_value' feature call?
156+
do
157+
Result := a_value = style_unspecified or else
158+
a_value = dotted or else
159+
a_value = dashed or else
160+
a_value = solid or else
161+
a_value = solid_medium or else
162+
a_value = solid_thick or else
163+
a_value = none or else
164+
a_value = double
165+
end
166+
167+
feature -- Eiffel to JSON
168+
169+
to_json: JSON_STRING
170+
do
171+
if is_dotted then
172+
Result := "DOTTED"
173+
elseif is_dashed then
174+
Result := "DASHED"
175+
elseif is_solid then
176+
Result := "SOLID"
177+
elseif is_solid_medium then
178+
Result := "SOLID_MEDIUM"
179+
elseif is_solid_thick then
180+
Result := "SOLID_THICK"
181+
elseif is_none then
182+
Result := "NONE"
183+
elseif is_double then
184+
Result := "DOUBLE"
185+
else
186+
Result := "STYLE_UNSPECIFIED"
187+
end
188+
end
189+
190+
end

0 commit comments

Comments
 (0)