Merge branch 'widget_grid' into widget
Conflicts: examples/widgetapp/widget.coffee examples/widgetapp/widget.js
This commit is contained in:
@@ -12,14 +12,20 @@ inherit
|
||||
WSF_CONTROL
|
||||
|
||||
create
|
||||
make_progress
|
||||
make_progress, make_progress_with_source
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_progress (n: STRING; p: WSF_PROGRESSSOURCE)
|
||||
make_progress (n: STRING)
|
||||
do
|
||||
make_control (n, "div")
|
||||
add_class ("progress")
|
||||
progress := 0
|
||||
end
|
||||
|
||||
make_progress_with_source (n: STRING; p: WSF_PROGRESSSOURCE)
|
||||
do
|
||||
make_progress (n)
|
||||
progress_source := p
|
||||
end
|
||||
|
||||
@@ -32,15 +38,15 @@ feature -- State handling
|
||||
state: JSON_OBJECT
|
||||
do
|
||||
create Result.make
|
||||
Result.put (create {JSON_NUMBER}.make_integer (progress_source.progress), "progress")
|
||||
Result.put (create {JSON_NUMBER}.make_integer (progress_value), "progress")
|
||||
end
|
||||
|
||||
feature -- Event handling
|
||||
|
||||
handle_callback (cname: STRING; event: STRING)
|
||||
handle_callback (cname: STRING; event: STRING; event_parameter: detachable STRING)
|
||||
do
|
||||
if cname.is_equal (control_name) and event.is_equal ("progress_fetch") then
|
||||
state_changes.put (create {JSON_NUMBER}.make_integer (progress_source.progress), create {JSON_STRING}.make_json ("progress"))
|
||||
state_changes.put (create {JSON_NUMBER}.make_integer (progress_value), create {JSON_STRING}.make_json ("progress"))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -48,12 +54,32 @@ feature -- Rendering
|
||||
|
||||
render: STRING
|
||||
do
|
||||
Result := render_tag_with_tagname ("div", "", "role=%"progressbar%" aria-valuenow=%"" + progress_source.progress.out + "%" aria-valuemin=%"0%" aria-valuemax=%"100%" style=%"width: " + progress_source.progress.out + "%%;%"", "progress-bar")
|
||||
Result := render_tag_with_tagname ("div", "", "role=%"progressbar%" aria-valuenow=%"" + progress_value.out + "%" aria-valuemin=%"0%" aria-valuemax=%"100%" style=%"width: " + progress_value.out + "%%;%"", "progress-bar")
|
||||
Result := render_tag (Result, "")
|
||||
end
|
||||
|
||||
feature --Change progress
|
||||
|
||||
set_progress (p: INTEGER)
|
||||
require
|
||||
no_progress_source: not (attached progress_source)
|
||||
do
|
||||
progress := p
|
||||
state_changes.put (create {JSON_NUMBER}.make_integer (progress), create {JSON_STRING}.make_json ("progress"))
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
progress_source: WSF_PROGRESSSOURCE
|
||||
progress_source: detachable WSF_PROGRESSSOURCE
|
||||
|
||||
progress: INTEGER
|
||||
|
||||
progress_value: INTEGER
|
||||
do
|
||||
Result := progress
|
||||
if attached progress_source as ps then
|
||||
Result := ps.progress
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user