Skip to content

Commit 26fbd9a

Browse files
committed
better display for items, query and template
gui cosmetic
1 parent 383581f commit 26fbd9a

File tree

2 files changed

+70
-37
lines changed

2 files changed

+70
-37
lines changed

src/cj_client_window.e

Lines changed: 65 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,11 @@ inherit
1717
feature {NONE} -- Initialization
1818

1919
create_interface_objects
20-
local
21-
ft: EV_FONT
2220
do
2321
Precursor
2422
create field_url
25-
create ft
26-
ft.set_family ({EV_FONT_CONSTANTS}.Family_sans)
27-
ft.set_height (10)
28-
2923
create text_formatted_body.make
30-
3124
create text_http_response
32-
text_http_response.set_font (ft)
3325

3426
create button_go.make_with_text ("Go")
3527
create cell_info
@@ -132,13 +124,13 @@ feature -- Explore
132124
end
133125
if attached resp.collection as coll then
134126
t.enter_bold
135-
t.append_text (" Version: ")
127+
t.append_text ("- Version: ")
136128
t.exit_bold
137129
t.append_text (coll.version)
138130
t.append_new_line
139131

140132
t.enter_bold
141-
t.append_text (" Href: ")
133+
t.append_text ("- Href: ")
142134
t.exit_bold
143135

144136
if coll.href.is_empty then
@@ -168,42 +160,31 @@ feature -- Explore
168160
l_items as c
169161
loop
170162
i := i + 1
171-
append_item_line_to (i, c.item, t)
172-
t.append_text ("%N")
163+
-- append_item_line_to (i, c.item, t)
164+
append_item_to (i, c.item, t)
165+
t.append_new_line
173166
end
167+
t.append_new_line
174168
end
175169
if attached coll.queries as l_queries then
176170
t.append_custom ("title", "Queries")
177171
t.append_new_line
178172
i := 0
179-
across
180-
l_queries as c
181-
loop
182-
i := i + 1
183-
append_query_line_to (i, c.item, t)
184-
t.append_text ("%N")
185-
end
186-
187-
t.append_custom ("title", "Queries (details)")
188-
t.append_new_line
189-
i := 0
190173
across
191174
l_queries as c
192175
loop
193176
i := i + 1
194177
append_query_to (i, c.item, t)
195-
t.append_text ("%N")
178+
t.append_new_line
196179
end
180+
t.append_new_line
197181
end
198182

199-
if attached coll.template as tpl then
183+
if attached coll.template as l_template then
200184
t.append_custom ("title", "Template")
201185
t.append_new_line
202-
across
203-
tpl.data as d
204-
loop
205-
append_data_line_to (d.item, t)
206-
end
186+
append_template_to (0, l_template, t)
187+
t.append_new_line
207188
end
208189

209190
if attached coll.error as l_error then
@@ -239,6 +220,8 @@ feature -- Explore
239220
t.enter_italic
240221
t.append_text (a_error.message)
241222
t.exit_italic
223+
t.append_new_line
224+
242225
end
243226

244227
append_link_line_to (a_index: INTEGER; a_link: CJ_LINK; t: CLICKABLE_TEXT)
@@ -257,7 +240,7 @@ feature -- Explore
257240
t.append_text (" - Link #" + a_index.out)
258241
t.exit_bold
259242
t.append_text (" ")
260-
t.append_link (l_title + {STRING_32} " ("+ a_link.href + {STRING_32} ")", a_link.href)
243+
t.append_link (l_title + {STRING_32} " ( "+ a_link.href + {STRING_32} " )", a_link.href)
261244
end
262245

263246
append_query_line_to (a_index: INTEGER; a_query: CJ_QUERY; t: CLICKABLE_TEXT)
@@ -276,7 +259,7 @@ feature -- Explore
276259
t.append_text (" - Query #" + a_index.out)
277260
t.exit_bold
278261
t.append_text (" ")
279-
t.append_link (l_title + {STRING_32} " ("+ a_query.href + {STRING_32} ")", a_query.href)
262+
t.append_link (l_title + {STRING_32} " ( "+ a_query.href + {STRING_32} " )", a_query.href)
280263
end
281264

282265
append_query_to (a_index: INTEGER; a_query: CJ_QUERY; t: CLICKABLE_TEXT)
@@ -296,11 +279,46 @@ feature -- Explore
296279
t.append_new_line
297280
end
298281
end
282+
t.append_new_line
283+
end
284+
285+
append_template_to (a_index: INTEGER; a_template: CJ_TEMPLATE; t: CLICKABLE_TEXT)
286+
do
287+
t.enter_bold
288+
t.append_text (" - Template")
289+
if a_index > 0 then
290+
t.append_text (" #" + a_index.out)
291+
end
292+
t.exit_bold
293+
t.append_new_line
294+
295+
t.append_new_line
296+
if attached a_template.data as l_data then
297+
t.enter_bold
298+
t.append_text ("%TData")
299+
t.exit_bold
300+
t.append_new_line
301+
across
302+
l_data as d
303+
loop
304+
t.append_text ("%T - ")
305+
append_data_line_to (d.item, t)
306+
t.append_new_line
307+
end
308+
end
309+
t.append_new_line
299310
end
300311

301312
append_item_line_to (a_index: INTEGER; a_item: CJ_ITEM; t: CLICKABLE_TEXT)
302313
do
303314
t.append_link (" - Item #" + a_index.out + " " + a_item.href, a_item.href)
315+
end
316+
317+
append_item_to (a_index: INTEGER; a_item: CJ_ITEM; t: CLICKABLE_TEXT)
318+
local
319+
i: INTEGER
320+
do
321+
append_item_line_to (a_index, a_item, t)
304322
if attached a_item.data as l_data then
305323
t.append_text ("%N%T")
306324
t.enter_bold
@@ -313,6 +331,21 @@ feature -- Explore
313331
append_data_line_to (d.item, t)
314332
end
315333
end
334+
if attached a_item.links as l_links then
335+
t.append_text ("%N%T")
336+
t.enter_bold
337+
t.append_text ("Links")
338+
t.exit_bold
339+
i := 0
340+
across
341+
l_links as ln
342+
loop
343+
t.append_text ("%N%T%T")
344+
i := i + 1
345+
append_link_line_to (i, ln.item, t)
346+
end
347+
end
348+
t.append_new_line
316349
end
317350

318351
append_data_line_to (a_data: CJ_DATA; t: CLICKABLE_TEXT)

src/gui/json_formatted_text.e

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ feature {NONE} -- Initialization
3434
ft.set_weight ({EV_FONT_CONSTANTS}.Weight_bold)
3535
set_font ("name", ft)
3636

37-
set_foreground_color ("string", create {EV_COLOR}.make_with_8_bit_rgb (0, 0, 0))
38-
create ft
39-
ft.set_shape ({EV_FONT_CONSTANTS}.Shape_italic)
40-
set_font ("string", ft)
37+
-- set_foreground_color ("string", create {EV_COLOR}.make_with_8_bit_rgb (0, 0, 0))
38+
-- create ft
39+
-- ft.set_shape ({EV_FONT_CONSTANTS}.Shape_italic)
40+
-- set_font ("string", ft)
4141
end
4242

4343
feature -- Change
@@ -89,7 +89,7 @@ feature -- Json
8989
create indentation.make_empty
9090
indentation_step := " "
9191

92-
object_count_inlining := 3
92+
object_count_inlining := 4
9393
array_count_inlining := 1
9494
end
9595

0 commit comments

Comments
 (0)