moved wizard under tools/estudio_wizard

This commit is contained in:
2015-03-05 16:01:45 +01:00
parent b26504b4a1
commit f81e5251e8
64 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="wizard" uuid="F881A707-745E-4C6D-90D1-F820EE3B1470" library_target="wizard">
<target name="wizard">
<root class="EWF_CONSOLE_WIZARD_APPLICATION" feature="make"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
</option>
<setting name="console_application" value="true"/>
<setting name="concurrency" value="none"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="console_wizard" location="lib\wizard\estudio_console_wizard-safe.ecf" readonly="false"/>
<library name="template_smarty" location="$ISE_LIBRARY\contrib\library\text\template\smarty\smarty-safe.ecf"/>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/gui$</exclude>
<exclude>/lib$</exclude>
</file_rule>
</cluster>
</target>
<target name="gui_wizard">
<root class="EWF_GRAPHICAL_WIZARD" feature="make_and_launch"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
</option>
<setting name="console_application" value="false"/>
<setting name="concurrency" value="none"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="gui_wizard" location="lib\wizard\estudio_gui_wizard-safe.ecf" readonly="false"/>
<library name="template_smarty" location="$ISE_LIBRARY\contrib\library\text\template\smarty\smarty-safe.ecf" readonly="false"/>
<library name="vision2" location="$ISE_LIBRARY\library\vision2\vision2-safe.ecf">
<option>
<assertions precondition="true"/>
</option>
</library>
<cluster name="graphical" location=".\src\gui\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/gui$</exclude>
<exclude>/lib$</exclude>
</file_rule>
</cluster>
</target>
</system>

View File

@@ -0,0 +1,22 @@
setlocal
set TMP_ROOTDIR=%~dp0rootdir
set TMP_TARGETNAME=gui_wizard
set WIZ_TARGET=%ISE_EIFFEL%\studio\wizards\new_projects\ewf
rd /q/s %WIZ_TARGET%
mkdir %WIZ_TARGET%
xcopy /I /E /Y %TMP_ROOTDIR% %WIZ_TARGET%
if not exist %WIZ_TARGET%\pixmaps mkdir %WIZ_TARGET%\pixmaps
move %WIZ_TARGET%\ewf.dsc %WIZ_TARGET%\..\ewf.dsc
rd /q/s tmp
mkdir tmp
ecb -config ewf_ise_wizard-safe.ecf -target %TMP_TARGETNAME% -finalize -c_compile -project_path tmp
rd /q/s %WIZ_TARGET%\spec
mkdir %WIZ_TARGET%\spec
mkdir %WIZ_TARGET%\spec\%ISE_PLATFORM%
move tmp\EIFGENs\%TMP_TARGETNAME%\F_code\wizard.exe %WIZ_TARGET%\spec\%ISE_PLATFORM%\wizard.exe
rd /q/s tmp
endlocal

View File

@@ -0,0 +1,15 @@
#!/bin/sh
mkdir tmp
ecb -config ewf_ise_wizard-safe.ecf -target gui_wizard -finalize -c_compile -project_path tmp
mkdir -p spec/$ISE_PLATFORM
mv tmp/EIFGENs/wizard/F_code/wizard spec/$ISE_PLATFORM/wizard
rm -rf tmp
WIZ_TARGET=$ISE_EIFFEL/studio/wizards/new_projects/ewf
rm -rf $WIZ_TARGET
mkdir $WIZ_TARGET
cp -r resources $WIZ_TARGET/resources
cp -r spec $WIZ_TARGET/spec
cp ewf.dsc $WIZ_TARGET/../ewf.dsc
rm -rf spec

View File

@@ -0,0 +1,319 @@
note
description : "Objects that ..."
author : "$Author$"
date : "$Date$"
revision : "$Revision$"
deferred class
CONSOLE_WIZARD_APPLICATION
inherit
WIZARD_APPLICATION
redefine
set_page,
on_start,
on_finish,
on_next,
on_refresh,
on_back
end
LOCALIZED_PRINTER
feature -- Factory
new_page (a_page_id: READABLE_STRING_8): CONSOLE_WIZARD_PAGE
do
create Result.make (a_page_id)
end
set_page (a_page: WIZARD_PAGE)
do
Precursor (a_page)
process_page (a_page)
end
feature -- Execution
on_start
do
Precursor
on_navigation
end
on_finish
do
Precursor
end
on_next
do
Precursor
on_navigation
end
on_refresh
do
Precursor
on_navigation
end
on_back
do
Precursor
on_navigation
end
on_navigation
do
if attached current_page as pg then
if pg = wizard.notfound_page then
on_cancel
elseif pg = wizard.final_page then
on_finish
else
localized_print ("%N")
if attached string_question ("Continue", <<["c", "Continue"], ["r", "Refresh"], ["b", "Back"], ["q", "Cancel"]>>, "c", True) as s then
if s.is_case_insensitive_equal_general ("Cancel") then
on_cancel
elseif s.is_case_insensitive_equal_general ("Refresh") then
on_refresh
elseif s.is_case_insensitive_equal_general ("Back") then
on_back
elseif s.is_case_insensitive_equal_general ("Continue") then
on_next
else
on_next
end
else
on_next
end
end
else
on_cancel
end
end
process_page (a_page: WIZARD_PAGE)
do
a_page.apply_data
localized_print ("%N")
if attached a_page.title as l_title then
localized_print (l_title)
localized_print ("%N")
localized_print (create {STRING}.make_filled ('=', l_title.count))
localized_print ("%N")
if attached a_page.subtitle as l_subtitle then
localized_print (" -- ")
localized_print (l_subtitle)
localized_print ("%N")
end
end
if attached a_page.reports as lst and then not lst.is_empty then
across
lst as ic
loop
localized_print (" : ")
if ic.item.type = {WIZARD_PAGE}.error_report_type then
localized_print ("Error:")
elseif ic.item.type = {WIZARD_PAGE}.warning_report_type then
localized_print ("Warning:")
else
localized_print ("Info:")
end
localized_print (ic.item.message)
localized_print ("%N")
end
end
a_page.reset_reports
across
a_page.items as ic
loop
output_page_item (ic.item)
end
end
output_page_item (a_item: WIZARD_PAGE_ITEM)
local
b: BOOLEAN
s: detachable READABLE_STRING_32
do
if attached {WIZARD_PAGE_TEXT_ITEM} a_item as txt then
localized_print (txt.text)
localized_print ("%N")
elseif attached {WIZARD_QUESTION} a_item then
localized_print (" -> ")
if attached {WIZARD_BOOLEAN_QUESTION} a_item as l_bool_question then
l_bool_question.set_value (boolean_question (l_bool_question.title, <<["y", True], ["n", False]>>, l_bool_question.value))
elseif attached {WIZARD_INTEGER_QUESTION} a_item as l_integer_question then
l_integer_question.set_text (string_question (l_integer_question.title, Void, l_integer_question.text, False))
elseif attached {WIZARD_STRING_QUESTION} a_item as l_string_question then
l_string_question.set_value (string_question (l_string_question.title, Void, l_string_question.text, False))
elseif attached {WIZARD_DIRECTORY_QUESTION} a_item as l_directory_question then
l_directory_question.set_text (string_question (l_directory_question.title, Void, l_directory_question.text, False))
end
end
end
feature {NONE} -- Implementation
boolean_question (m: READABLE_STRING_GENERAL; a_options: detachable ITERABLE [TUPLE [name: READABLE_STRING_8; value: BOOLEAN]]; a_default: BOOLEAN): BOOLEAN
local
s: STRING_32
def: detachable STRING_32
l_answered: BOOLEAN
l_options: detachable ITERABLE [TUPLE [name: READABLE_STRING_8; value: BOOLEAN]]
do
if l_options = Void then
l_options := a_options
end
if l_options = Void then
l_options := <<["y", True], ["Y", True]>>
end
across
l_options as ic
until
def /= Void
loop
if a_default = ic.item.value then
def := ic.item.name
end
end
from
until
l_answered
loop
localized_print (m)
localized_print (" ")
create s.make_empty
across
l_options as ic
loop
if not s.is_empty then
s.append_character (',')
end
s.append_string_general (ic.item.name)
end
localized_print (" (")
localized_print (s)
localized_print (") ")
if def /= Void then
localized_print ("[default=")
localized_print (def)
localized_print ("] ")
end
localized_print ("?")
io.read_line
s := io.last_string
s.left_adjust
s.right_adjust
if s.is_empty and def /= Void then
create s.make_from_string_general (def)
end
if not s.is_empty then
across
l_options as o
until
l_answered
loop
if o.item.name.same_string (s) then
l_answered := True
Result := o.item.value
end
end
if not l_answered then
l_answered := True
Result := False
end
end
end
end
string_question (m: READABLE_STRING_GENERAL; a_options: detachable ITERABLE [TUPLE [name: READABLE_STRING_8; value: detachable READABLE_STRING_8]]; def: detachable READABLE_STRING_GENERAL; a_required_valid_option: BOOLEAN): detachable STRING_32
local
s: STRING_32
l_answered: BOOLEAN
do
from
until
l_answered
loop
localized_print (m)
localized_print (" ")
create s.make_empty
if a_options /= Void then
across
a_options as ic
loop
if not s.is_empty then
s.append_character (',')
end
s.append_string_general (ic.item.name)
if attached ic.item.value as v then
s.append_character ('=')
s.append_string_general (v)
end
end
localized_print ("(")
localized_print (s)
localized_print (") ")
end
if def /= Void then
localized_print ("[default=")
localized_print (def)
localized_print ("] ")
end
localized_print ("?")
io.read_line
create s.make_from_string_general (io.last_string)
s.left_adjust
s.right_adjust
if s.is_empty and def /= Void then
create s.make_from_string_general (def)
end
if not s.is_empty then
if a_options /= Void then
across
a_options as o
until
l_answered
loop
if o.item.name.same_string (s) then
l_answered := True
if attached o.item.value as l_value then
create Result.make_from_string_general (l_value)
else
Result := Void
end
end
end
end
if not l_answered then
l_answered := True
Result := s
if
a_required_valid_option and then
a_options /= Void and then
not across a_options as o some attached o.item.value as v and then Result.same_string (v) end
then
l_answered := False
Result := Void
end
end
end
end
end
end

View File

@@ -0,0 +1,49 @@
note
description: "Summary description for {CONSOLE_WIZARD_PAGE}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
CONSOLE_WIZARD_PAGE
inherit
WIZARD_PAGE
create
make
feature {WIZARD, WIZARD_ENGINE, WIZARD_PAGE} -- Implementation
reuse
do
-- across
-- items as ic
-- loop
-- unparent (ic.item)
-- end
end
feature -- Helpers
new_string_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): CONSOLE_WIZARD_STRING_QUESTION
do
create Result.make (a_field_id, a_prompt, a_description)
end
new_directory_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): CONSOLE_WIZARD_DIRECTORY_QUESTION
do
create Result.make (a_field_id, a_prompt, a_description)
end
new_boolean_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): CONSOLE_WIZARD_BOOLEAN_QUESTION
do
create Result.make (a_field_id, a_prompt, a_description)
end
new_integer_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): CONSOLE_WIZARD_INTEGER_QUESTION
do
create Result.make (a_field_id, a_prompt, a_description)
end
end

View File

@@ -0,0 +1,59 @@
note
description: "Summary description for {CONSOLE_WIZARD_BOOLEAN_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
CONSOLE_WIZARD_BOOLEAN_QUESTION
inherit
WIZARD_BOOLEAN_QUESTION
undefine
make
end
CONSOLE_WIZARD_QUESTION
create
make
convert
text: {STRING_32}
feature -- Conversion
text: STRING_32
do
if value then
Result := "yes"
else
Result := "no"
end
end
value: BOOLEAN
feature -- Element change
set_title (t: READABLE_STRING_GENERAL)
do
create title.make_from_string_general (t)
end
set_text (t: detachable READABLE_STRING_GENERAL)
do
if t = Void then
set_value (False)
else
set_value (t.is_case_insensitive_equal ("yes"))
end
end
set_value (v: BOOLEAN)
do
value := v
end
end

View File

@@ -0,0 +1,59 @@
note
description: "Summary description for {CONSOLE_WIZARD_DIRECTORY_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
CONSOLE_WIZARD_DIRECTORY_QUESTION
inherit
WIZARD_DIRECTORY_QUESTION
undefine
make
end
CONSOLE_WIZARD_QUESTION
create
make
convert
text: {STRING_32}
feature -- Conversion
text: STRING_32
do
if attached value as v then
Result := v.name
else
create Result.make_empty
end
end
value: detachable PATH
feature -- Element change
set_title (t: READABLE_STRING_GENERAL)
do
create title.make_from_string_general (t)
end
set_text (t: detachable READABLE_STRING_GENERAL)
do
if t = Void then
set_value (Void)
else
set_value (create {PATH}.make_from_string (t))
end
end
set_value (v: detachable PATH)
do
value := v
end
end

View File

@@ -0,0 +1,34 @@
note
description: "Summary description for {CONSOLE_WIZARD_INPUT_FIELD}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
CONSOLE_WIZARD_INPUT_FIELD
inherit
WIZARD_INPUT_FIELD
WIZARD_PAGE_ITEM
feature -- Access
item_id: detachable READABLE_STRING_8
-- Optional id to identify related page item.
do
Result := id
end
feature -- Conversion
data: detachable ANY
feature -- Element change
set_data (d: like data)
do
data := d
end
end

View File

@@ -0,0 +1,58 @@
note
description: "Summary description for {CONSOLE_WIZARD_INTEGER_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
CONSOLE_WIZARD_INTEGER_QUESTION
inherit
WIZARD_INTEGER_QUESTION
undefine
make
end
CONSOLE_WIZARD_QUESTION
create
make
convert
text: {STRING_32}
feature -- Conversion
text: STRING_32
do
create Result.make_empty
Result.append_integer (value)
end
value: INTEGER
feature -- Element change
set_title (t: READABLE_STRING_GENERAL)
do
create title.make_from_string_general (t)
end
set_text (t: detachable READABLE_STRING_GENERAL)
do
if t = Void then
set_value (0)
elseif t.is_integer then
set_value (t.to_integer)
else
-- Ignore !
end
end
set_value (v: INTEGER)
do
value := v
end
end

View File

@@ -0,0 +1,32 @@
note
description: "Summary description for {CONSOLE_WIZARD_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
CONSOLE_WIZARD_QUESTION
inherit
WIZARD_QUESTION
redefine
make
end
CONSOLE_WIZARD_INPUT_FIELD
rename
make as make_field
undefine
make_field
end
feature {NONE} -- Initialization
make (a_id: like id; a_title: READABLE_STRING_GENERAL; a_optional_description: detachable READABLE_STRING_GENERAL)
-- Create field identified by `a_id', with title `a_title'
-- and optional description `a_optional_description'.
do
Precursor (a_id, a_title, a_optional_description)
end
end

View File

@@ -0,0 +1,63 @@
note
description: "Summary description for {CONSOLE_WIZARD_STRING_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
CONSOLE_WIZARD_STRING_QUESTION
inherit
WIZARD_STRING_QUESTION
undefine
make
end
CONSOLE_WIZARD_QUESTION
create
make
convert
text: {STRING_32}
feature -- Conversion
text: STRING_32
do
if attached value as v then
Result := v
else
create Result.make_empty
end
end
value: detachable STRING_32
feature -- Element change
set_title (t: READABLE_STRING_GENERAL)
do
create title.make_from_string_general (t)
end
set_text (t: detachable READABLE_STRING_GENERAL)
do
if t = Void then
set_value (Void)
else
set_value (create {STRING_32}.make_from_string_general (t))
end
end
set_value (v: detachable READABLE_STRING_GENERAL)
do
if v = Void then
value := Void
else
create value.make_from_string_general (v)
end
end
end

View File

@@ -0,0 +1,25 @@
note
description: "Summary description for {WIZARD_BOOLEAN_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WIZARD_BOOLEAN_QUESTION
inherit
WIZARD_QUESTION
feature -- Access
value: BOOLEAN
deferred
end
feature -- Element change
set_value (v: like value)
deferred
end
end

View File

@@ -0,0 +1,26 @@
note
description: "Summary description for {WIZARD_DIRECTORY_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WIZARD_DIRECTORY_QUESTION
inherit
WIZARD_QUESTION
feature -- Access
value: detachable PATH
deferred
end
feature -- Element change
set_value (v: detachable PATH)
deferred
end
end

View File

@@ -0,0 +1,61 @@
note
description: "Summary description for {WIZARD_INPUT_FIELD}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WIZARD_INPUT_FIELD
inherit
WIZARD_PAGE_ITEM
feature {NONE} -- Initialization
make (a_id: READABLE_STRING_8)
-- Create field identified by `a_id'.
do
id := a_id
end
feature -- Access
id: READABLE_STRING_8
validation: detachable PROCEDURE [ANY, TUPLE [WIZARD_PAGE]]
feature -- Validation
validate (a_page: WIZARD_PAGE)
do
if attached validation as act then
act.call ([a_page])
end
end
feature -- Conversion
data: detachable ANY
deferred
end
text: STRING_32
deferred
end
feature -- Element change
set_text (t: detachable READABLE_STRING_GENERAL)
deferred
end
set_data (d: like data)
deferred
end
set_validation (act: like validation)
do
validation := act
end
end

View File

@@ -0,0 +1,25 @@
note
description: "Summary description for {WIZARD_INTEGER_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WIZARD_INTEGER_QUESTION
inherit
WIZARD_QUESTION
feature -- Access
value: INTEGER
deferred
end
feature -- Element change
set_value (v: like value)
deferred
end
end

View File

@@ -0,0 +1,42 @@
note
description: "Summary description for {WIZARD_PAGE_SECTION_ITEM}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WIZARD_PAGE_SECTION_ITEM
inherit
WIZARD_PAGE_ITEM
create
make
feature {NONE} -- Initialization
make (a_text: READABLE_STRING_GENERAL)
do
set_text (a_text)
end
feature -- Access
text: IMMUTABLE_STRING_32
item_id: detachable READABLE_STRING_8
-- Optional id to identify related page item.
feature -- Element change
set_text (a_text: READABLE_STRING_GENERAL)
do
create text.make_from_string_general (a_text)
end
set_item_id (a_id: like item_id)
do
item_id := a_id
end
end

View File

@@ -0,0 +1,49 @@
note
description: "Summary description for {WIZARD_PAGE_TEXT_ITEM}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WIZARD_PAGE_TEXT_ITEM
inherit
WIZARD_PAGE_ITEM
create
make
feature {NONE} -- Initialization
make (a_text: READABLE_STRING_GENERAL)
do
set_text (a_text)
end
feature -- Access
is_fixed_size: BOOLEAN
text: IMMUTABLE_STRING_32
item_id: detachable READABLE_STRING_8
-- Optional id to identify related page item.
feature -- Element change
set_text (a_text: READABLE_STRING_GENERAL)
do
create text.make_from_string_general (a_text)
end
set_is_fixed_size (v: BOOLEAN)
do
is_fixed_size := v
end
set_item_id (a_id: like item_id)
do
item_id := a_id
end
end

View File

@@ -0,0 +1,39 @@
note
description: "Summary description for {WIZARD_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WIZARD_QUESTION
inherit
WIZARD_INPUT_FIELD
rename
make as make_field
end
feature {NONE} -- Initialization
make (a_id: like id; a_title: READABLE_STRING_GENERAL; a_optional_description: detachable READABLE_STRING_GENERAL)
-- Create field identified by `a_id', with title `a_title'
-- and optional description `a_optional_description'.
do
create title.make_from_string_general (a_title)
if a_optional_description /= Void then
create description.make_from_string_general (a_optional_description)
else
description := Void
end
make_field (a_id)
end
feature -- Access
title: IMMUTABLE_STRING_32
-- Title associated with input field.
description: detachable IMMUTABLE_STRING_32
-- Optional description.
end

View File

@@ -0,0 +1,25 @@
note
description: "Summary description for {WIZARD_STRING_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WIZARD_STRING_QUESTION
inherit
WIZARD_QUESTION
feature -- Access
value: detachable STRING_32
deferred
end
feature -- Element change
set_value (v: detachable READABLE_STRING_GENERAL)
deferred
end
end

View File

@@ -0,0 +1,87 @@
note
description: "Summary description for {WIZARD_DATA}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WIZARD_DATA
inherit
TABLE_ITERABLE [WIZARD_PAGE_DATA, READABLE_STRING_GENERAL]
create
make
feature {NONE} -- Initialization
make (nb: INTEGER)
do
create page_data_items.make_caseless (nb)
end
feature -- Access
page_data (k: READABLE_STRING_GENERAL): detachable WIZARD_PAGE_DATA
do
Result := page_data_items.item (k)
end
item (a_nested_identifier: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
-- Data related to `a_nested_identifier'
-- following convention "$page_id:$field_id"
local
p: INTEGER
pid,fid: READABLE_STRING_GENERAL
s: STRING_32
do
p := a_nested_identifier.index_of (':', 1)
if p > 0 then
pid := a_nested_identifier.head (p - 1)
fid := a_nested_identifier.substring (p + 1, a_nested_identifier.count)
if attached page_data (pid) as d then
Result := d.item (fid)
end
else
-- Search in all records
across
page_data_items as ic
until
Result /= Void
loop
create s.make_from_string_general (ic.key)
s.append_character (':')
s.append_string_general (a_nested_identifier)
Result := item (s)
end
end
end
boolean_item (a_nested_identifier: READABLE_STRING_GENERAL): BOOLEAN
do
if attached item (a_nested_identifier) as v then
Result := v.is_case_insensitive_equal_general ("yes") or
v.is_case_insensitive_equal_general ("true") or
v.is_case_insensitive_equal_general ("on")
end
end
new_cursor: HASH_TABLE_ITERATION_CURSOR [WIZARD_PAGE_DATA, READABLE_STRING_GENERAL]
-- <Precursor>
do
Result := page_data_items.new_cursor
end
feature -- Change
record_page_data (v: WIZARD_PAGE_DATA; k: READABLE_STRING_GENERAL)
do
page_data_items.force (v, k)
end
feature {NONE} -- Implementation
page_data_items: STRING_TABLE [WIZARD_PAGE_DATA]
end

View File

@@ -0,0 +1,303 @@
note
description: "Summary description for {WIZARD_PAGE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WIZARD_PAGE
inherit
DEBUG_OUTPUT
feature {NONE} -- Initialization
make (a_id: READABLE_STRING_8)
do
create items.make (0)
create data.make (a_id)
create fields.make_caseless (0)
create page_id.make_from_string (a_id)
create update_actions
end
feature -- Access
page_id: IMMUTABLE_STRING_8
title: detachable IMMUTABLE_STRING_32
subtitle: detachable IMMUTABLE_STRING_32
previous_page: detachable WIZARD_PAGE
validation: detachable PROCEDURE [ANY, TUPLE [WIZARD_PAGE]]
update_actions: ACTION_SEQUENCE [TUPLE]
feature -- Access: data
items: ARRAYED_LIST [WIZARD_PAGE_ITEM]
fields: STRING_TABLE [WIZARD_INPUT_FIELD]
data: WIZARD_PAGE_DATA
field_value alias "[]" (a_field_id: READABLE_STRING_8): detachable READABLE_STRING_32
-- Data related to existing field `a_field_id'.
require
associated_field_exists: fields.has (a_field_id)
do
Result := data.item (a_field_id)
end
boolean_field_value alias "&" (a_field_id: READABLE_STRING_8): BOOLEAN
-- Boolean data related to existing field `a_field_id'.
require
associated_field_exists: fields.has (a_field_id)
do
Result := data.boolean_item (a_field_id)
end
feature -- Status report
has_header: BOOLEAN
do
Result := title /= Void or subtitle /= Void or (attached reports as lst and then not lst.is_empty)
end
has_reports: BOOLEAN
do
Result := attached reports as lst and then not lst.is_empty
end
has_error: BOOLEAN
do
Result := attached reports as lst and then across lst as ic some ic.item.type = error_report_type end
end
has_warning: BOOLEAN
do
Result := attached reports as lst and then across lst as ic some ic.item.type = warning_report_type end
end
feature -- Debug report
debug_output: STRING_32
-- String that should be displayed in debugger to represent `Current'.
do
create Result.make_from_string_general (page_id)
end
feature -- Element change
set_data (a_data: like data)
do
data := a_data
apply_data
end
set_title (t: detachable READABLE_STRING_GENERAL)
do
if t = Void then
title := Void
else
create title.make_from_string_general (t)
end
end
set_subtitle (t: detachable READABLE_STRING_GENERAL)
do
if t = Void then
subtitle := Void
else
create subtitle.make_from_string_general (t)
end
end
set_previous_page (a_prev: detachable WIZARD_PAGE)
do
previous_page := a_prev
end
feature -- Element change
set_validation (act: like validation)
do
validation := act
end
feature -- UI fields building
extend (a_item: WIZARD_PAGE_ITEM)
do
items.extend (a_item)
if attached {WIZARD_INPUT_FIELD} a_item as f then
fields.force (f, f.id)
end
end
feature -- UI building
frozen add_section_text (a_text: READABLE_STRING_GENERAL)
do
extend (new_section_item (a_text))
end
frozen add_text (a_text: READABLE_STRING_GENERAL)
do
extend (new_text_item (a_text))
end
frozen add_fixed_size_text (a_text: READABLE_STRING_GENERAL)
do
extend (new_fixed_size_text_item (a_text))
end
feature -- Helpers
frozen add_string_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL)
do
extend (new_string_question (a_prompt, a_field_id, a_description))
end
frozen add_directory_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL)
do
extend (new_directory_question (a_prompt, a_field_id, a_description))
end
frozen add_boolean_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL)
do
extend (new_boolean_question (a_prompt, a_field_id, a_description))
end
frozen add_integer_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL)
do
extend (new_integer_question (a_prompt, a_field_id, a_description))
end
feature -- Helper Factory
new_section_item (a_text: READABLE_STRING_GENERAL): WIZARD_PAGE_SECTION_ITEM
do
create Result.make (a_text)
end
new_text_item (a_text: READABLE_STRING_GENERAL): WIZARD_PAGE_TEXT_ITEM
do
create Result.make (a_text)
end
new_fixed_size_text_item (a_text: READABLE_STRING_GENERAL): WIZARD_PAGE_TEXT_ITEM
do
create Result.make (a_text)
Result.set_is_fixed_size (True)
end
new_string_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): WIZARD_STRING_QUESTION
deferred
end
new_directory_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): WIZARD_DIRECTORY_QUESTION
deferred
end
new_boolean_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): WIZARD_BOOLEAN_QUESTION
deferred
end
new_integer_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): WIZARD_INTEGER_QUESTION
deferred
end
feature -- Basic operations
validate
-- Validate input field value.
local
l_field: WIZARD_INPUT_FIELD
do
reset_reports
across
fields as ic
loop
l_field := ic.item
l_field.validate (Current)
data.force (l_field.text, l_field.id)
end
if attached validation as act then
act.call ([Current])
end
end
feature {WIZARD, WIZARD_APPLICATION, WIZARD_PAGE} -- Implementation
reuse
deferred
end
apply_data
local
l_field: WIZARD_INPUT_FIELD
do
update_actions.call (Void)
across
fields as ic
loop
l_field := ic.item
if attached data.item (l_field.id) as v then
l_field.set_text (v)
end
end
end
feature -- Reporting
reset_reports
do
reports := Void
end
reports: detachable ARRAYED_LIST [TUPLE [message: IMMUTABLE_STRING_32; type: INTEGER]]
report (m: READABLE_STRING_GENERAL; a_type: INTEGER)
local
lst: like reports
l_message: IMMUTABLE_STRING_32
do
lst := reports
if lst = Void then
create lst.make (1)
reports := lst
end
if attached {IMMUTABLE_STRING_32} m as imm32 then
l_message := imm32
else
create l_message.make_from_string_general (m)
end
lst.force ([l_message, a_type])
end
report_information (m: READABLE_STRING_GENERAL)
do
report (m, information_report_type)
end
report_warning (m: READABLE_STRING_GENERAL)
do
report (m, warning_report_type)
end
report_error (m: READABLE_STRING_GENERAL)
do
report (m, error_report_type)
end
information_report_type: INTEGER = 1
warning_report_type: INTEGER = 2
error_report_type: INTEGER = 3
end

View File

@@ -0,0 +1,91 @@
note
description: "Summary description for {WIZARD_PAGE_DATA}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WIZARD_PAGE_DATA
inherit
TABLE_ITERABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
DEBUG_OUTPUT
create
make
feature {NONE} -- Initialization
make (a_page_id: READABLE_STRING_8)
do
page_id := a_page_id
create items.make_caseless (0)
end
feature -- Access
page_id: READABLE_STRING_8
-- Associated page id.
item (k: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
do
Result := items.item (k)
end
boolean_item (k: READABLE_STRING_GENERAL): BOOLEAN
do
if attached item (k) as v then
Result := v.is_case_insensitive_equal_general ("yes") or
v.is_case_insensitive_equal_general ("true") or
v.is_case_insensitive_equal_general ("on")
end
end
items: STRING_TABLE [READABLE_STRING_32]
count: INTEGER
do
Result := items.count
end
new_cursor: HASH_TABLE_ITERATION_CURSOR [READABLE_STRING_32, READABLE_STRING_GENERAL]
-- <Precursor>
do
Result := items.new_cursor
end
feature -- Status report
has (k: READABLE_STRING_GENERAL): BOOLEAN
-- Has item indexed by `k'?
do
Result := items.has (k)
end
debug_output: STRING_32
-- String that should be displayed in debugger to represent `Current'.
do
create Result.make_from_string_general (page_id)
Result.append (" count=")
Result.append_integer (count)
end
feature -- Change
put (v: READABLE_STRING_32; k: READABLE_STRING_GENERAL)
do
items.put (v, k)
end
force (v: READABLE_STRING_32; k: READABLE_STRING_GENERAL)
do
items.force (v, k)
end
remove (k: READABLE_STRING_GENERAL)
do
items.remove (k)
end
end

View File

@@ -0,0 +1,17 @@
note
description: "Summary description for {WIZARD_PAGE_ITEM}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WIZARD_PAGE_ITEM
feature -- Access
item_id: detachable READABLE_STRING_8
-- Optional id to identify related page item.
deferred
end
end

View File

@@ -0,0 +1,20 @@
note
description: "Summary description for {WIZARD_FAILED_RESPONSE}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WIZARD_FAILED_RESPONSE
inherit
WIZARD_RESPONSE
feature -- Output
send (f: FILE)
do
f.put_string ("Success=%"no%"%N")
end
end

View File

@@ -0,0 +1,16 @@
note
description: "Summary description for {WIZARD_RESPONSE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WIZARD_RESPONSE
feature -- Output
send (f: FILE)
deferred
end
end

View File

@@ -0,0 +1,68 @@
note
description: "Summary description for {WIZARD_SUCCEED_RESPONSE}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WIZARD_SUCCEED_RESPONSE
inherit
WIZARD_RESPONSE
create
make
feature {NONE} -- Initialization
make (a_conf_fn: like configuration_file_name; a_dir: like directory_name)
do
configuration_file_name := a_conf_fn
directory_name := a_dir
end
feature -- Access
configuration_file_name: PATH
directory_name: PATH
compile_enabled: BOOLEAN
freeze_required: BOOLEAN
feature -- Element Change
set_compile_enabled (b: BOOLEAN)
do
compile_enabled := b
end
set_freeze_required (b: BOOLEAN)
do
freeze_required := b
end
feature -- Constants
melt_compilation: INTEGER = 0
freeze_compilation: INTEGER = 1
feature -- Output
send (f: FILE)
do
f.put_string ("Success=%"yes%"%N")
f.put_string ("Ace=%"" + configuration_file_name.utf_8_name + "%"%N")
f.put_string ("Directory=%"" + directory_name.utf_8_name + "%"%N")
if compile_enabled then
f.put_string ("Compilation=%"yes%"%N")
else
f.put_string ("Compilation=%"no%"%N")
end
if freeze_required then
f.put_string ("Compilation_type=%"freeze%"%N")
elseif compile_enabled then
f.put_string ("Compilation_type=%"melt%"%N")
end
end
end

View File

@@ -0,0 +1,115 @@
note
description: "Summary description for {WIZARD}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WIZARD
feature {NONE} -- Initialization
make (app: WIZARD_APPLICATION)
do
application := app
end
feature {WIZARD_GENERATOR} -- Access
application: WIZARD_APPLICATION
feature -- Access
title: STRING_32
deferred
end
feature -- Factory
wizard_generator : WIZARD_GENERATOR
deferred
end
new_page (a_page_id: READABLE_STRING_8): WIZARD_PAGE
do
Result := application.new_page (a_page_id)
end
next_page (a_current_page: detachable WIZARD_PAGE): WIZARD_PAGE
deferred
end
notfound_page: WIZARD_PAGE
once
Result := new_page ("notfound")
Result.set_title ("Page Not Found")
Result.set_subtitle ("Internal error in the wizard state machine.")
-- if Result.previous_page /= Void then
-- Result.set_back_action (agent on_back)
-- end
-- Result.set_cancel_action (agent on_cancel)
end
feature -- Pages
first_page: WIZARD_PAGE
deferred
end
final_page: WIZARD_PAGE
deferred
end
feature -- Events
on_back
do
application.on_back
end
on_cancel
do
application.on_cancel
end
on_next
do
application.on_next
end
on_finish
do
application.on_finish
end
feature {NONE} -- Initialization
formatted_title_value_items (lst: ITERABLE [TUPLE [title: READABLE_STRING_GENERAL; value: READABLE_STRING_GENERAL]]): STRING_32
local
t: STRING_32
m: INTEGER
do
across
lst as ic
loop
m := m.max (ic.item.title.count)
end
m := m + 1
create Result.make_empty
across
lst as ic
loop
create t.make_from_string_general (ic.item.title)
t.append (create {STRING_32}.make_filled (' ', m - t.count))
t.append_character (':')
t.append_character (' ')
t.append_string_general (ic.item.value)
t.append_character ('%N')
Result.append (t)
end
end
end

View File

@@ -0,0 +1,268 @@
note
description : "Objects that ..."
author : "$Author$"
date : "$Date$"
revision : "$Revision$"
deferred class
WIZARD_APPLICATION
inherit
ARGUMENTS
SHARED_EXECUTION_ENVIRONMENT
feature {NONE} -- Initialization
initialize
-- Initialize `Current'.
local
i,n: INTEGER
s: READABLE_STRING_8
wizard_directory_name: detachable PATH
callback_file_name: detachable PATH
do
-- Usage
n := argument_count
if n > 0 then
from
i := 1
until
i > n
loop
s := argument (i)
if s.same_string ("-callback") or s.same_string ("--callback") then
i := i + 1
if i <= n then
create callback_file_name.make_from_string (argument (i))
end
elseif wizard_directory_name = Void then
create wizard_directory_name.make_from_string (s)
else
debug
io.error.put_string ("Ignoring argument %"" + s + "%"%N")
end
end
i := i + 1
end
end
if wizard_directory_name = Void then
create layout.make (execution_environment.current_working_path, execution_environment.current_working_path.extended ("wizard.cb"))
display_usage (io.error)
quit ("ERROR: Missing wizard directory name.")
elseif callback_file_name = Void then
create layout.make (execution_environment.current_working_path, execution_environment.current_working_path.extended ("wizard.cb"))
display_usage (io.error)
quit ("ERROR: Missing Eiffel Studio callback file name.")
else
create layout.make (wizard_directory_name, callback_file_name)
end
-- Values
create data.make (10)
create variables.make (5)
create page_history.make (10)
-- Wizard
wizard := new_wizard
end
new_wizard: WIZARD
-- Build new wizard.
-- To be redefined.
deferred
end
wizard: like new_wizard
-- Associated Wizard.
feature -- Helpers
display_usage (f: FILE)
do
f.put_string ("Usage: wizard {dirname} -callback {filename}%N")
f.put_string (" -callback filename: file used to communicate back with Eiffel Studio%N")
f.put_string (" dirname: folder containing the wizard resources, pixmaps, ...%N")
end
quit (a_failure_message: detachable READABLE_STRING_8)
do
if a_failure_message /= Void then
io.error.put_string (a_failure_message)
end
send_response (create {WIZARD_FAILED_RESPONSE})
die (-1)
ensure
False -- never reached
end
die (code: INTEGER)
do
(create {EXCEPTIONS}).die (code)
end
available_directory_path (a_name: READABLE_STRING_GENERAL; a_folder: PATH): PATH
local
ut: FILE_UTILITIES
ok: BOOLEAN
p: PATH
l_name: STRING_32
l_ext: detachable READABLE_STRING_32
i: INTEGER
do
from
Result := a_folder.extended (a_name)
ok := not ut.directory_path_exists (Result)
p := Result
if not ok then
if attached p.extension as ext then
l_ext := ext
l_name := p.name
l_name.remove_head (ext.count + 1)
create p.make_from_string (l_name)
end
end
until
ok
loop
i := i + 1
Result := p.appended ("_" + i.out)
if l_ext /= Void then
Result := Result.appended_with_extension (l_ext)
end
ok := not ut.directory_path_exists (Result)
end
end
feature -- Access
variables: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8]
layout: WIZARD_LAYOUT
data: WIZARD_DATA
feature -- State
current_page: detachable WIZARD_PAGE
do
if not page_history.is_empty then
Result := page_history.item
end
end
next_page (a_current_page: detachable WIZARD_PAGE): WIZARD_PAGE
do
Result := wizard.next_page (a_current_page)
if Result /= a_current_page then
Result.set_previous_page (a_current_page)
end
end
page_history: ARRAYED_STACK [WIZARD_PAGE]
feature -- Factory
new_page (a_page_id: READABLE_STRING_8): WIZARD_PAGE
deferred
end
feature -- Events
set_page (a_page: WIZARD_PAGE)
do
a_page.reuse
if attached data.page_data (a_page.page_id) as l_page_data then
a_page.set_data (l_page_data)
end
page_history.force (a_page)
ensure
current_page_set: current_page = a_page
end
on_start
do
set_page (next_page (Void))
end
on_refresh
do
if attached current_page as pg then
pg.validate
data.record_page_data (pg.data, pg.page_id)
set_page (pg)
else
check refresh_expected: False end
end
end
on_back
do
if
attached current_page as pg and then
attached pg.previous_page as l_prev
then
pg.validate
data.record_page_data (pg.data, pg.page_id)
page_history.remove
page_history.remove
set_page (l_prev)
end
end
on_next
do
if attached current_page as pg then
pg.validate
if pg.has_error then
on_refresh
else
data.record_page_data (pg.data, pg.page_id)
set_page (next_page (pg))
end
else
set_page (next_page (Void))
end
end
on_cancel
do
quit (Void) --"Cancelled")
end
on_generate
do
wizard.wizard_generator.execute (data)
end
on_finish
do
if attached current_page as pg then
if pg.has_error then
on_refresh
else
on_generate
end
else
on_refresh
end
end
feature -- Response
send_response (res: WIZARD_RESPONSE)
local
f: RAW_FILE
do
create f.make_with_path (layout.callback_file_location)
if not f.exists or else f.is_writable then
f.open_write
res.send (f)
f.close
else
die (-1)
end
end
end

View File

@@ -0,0 +1,235 @@
note
description: "Summary description for {WIZARD_GENERATOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WIZARD_GENERATOR
feature {NONE} -- Initialization
make (a_wizard: WIZARD)
do
wizard := a_wizard
initialize
end
initialize
do
create variables.make_caseless (0)
end
feature -- Access
wizard: WIZARD
application: WIZARD_APPLICATION
do
Result := wizard.application
end
feature -- Access
variables: STRING_TABLE [READABLE_STRING_8]
-- Variables used for template and file name resolved string.
--| i.e to expand ${varname} in file name or file content.
--| could be used for other purpose.
feature -- Execution
execute (a_collection: WIZARD_DATA)
deferred
end
feature -- Response
send_response (res: WIZARD_RESPONSE)
do
application.send_response (res)
end
feature -- Factory
new_uuid: STRING_8
local
gen: UUID_GENERATOR
do
create gen
Result := gen.generate_uuid.out
end
feature -- Operations
copy_file (a_src, a_target: PATH)
local
f,t: RAW_FILE
do
create f.make_with_path (a_src)
if f.exists and f.is_readable then
create t.make_with_path (a_target)
if not t.exists or else t.is_writable then
f.open_read
t.open_write
f.copy_to (t)
t.close
f.close
end
end
end
feature -- Resources
copy_resource (a_res: READABLE_STRING_8; a_target: PATH)
do
copy_file (application.layout.resource_location (a_res), a_target)
end
copy_resource_template (a_res: READABLE_STRING_GENERAL; a_target: PATH)
do
copy_template (application.layout.resource_location (a_res), a_target)
end
feature -- Templates
is_template_file (f: PATH): BOOLEAN
-- Is file at location `p' potentially a template?
deferred
end
recursive_copy_templates (a_src: PATH; a_target: PATH)
local
d,td, subdir: DIRECTORY
p, ip, tp: PATH
do
create d.make_with_path (a_src)
if d.exists and then d.is_readable then
create td.make_with_path (a_target)
td.recursive_create_dir
across
d.entries as ic
loop
p := ic.item
if p.is_parent_symbol or p.is_current_symbol then
else
ip := a_src.extended_path (p)
create subdir.make_with_path (ip)
tp := a_target.extended_path (resolved_path_name (p))
if subdir.exists then
recursive_copy_templates (ip, tp)
else
if is_template_file (ip) then
copy_template (ip, tp)
else
copy_file (ip, tp)
end
end
end
end
end
end
copy_template (a_src: PATH; a_target: PATH)
require
a_src_is_a_template_file: is_template_file (a_src)
local
f,t: PLAIN_TEXT_FILE
line: READABLE_STRING_8
do
create f.make_with_path (a_src)
if f.exists and f.is_readable then
create t.make_with_path (a_target)
if not t.exists or else t.is_writable then
f.open_read
t.create_read_write
from
f.read_line
until
f.exhausted
loop
line := f.last_string
t.put_string (resolved_string_8 (line))
t.put_new_line
f.read_line
end
t.close
f.close
end
end
end
feature -- Resolvers
resolved_string_8 (a_text: READABLE_STRING_8): READABLE_STRING_8
local
s: detachable STRING_8
do
create s.make (a_text.count)
append_resolved_string_to (a_text, s)
Result := s
end
append_resolved_string_to (s: READABLE_STRING_GENERAL; a_output: STRING_GENERAL)
-- Resolved name for `a_path'.
local
i,n,p,q: INTEGER
k: READABLE_STRING_GENERAL
do
from
i := 1
n := s.count
q := 0
until
i > n
loop
p := s.substring_index ("${", i)
if p > 0 and (p > 1 implies s [p - 1] /= '$') then -- not escaped
if p > i then
a_output.append (s.substring (i, p - 1))
end
i := p
q := s.index_of ('}', i + 2)
if q > 0 then
k := s.substring (p + 2, q - 1)
if attached variables.item (k) as v then
a_output.append (v.as_lower)
else
a_output.append (s.substring (p, q))
end
i := q + 1
else
a_output.append (s.substring (i, n))
i := n + 1
end
else
a_output.append (s.substring (i, n))
i := n + 1
end
end
end
resolved_string (s: READABLE_STRING_32): READABLE_STRING_32
-- Resolved string for `s'.
local
t: STRING_32
do
create t.make (s.count)
append_resolved_string_to (s, t)
Result := t
end
resolved_path_name (a_path: PATH): PATH
-- Resolved name for `a_path'.
local
n,s: READABLE_STRING_32
do
n := a_path.name
s := resolved_string (n)
if s.same_string (n) then
Result := a_path
else
create Result.make_from_string (s)
end
end
end

View File

@@ -0,0 +1,64 @@
note
description: "Summary description for {WIZARD_LAYOUT}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WIZARD_LAYOUT
inherit
SHARED_EXECUTION_ENVIRONMENT
create
make
feature {NONE} -- Initialization
make (d: like wizard_location; cb: like callback_file_location)
do
wizard_location := d.absolute_path
callback_file_location := cb.absolute_path
end
feature -- Access
wizard_location: PATH
resources_location: PATH
do
Result := wizard_location.extended ("resources")
end
pixmaps_location: PATH
do
Result := wizard_location.extended ("pixmaps")
end
templates_location: PATH
do
Result := wizard_location.extended ("templates")
end
resource_location (a_name: READABLE_STRING_GENERAL): PATH
do
Result := resources_location.extended (a_name)
end
pixmap_png_location (a_name: READABLE_STRING_GENERAL): PATH
do
Result := pixmaps_location.extended (a_name).appended_with_extension ("png")
end
callback_file_location: PATH
default_projects_location: PATH
do
if attached execution_environment.item ("ISE_PROJECTS") as dn then
create Result.make_from_string (dn)
else
Result := execution_environment.current_working_path
end
end
end

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="estudio_console_wizard" uuid="F6ED77CC-077C-48B6-B730-25CB7C62558D" library_target="estudio_console_wizard">
<target name="estudio_console_wizard">
<root all_classes="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="encoding" location="$ISE_LIBRARY\library\encoding\encoding-safe.ecf"/>
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid-safe.ecf"/>
<cluster name="core" location=".\core" recursive="true"/>
<cluster name="console" location=".\console" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="estudio_gui_wizard" uuid="6E6AAD4F-8869-428A-B507-54EACE8613E9" library_target="estudio_gui_wizard">
<target name="estudio_gui_wizard">
<root all_classes="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="encoding" location="$ISE_LIBRARY\library\encoding\encoding-safe.ecf"/>
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid-safe.ecf"/>
<library name="vision2" location="$ISE_LIBRARY\library\vision2\vision2-safe.ecf"/>
<cluster name="core" location=".\core" recursive="true"/>
<cluster name="console" location=".\console" recursive="true"/>
<cluster name="graphical" location=".\gui" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,383 @@
note
description : "Objects that ..."
author : "$Author$"
date : "$Date$"
revision : "$Revision$"
deferred class
GRAPHICAL_WIZARD_APPLICATION
inherit
WIZARD_APPLICATION
redefine
initialize, on_generate, set_page
end
GRAPHICAL_WIZARD_STYLER
EV_SHARED_APPLICATION
feature {NONE} -- Initialization
initialize
do
Precursor
create main
end
build_interface (a_container: EV_CONTAINER)
do
set_title (wizard.title)
set_size (default_width, default_height)
main.put (create {EV_LABEL}.make_with_text ("Loading ..."))
a_container.extend (main)
on_start
end
feature -- UI change
set_title (a_title: READABLE_STRING_GENERAL)
deferred
end
set_size (w,h: INTEGER)
deferred
end
feature {NONE} -- Widget
main: EV_CELL
feature -- Factory
new_page (a_page_id: READABLE_STRING_8): GRAPHICAL_WIZARD_PAGE
local
lab: EV_LABEL
do
create Result.make (a_page_id)
end
side_bar_items (a_page: WIZARD_PAGE): ARRAYED_LIST [WIZARD_PAGE_ITEM]
-- Items to put on side bar for page `a_page'.
-- None by default.
do
create Result.make (0)
end
feature -- Change
set_page (a_page: WIZARD_PAGE)
local
b: EV_VERTICAL_BOX
do
Precursor (a_page)
create b
append_page_to (a_page, b)
b.set_data (a_page)
main.replace (b)
end
feature {NONE} -- Implementation: UI
append_page_to (a_page: WIZARD_PAGE; a_container: EV_CONTAINER)
require
a_container.extendible
local
box: EV_VERTICAL_BOX
hb,hb2: EV_HORIZONTAL_BOX
mb, vb, headerb: EV_VERTICAL_BOX
lab: EV_LABEL
but: EV_BUTTON
cl: EV_CELL
fr: detachable EV_FRAME
do
a_page.apply_data
create box
-- Main
create hb
box.extend (hb)
if attached side_bar_items (a_page) as lst and then not lst.is_empty then
-- ./Left sidebar
create vb
vb.set_background_color (create {EV_COLOR}.make_with_8_bit_rgb (0, 0, 180))
vb.set_minimum_width (150)
vb.set_border_width (10)
vb.set_padding_width (5)
across
lst as ic
loop
if not vb.is_empty then
vb.disable_item_expand (vb.last)
end
if attached {GRAPHICAL_WIZARD_PAGE_ITEM} ic.item as gpi then
vb.extend (gpi.widget)
end
end
vb.propagate_background_color
hb.extend (vb)
hb.disable_item_expand (vb)
end
-- Main part
create mb
hb.extend (mb)
mb.set_background_color (colors.white)
if a_page.has_header then
create fr
fr.set_background_color (colors.white)
create headerb
fr.extend (headerb)
create vb
headerb.extend (vb)
vb.set_border_width (10)
if attached a_page.title as l_title then
create lab.make_with_text (l_title)
apply_title_style (lab)
vb.extend (lab)
vb.disable_item_expand (lab)
if attached a_page.subtitle as l_subtitle then
create hb2
create lab.make_with_text (l_subtitle)
apply_subtitle_style (lab)
create cl
cl.set_minimum_width (vb.border_width)
hb2.extend (cl)
hb2.disable_item_expand (cl)
hb2.extend (lab)
vb.extend (hb2)
vb.disable_item_expand (hb2)
end
end
fr.propagate_background_color
if attached a_page.reports as lst and then not lst.is_empty then
create vb
headerb.extend (vb)
across
lst as ic
loop
create lab.make_with_text (" - " + ic.item.message)
if ic.item.type = {WIZARD_PAGE}.error_report_type then
lab.set_background_color (color_light_red)
lab.set_foreground_color (colors.red)
elseif ic.item.type = {WIZARD_PAGE}.warning_report_type then
lab.set_background_color (color_light_orange)
else
lab.set_background_color (color_light_green)
end
apply_report_style (lab)
vb.extend (lab)
vb.disable_item_expand (lab)
end
end
mb.extend (fr)
mb.disable_item_expand (fr)
fr := Void
end
-- ./Text part
create vb
mb.extend (vb)
vb.set_background_color (colors.default_background_color)
vb.set_border_width (10)
vb.set_padding (5)
across
a_page.items as ic
loop
if not vb.is_empty then
vb.disable_item_expand (vb.last)
end
if attached page_item_to_widget (ic.item) as w then
vb.extend (w)
end
end
if a_page = wizard.first_page then
create lab.make_with_text ("To continue, click [Next].")
apply_text_style (lab)
vb.extend (lab)
end
if a_page = wizard.final_page then
create lab.make_with_text ("Click [Finish] to generate the project.")
apply_text_style (lab)
vb.extend (lab)
end
-- Buttons bar
create fr
box.extend (fr)
box.disable_item_expand (fr)
create hb
fr.extend (hb)
hb.set_border_width (10)
hb.set_background_color (colors.default_background_color)
hb.extend (create {EV_CELL})
if a_page.previous_page /= Void then
add_button_action_to ("< Back", agent on_back, hb)
end
if a_page = wizard.final_page then
add_button_action_to ("Finish", agent on_finish, hb)
else
add_button_action_to ("Next >", agent on_next, hb)
end
create cl
cl.set_minimum_width (hb.border_width)
hb.extend (cl)
hb.disable_item_expand (cl)
add_button_action_to ("Cancel", agent on_cancel, hb)
hb.propagate_background_color
a_container.extend (box)
a_page.reset_reports
end
page_item_to_widget (a_item: WIZARD_PAGE_ITEM): detachable EV_WIDGET
local
lab: EV_LABEL
do
if attached {GRAPHICAL_WIZARD_PAGE_ITEM} a_item as gpi then
Result := gpi.widget
elseif attached {WIZARD_PAGE_TEXT_ITEM} a_item as txt then
create lab.make_with_text (txt.text)
if txt.is_fixed_size then
apply_fixed_size_text_style (lab)
else
apply_text_style (lab)
end
Result := lab
elseif attached {WIZARD_PAGE_SECTION_ITEM} a_item as sect then
create lab.make_with_text (sect.text)
apply_section_style (lab)
Result := lab
end
end
add_button_actions_to (a_text: READABLE_STRING_GENERAL; a_sequence: ACTION_SEQUENCE [TUPLE]; a_box: EV_BOX)
do
if a_sequence.is_empty then
add_button_action_to (a_text, Void, a_box)
else
add_button_action_to (a_text, agent a_sequence.call (Void), a_box)
end
end
add_button_action_to (a_text: READABLE_STRING_GENERAL; a_action: detachable PROCEDURE [ANY, TUPLE]; a_box: EV_BOX)
local
but: EV_BUTTON
do
create but.make_with_text (a_text)
apply_button_style (but)
a_box.extend (but)
a_box.disable_item_expand (but)
if a_action = Void then
but.disable_sensitive
else
but.select_actions.extend (a_action)
end
end
--feature -- State
-- current_page: detachable WIZARD_PAGE
-- do
-- if not page_history.is_empty then
-- Result := page_history.item
-- end
-- end
-- next_page (a_current_page: detachable WIZARD_PAGE): detachable WIZARD_PAGE
-- deferred
-- end
-- page_history: ARRAYED_STACK [WIZARD_PAGE]
feature -- Events
-- on_refresh
-- do
-- if attached current_page as pg then
-- pg.validate
-- data.record_page_data (pg.data, pg.page_id)
-- set_page (pg)
-- else
-- check refresh_expected: False end
-- end
-- end
-- on_back
-- do
-- if
-- attached current_page as pg and then
-- attached pg.previous_page as l_prev
-- then
-- pg.validate
-- data.record_page_data (pg.data, pg.page_id)
-- page_history.remove
-- page_history.remove
-- set_page (l_prev)
-- end
-- end
-- on_next
-- do
-- if attached current_page as pg then
-- pg.validate
-- if pg.has_error then
-- on_refresh
-- else
-- data.record_page_data (pg.data, pg.page_id)
-- if attached next_page (pg) as l_next_page then
-- set_page (l_next_page)
-- else
-- set_page (notfound_page)
-- end
-- end
-- else
-- set_page (notfound_page)
-- end
-- end
-- on_cancel
-- do
-- quit (Void) --"Cancelled")
-- end
on_generate
do
Precursor
ev_application.destroy
end
-- on_finish
-- do
-- if attached current_page as pg then
-- if pg.has_error then
-- on_refresh
-- else
-- on_generate
---- ev_application.destroy
-- end
-- else
-- on_refresh
-- end
-- end
end

View File

@@ -0,0 +1,105 @@
note
description: "Summary description for {GRAPHICAL_WIZARD_PAGE}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
GRAPHICAL_WIZARD_PAGE
inherit
WIZARD_PAGE
-- redefine
-- add_section_text,
-- add_text,
-- add_fixed_size_text
-- end
GRAPHICAL_WIZARD_STYLER
create
make
feature {WIZARD, WIZARD_ENGINE, WIZARD_PAGE} -- Implementation
reuse
do
across
items as ic
loop
unparent (ic.item)
end
end
feature -- UI building
-- add_widget (w: EV_WIDGET; a_opt_id: detachable READABLE_STRING_8)
-- local
-- pw: GRAPHICAL_WIZARD_PAGE_WIDGET
-- do
-- create pw.make_with_widget (w)
-- pw.set_item_id (a_opt_id)
-- items.extend (pw)
-- end
-- add_section_text (a_text: READABLE_STRING_GENERAL; a_opt_id: detachable READABLE_STRING_8)
-- local
-- txt: EV_LABEL
-- do
-- create txt.make_with_text (a_text)
-- apply_section_style (txt)
-- add_widget (txt, a_opt_id)
-- end
-- add_text (a_text: READABLE_STRING_GENERAL; a_opt_id: detachable READABLE_STRING_8)
-- local
-- txt: EV_LABEL
-- do
-- create txt.make_with_text (a_text)
-- apply_text_style (txt)
-- add_widget (txt, a_opt_id)
-- end
-- add_fixed_size_text (a_text: READABLE_STRING_GENERAL; a_opt_id: detachable READABLE_STRING_8)
-- local
-- txt: EV_LABEL
-- do
-- create txt.make_with_text (a_text)
-- apply_fixed_size_text_style (txt)
-- add_widget (txt, a_opt_id)
-- end
feature -- Helpers
new_string_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): GRAPHICAL_WIZARD_STRING_QUESTION
do
create Result.make (a_field_id, a_prompt, a_description)
end
new_directory_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): GRAPHICAL_WIZARD_DIRECTORY_QUESTION
do
create Result.make (a_field_id, a_prompt, a_description)
end
new_boolean_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): GRAPHICAL_WIZARD_BOOLEAN_QUESTION
do
create Result.make (a_field_id, a_prompt, a_description)
end
new_integer_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): GRAPHICAL_WIZARD_INTEGER_QUESTION
do
create Result.make (a_field_id, a_prompt, a_description)
end
feature {NONE} -- Implementation
unparent (i: WIZARD_PAGE_ITEM)
do
if attached {GRAPHICAL_WIZARD_PAGE_ITEM} i as gpi then
if attached gpi.widget.parent as l_parent then
l_parent.prune (gpi.widget)
end
end
end
end

View File

@@ -0,0 +1,19 @@
note
description: "Summary description for {GRAPHICAL_WIZARD_PAGE_ITEM}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
GRAPHICAL_WIZARD_PAGE_ITEM
inherit
WIZARD_PAGE_ITEM
feature -- Conversion
widget: EV_WIDGET
deferred
end
end

View File

@@ -0,0 +1,185 @@
note
description: "Summary description for {GRAPHICAL_WIZARD_STYLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
GRAPHICAL_WIZARD_STYLER
inherit
EV_LAYOUT_CONSTANTS
feature -- Access: layout
default_width: INTEGER = 400
default_height: INTEGER = 350
feature -- Style
apply_title_style (lab: EV_LABEL)
do
lab.align_text_left
lab.align_text_vertical_center
lab.set_foreground_color (colors.black)
lab.set_font (title_font)
end
apply_subtitle_style (lab: EV_LABEL)
do
lab.align_text_left
lab.align_text_vertical_center
lab.set_foreground_color (colors.black)
lab.set_font (subtitle_font)
end
apply_text_style (w: EV_WIDGET)
do
if attached {EV_TEXT_ALIGNABLE} w as l_alignable then
l_alignable.align_text_left
if attached {EV_LABEL} w as lab then
lab.align_text_top
end
end
if attached {EV_COLORIZABLE} w as l_colorizable then
l_colorizable.set_foreground_color (colors.black)
end
if attached {EV_FONTABLE} w as l_fontable then
l_fontable.set_font (text_font)
end
end
apply_fixed_size_text_style (w: EV_WIDGET)
do
apply_text_style (w)
if attached {EV_FONTABLE} w as l_fontable then
l_fontable.set_font (fixed_size_text_font)
end
end
apply_section_style (w: EV_WIDGET)
do
apply_text_style (w)
if attached {EV_FONTABLE} w as l_fontable then
l_fontable.set_font (section_font)
end
end
apply_report_style (w: EV_WIDGET)
do
if attached {EV_TEXT_ALIGNABLE} w as l_alignable then
l_alignable.align_text_left
if attached {EV_LABEL} w as lab then
lab.align_text_top
end
end
if attached {EV_FONTABLE} w as l_fontable then
l_fontable.set_font (report_font)
end
end
apply_field_description_style (w: EV_WIDGET)
do
apply_text_style (w)
if attached {EV_COLORIZABLE} w as l_colorizable then
l_colorizable.set_foreground_color (colors.dark_gray)
end
if attached {EV_FONTABLE} w as l_fontable then
l_fontable.set_font (field_description_font)
end
end
apply_button_style (but: EV_BUTTON)
do
but.set_minimum_width (default_button_width)
but.set_minimum_height (default_button_height)
end
feature -- Access: colors
colors: EV_STOCK_COLORS
once
create Result
end
color_light_yellow: EV_COLOR
once
create Result.make_with_8_bit_rgb (255, 210, 210)
end
color_light_green: EV_COLOR
once
create Result.make_with_8_bit_rgb (150, 255, 150)
end
color_light_orange: EV_COLOR
once
create Result.make_with_8_bit_rgb (255, 210, 50)
end
color_light_red: EV_COLOR
once
create Result.make_with_8_bit_rgb (255, 210, 210)
end
feature -- Access: pixmaps
pixmaps: EV_STOCK_PIXMAPS
once
create Result
end
feature -- Access: fonts
title_font: EV_FONT
once
create Result
Result.set_family ({EV_FONT_CONSTANTS}.family_sans)
Result.set_height_in_points (10)
Result.set_weight ({EV_FONT_CONSTANTS}.weight_bold)
end
subtitle_font: EV_FONT
once
create Result
-- Result.set_family ({EV_FONT_CONSTANTS}.family_sans)
Result.set_height_in_points (9)
-- Result.set_weight ({EV_FONT_CONSTANTS}.weight_thin)
end
section_font: EV_FONT
once
create Result
Result.set_family ({EV_FONT_CONSTANTS}.family_sans)
Result.set_height_in_points (12)
Result.set_weight ({EV_FONT_CONSTANTS}.weight_bold)
end
text_font: EV_FONT
once
create Result
Result.set_height_in_points (9)
end
fixed_size_text_font: EV_FONT
once
create Result
Result.set_height_in_points (9)
Result.set_family ({EV_FONT_CONSTANTS}.family_typewriter)
end
field_description_font: EV_FONT
once
create Result
Result.set_shape ({EV_FONT_CONSTANTS}.shape_italic)
Result.set_height_in_points (9)
end
report_font: EV_FONT
once
create Result
Result.set_height_in_points (9)
end
end

View File

@@ -0,0 +1,39 @@
note
description: "Summary description for {GRAPHICAL_WIZARD_WINDOW}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
GRAPHICAL_WIZARD_WINDOW
inherit
EV_TITLED_WINDOW
rename
data as widget_data
redefine
create_interface_objects,
initialize
end
GRAPHICAL_WIZARD_APPLICATION
rename
initialize as initialize_wizard
undefine
default_create, copy
end
feature {NONE} -- Initialize
create_interface_objects
do
initialize_wizard
end
initialize
do
Precursor
build_interface (Current)
end
end

View File

@@ -0,0 +1,100 @@
note
description: "Summary description for {GRAPHICAL_WIZARD_BOOLEAN_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
GRAPHICAL_WIZARD_BOOLEAN_QUESTION
inherit
WIZARD_BOOLEAN_QUESTION
undefine
make
end
GRAPHICAL_WIZARD_QUESTION
create
make
convert
text: {STRING_32},
widget: {EV_WIDGET}
feature {NONE} -- Implementation
initialize
local
b: EV_VERTICAL_BOX
l_field: like input_widget
lab: EV_LABEL
do
create b
b.set_padding_width (5)
create l_field.make_with_text (title)
b.extend (l_field)
b.disable_item_expand (l_field)
if attached description as desc then
create lab.make_with_text (desc)
apply_field_description_style (lab)
append_indented_widget (lab, b)
end
input_widget := l_field
widget := b
end
feature -- Access: UI
widget: EV_VERTICAL_BOX
input_widget: EV_CHECK_BUTTON
feature -- Conversion
text: STRING_32
do
if input_widget.is_selected then
Result := "yes"
else
Result := "no"
end
end
value: BOOLEAN
do
Result := input_widget.is_selected
end
feature -- Element change
set_title (t: READABLE_STRING_GENERAL)
do
create title.make_from_string_general (t)
input_widget.set_text (t)
end
set_text (t: detachable READABLE_STRING_GENERAL)
do
if t = Void then
set_value (False)
else
set_value (t.is_case_insensitive_equal ("yes"))
end
end
set_value (b: BOOLEAN)
do
if b then
input_widget.enable_select
else
input_widget.disable_select
end
end
end

View File

@@ -0,0 +1,102 @@
note
description: "Summary description for {GRAPHICAL_WIZARD_DIRECTORY_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
GRAPHICAL_WIZARD_DIRECTORY_QUESTION
inherit
WIZARD_DIRECTORY_QUESTION
undefine
make
end
GRAPHICAL_WIZARD_QUESTION
create
make
convert
text: {STRING_32},
widget: {EV_WIDGET}
feature {NONE} -- Initialization
initialize
local
b: EV_VERTICAL_BOX
lab: EV_LABEL
l_field: like input_widget
do
create b
b.set_padding_width (5)
create lab.make_with_text (title)
title_widget := lab
apply_text_style (lab)
b.extend (lab)
b.disable_item_expand (lab)
create l_field.make
l_field.set_browse_for_directory
input_widget := l_field
b.extend (l_field)
b.disable_item_expand (l_field)
if attached description as desc then
create lab.make_with_text (desc)
apply_field_description_style (lab)
append_indented_widget (lab, b)
end
widget := b
end
feature -- Access: UI
widget: EV_VERTICAL_BOX
input_widget: EV_PATH_FIELD
title_widget: detachable EV_LABEL
feature -- Conversion
text: STRING_32
do
Result := input_widget.text
end
value: detachable PATH
do
Result := input_widget.file_path
end
feature -- Element change
set_text (t: detachable READABLE_STRING_GENERAL)
do
if t = Void then
set_value (Void)
else
set_value (create {PATH}.make_from_string (t))
end
end
set_default_start_path (p: PATH)
do
input_widget.set_default_start_path (p)
end
set_value (p: like value)
do
if p = Void then
input_widget.set_text ("")
else
input_widget.set_text (p.name)
end
end
end

View File

@@ -0,0 +1,55 @@
note
description: "Summary description for {GRAPHICAL_WIZARD_INPUT_FIELD}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
GRAPHICAL_WIZARD_INPUT_FIELD
inherit
WIZARD_INPUT_FIELD
GRAPHICAL_WIZARD_STYLER
GRAPHICAL_WIZARD_PAGE_ITEM
feature -- Access
item_id: detachable READABLE_STRING_8
-- Optional id to identify related page item.
do
Result := id
end
feature -- Conversion
data: detachable ANY
do
Result := widget.data
end
feature -- Element change
set_data (d: like data)
do
widget.set_data (d)
end
feature {NONE} -- Implementation
append_cell_to (a_size: INTEGER; a_container: EV_BOX)
local
cl: EV_CELL
do
create cl
if attached {EV_HORIZONTAL_BOX} a_container then
cl.set_minimum_width (a_size)
else
cl.set_minimum_height (a_size)
end
a_container.extend (cl)
a_container.disable_item_expand (cl)
end
end

View File

@@ -0,0 +1,107 @@
note
description: "Summary description for {GRAPHICAL_WIZARD_INTEGER_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
GRAPHICAL_WIZARD_INTEGER_QUESTION
inherit
WIZARD_INTEGER_QUESTION
undefine
make
end
GRAPHICAL_WIZARD_QUESTION
create
make
convert
text: {STRING_32},
widget: {EV_WIDGET}
feature {NONE} -- Initialization
initialize
local
b: EV_VERTICAL_BOX
lab: EV_LABEL
l_field: like input_widget
do
create b
b.set_padding_width (5)
create lab.make_with_text (title)
title_widget := lab
apply_text_style (lab)
b.extend (lab)
b.disable_item_expand (lab)
create l_field
input_widget := l_field
b.extend (l_field)
b.disable_item_expand (l_field)
if attached description as desc then
create lab.make_with_text (desc)
apply_field_description_style (lab)
append_indented_widget (lab, b)
end
set_validation (agent (pg: WIZARD_PAGE)
do
if not text.is_integer then
pg.report_error ("Invalid value for field ["+ id +"]: must be an integer!")
end
end
)
widget := b
end
feature -- Access: UI
widget: EV_VERTICAL_BOX
input_widget: EV_TEXT_FIELD
title_widget: detachable EV_LABEL
feature -- Conversion
text: STRING_32
do
Result := input_widget.text
end
value: INTEGER
do
if
attached text as l_text and then
l_text.is_integer
then
Result := l_text.to_integer
end
end
feature -- Element change
set_text (t: detachable READABLE_STRING_GENERAL)
do
if t = Void then
set_value (0)
elseif t.is_integer then
set_value (t.to_integer)
else
-- ignore !
end
end
set_value (v: INTEGER)
do
input_widget.set_text (v.out)
end
end

View File

@@ -0,0 +1,40 @@
note
description: "Summary description for {GRAPHICAL_WIZARD_PAGE_WIDGET}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
GRAPHICAL_WIZARD_PAGE_WIDGET
inherit
GRAPHICAL_WIZARD_PAGE_ITEM
create
make_with_widget
feature {NONE} -- Initialization
make_with_widget (w: like widget)
do
widget := w
end
feature -- Access
item_id: detachable READABLE_STRING_8
-- Optional id to identify related page item.
feature -- Element change
set_item_id (a_id: like item_id)
-- Set `item_id' to `a_id'.
do
item_id := a_id
end
feature -- Conversion
widget: EV_WIDGET
end

View File

@@ -0,0 +1,57 @@
note
description: "Summary description for {GRAPHICAL_WIZARD_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
GRAPHICAL_WIZARD_QUESTION
inherit
WIZARD_QUESTION
redefine
make
end
GRAPHICAL_WIZARD_INPUT_FIELD
rename
make as make_field
undefine
make_field
end
feature {NONE} -- Initialization
make (a_id: like id; a_title: READABLE_STRING_GENERAL; a_optional_description: detachable READABLE_STRING_GENERAL)
-- Create field identified by `a_id', with title `a_title'
-- and optional description `a_optional_description'.
do
Precursor (a_id, a_title, a_optional_description)
initialize
end
initialize
deferred
ensure
widget_created: widget /= Void
end
feature {NONE} -- Implementation
append_indented_widget (w: EV_WIDGET; a_container: EV_BOX)
local
lab: EV_LABEL
hb: EV_HORIZONTAL_BOX
do
create hb
append_cell_to (20, hb)
hb.extend (w)
hb.disable_item_expand (w)
a_container.extend (hb)
a_container.disable_item_expand (hb)
end
end

View File

@@ -0,0 +1,92 @@
note
description: "Summary description for {GWIZARD_STRING_QUESTION}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
GRAPHICAL_WIZARD_STRING_QUESTION
inherit
WIZARD_STRING_QUESTION
undefine
make
end
GRAPHICAL_WIZARD_QUESTION
create
make
convert
text: {STRING_32},
widget: {EV_WIDGET}
feature {NONE} -- Initialization
initialize
local
b: EV_VERTICAL_BOX
lab: EV_LABEL
l_field: like input_widget
do
create b
b.set_padding_width (5)
create lab.make_with_text (title)
title_widget := lab
apply_text_style (lab)
b.extend (lab)
b.disable_item_expand (lab)
create l_field
input_widget := l_field
b.extend (l_field)
b.disable_item_expand (l_field)
if attached description as desc then
create lab.make_with_text (desc)
apply_field_description_style (lab)
append_indented_widget (lab, b)
end
widget := b
end
feature -- Access: UI
widget: EV_VERTICAL_BOX
input_widget: EV_TEXT_FIELD
title_widget: detachable EV_LABEL
feature -- Conversion
text: STRING_32
do
Result := input_widget.text
end
value: detachable STRING_32
do
Result := text
end
feature -- Element change
set_text (t: detachable READABLE_STRING_GENERAL)
do
set_value (t)
end
set_value (v: detachable READABLE_STRING_GENERAL)
do
if v = Void then
input_widget.set_text ("")
else
input_widget.set_text (v)
end
end
end

View File

@@ -0,0 +1,4 @@
NAME="EWF: Eiffel Web Framework application, multi-platform, with EWF"
DESCRIPTION="Create a web server application based on the cross-platform library EWF."
LOCATION="ewf"
PLATFORM="all"

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="{$WIZ.project.name/}" uuid="{$UUID/}" library_target="{$WIZ.project.name/}">
<target name="common" abstract="true">
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
</target>
<target name="{$WIZ.project.name/}_any" extends="common">
<root class="{$APP_ROOT/}" feature="make_and_launch"/>
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}<library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi-safe.ecf"/>{/if}
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}<library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi-safe.ecf"/>{/if}
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}<library name="nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\nino-safe.ecf"/>{/if}
<cluster name="launcher" location=".\launcher\" recursive="true">
<file_rule>
<exclude>/default$</exclude>
</file_rule>
</cluster>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}
<target name="{$WIZ.project.name/}_nino" extends="common">
<root class="{$APP_ROOT/}" feature="make_and_launch"/>
<library name="default_nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\nino-safe.ecf"/>
<cluster name="launcher" location=".\launcher\" recursive="true">
<file_rule>
<exclude>/any$</exclude>
</file_rule>
</cluster>
<cluster name="src" location=".\src\" recursive="true"/>
</target>{/if}
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}
<target name="{$WIZ.project.name/}_cgi" extends="common">
<root class="{$APP_ROOT/}" feature="make_and_launch"/>
<library name="default_cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\cgi-safe.ecf"/>
<cluster name="launcher" location=".\launcher\" recursive="true">
<file_rule>
<exclude>/any$</exclude>
</file_rule>
</cluster>
<cluster name="src" location=".\src\" recursive="true"/>
</target>{/if}
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}
<target name="{$WIZ.project.name/}_libfcgi" extends="common">
<root class="{$APP_ROOT/}" feature="make_and_launch"/>
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi-safe.ecf"/>
<cluster name="launcher" location=".\launcher\" recursive="true">
<file_rule>
<exclude>/any$</exclude>
</file_rule>
</cluster>
<cluster name="src" location=".\src\" recursive="true"/>
</target>{/if}
<target name="{$WIZ.project.name/}" extends="{$WIZ.project.name/}_any"/>
</system>

View File

@@ -0,0 +1,6 @@
Wizard data values:
{foreach key="k" item="v" from="$WIZ"}
+ Page #{$k/}
{foreach key="pk" item="pv" from="$v"}- {$pk/}={$pv/}
{/foreach}
{/foreach}

View File

@@ -0,0 +1,4 @@
# For nino connector, use port {$WIZ.standalone_connector.port/}
port={$WIZ.standalone_connector.port/}
#verbose=true

View File

@@ -0,0 +1,84 @@
note
description: "[
Specific application launcher
DO NOT EDIT THIS CLASS
you can customize APPLICATION_LAUNCHER
]"
date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
revision: "$Revision: 36 $"
deferred class
APPLICATION_LAUNCHER_I
feature -- Execution
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
-- Launch Web Server Application using `a_service' and optionals `opts'.
local
l_id: like launcher_id
launcher: WSF_SERVICE_LAUNCHER
do
l_id := launcher_id
if l_id = Void then
{unless condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
io.error.put_string ("Application launcher not found!%N")
(create {EXCEPTIONS}).die (-1){/literal}{/unless}
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
-- Choose a default -> standalone
create {WSF_NINO_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}{/if}
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}{literal}
elseif is_libfcgi_launcher_id (l_id) then
create {WSF_LIBFCGI_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}{/if}
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}{literal}
elseif is_cgi_launcher_id (l_id) then
create {WSF_CGI_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}{/if}
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
elseif is_nino_launcher_id (l_id) then
create {WSF_NINO_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}{/if}
{literal}
else
io.error.put_string ("Application launcher not found!%N")
(create {EXCEPTIONS}).die (-1)
end
end
launcher_id: detachable READABLE_STRING_GENERAL
-- Launcher id based on the executable extension name if any.
-- This can be redefine to customize for your application.
--| ex: nino, cgi, libfcgi or Void.
local
sh_exec: SHARED_EXECUTION_ENVIRONMENT
do
create sh_exec
if attached (create {PATH}.make_from_string (sh_exec.execution_environment.arguments.command_name)).extension as ext then
Result := ext
end
end
feature -- Status report
{/literal}
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}
is_nino_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
do
Result := a_id.is_case_insensitive ("nino")
or a_id.is_case_insensitive ("standalone")
end{/if}
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}
is_cgi_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
do
Result := a_id.is_case_insensitive ("cgi")
end{/if}
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}
is_libfcgi_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
do
Result := a_id.is_case_insensitive ("libfcgi")
or a_id.is_case_insensitive ("fcgi")
end{/if}
end

View File

@@ -0,0 +1,18 @@
note
description: "[
Effective class for APPLICATION_LAUNCHER_I
You can put modification in this class
]"
date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
revision: "$Revision: 36 $"
class
APPLICATION_LAUNCHER
inherit
APPLICATION_LAUNCHER_I
feature -- Custom
end

View File

@@ -0,0 +1,32 @@
note
description: "[
Specific application launcher
DO NOT EDIT THIS CLASS
you can customize APPLICATION_LAUNCHER
]"
date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
revision: "$Revision: 36 $"
deferred class
APPLICATION_LAUNCHER_I
feature -- Execution
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
-- Launch Web Server Application using `a_service' and optionals `opts'.
local
launcher: WSF_SERVICE_LAUNCHER
do
{literal}
create {WSF_DEFAULT_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}
end
launcher_id: detachable READABLE_STRING_GENERAL
do
-- Not used for default connector selection.
end
end

View File

@@ -0,0 +1,55 @@
note
description: "[
application service
]"
date: "$Date$"
revision: "$Revision$"
class
{if isset="$APP_ROOT"}{$APP_ROOT/}{/if}
{unless isset="$APP_ROOT"}APPLICATION{/unless}
inherit
WSF_LAUNCHABLE_SERVICE
redefine
initialize
end
{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}
WSF_ROUTED_SERVICE{/if}
APPLICATION_LAUNCHER
{literal}create
make_and_launch
feature {NONE} -- Initialization
{/literal}
initialize
-- Initialize current service.
do
Precursor
set_service_option ("port", {$WIZ.standalone_connector.port/})
{unless condition="$WIZ.routers.use_router ~ $WIZ_YES"}
end
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
do
end{/unless}
{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}{literal}
initialize_router
end
setup_router
-- Setup `router'
local
fhdl: WSF_FILE_SYSTEM_HANDLER
do
router.handle_with_request_methods ("/doc", create {WSF_ROUTER_SELF_DOCUMENTATION_HANDLER}.make (router), router.methods_GET)
create fhdl.make_hidden ("www")
fhdl.set_directory_index (<<"index.html">>)
router.handle_with_request_methods ("", fhdl, router.methods_GET)
end{/literal}{/if}
end

View File

@@ -0,0 +1 @@
Hello Eiffel Web Application!

View File

@@ -0,0 +1,4 @@
NAME="EWF: Eiffel Web Framework application, multi-platform, with EWF source code"
DESCRIPTION="Create a web server application based on the cross-platform library EWF. Using the original source code of EWF (i.e: not the one in $ISE_LIBRARY)"
LOCATION="ewf_custom"
PLATFORM="all"

View File

@@ -0,0 +1,24 @@
setlocal
set TMP_ROOTDIR=%~dp0rootdir
set TMP_TARGETNAME=custom_wizard
set WIZ_TARGET=%ISE_EIFFEL%\studio\wizards\new_projects\ewf
rd /q/s %WIZ_TARGET%
mkdir %WIZ_TARGET%
xcopy /I /E /Y %TMP_ROOTDIR% %WIZ_TARGET%
copy %~dp0rootdir_custom\ewf.dsc %WIZ_TARGET%\ewf.dsc
copy %~dp0rootdir_custom\resources\* %WIZ_TARGET%\resources
if not exist %WIZ_TARGET%\pixmaps mkdir %WIZ_TARGET%\pixmaps
move %WIZ_TARGET%\ewf.dsc %WIZ_TARGET%\..\ewf.dsc
rd /q/s tmp
mkdir tmp
ecb -config ewf_ise_wizard-safe.ecf -target %TMP_TARGETNAME% -finalize -c_compile -project_path tmp
rd /q/s %WIZ_TARGET%\spec
mkdir %WIZ_TARGET%\spec
mkdir %WIZ_TARGET%\spec\%ISE_PLATFORM%
move tmp\EIFGENs\%TMP_TARGETNAME%\F_code\wizard.exe %WIZ_TARGET%\spec\%ISE_PLATFORM%\wizard.exe
rd /q/s tmp
endlocal

View File

@@ -0,0 +1,16 @@
#!/bin/sh
mkdir tmp
ecb -config ewf_ise_wizard-safe.ecf -target custom_wizard -finalize -c_compile -project_path tmp
mkdir -p custom/spec/$ISE_PLATFORM
mv tmp/EIFGENs/custom_wizard/F_code/wizard custom/spec/$ISE_PLATFORM/wizard
rm -rf tmp
WIZ_TARGET=$ISE_EIFFEL/studio/wizards/new_projects/ewf_custom
rm -rf $WIZ_TARGET
mkdir $WIZ_TARGET
cp -r resources $WIZ_TARGET/resources
cp -f custom/resources/* $WIZ_TARGET/resources
cp -r custom/spec $WIZ_TARGET/spec
cp custom/ewf.dsc $WIZ_TARGET/../ewf_custom.dsc
rm -rf custom/spec

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="${WIZ:TARGET_NAME}" uuid="${WIZ:UUID}">
<target name="${WIZ:TARGET_NAME}">
<root class="EWF_APPLICATION" feature="make_and_launch"/>
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="concurrency" value="${WIZ:CONCURRENCY}"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="default_${WIZ:EWF_CONNECTOR}" location="${WIZ:EWF_DIR}/library/server/wsf/default/${WIZ:EWF_CONNECTOR}-safe.ecf"/>
<library name="encoder" location="${WIZ:EWF_DIR}/library/text/encoder/encoder-safe.ecf" readonly="false"/>
<library name="wsf" location="${WIZ:EWF_DIR}/library/server/wsf/wsf-safe.ecf" readonly="false"/>
<library name="http" location="${WIZ:EWF_DIR}/library/network/protocol/http/http-safe.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,34 @@
note
description : "Objects that ..."
author : "$Author$"
date : "$Date$"
revision : "$Revision$"
class
EWF_CONSOLE_WIZARD_APPLICATION
inherit
CONSOLE_WIZARD_APPLICATION
SHARED_EXECUTION_ENVIRONMENT
create
make
feature {NONE} -- Initialization
make
-- Initialize `Current'.
do
initialize
on_start
end
feature {NONE} -- Initialization
new_wizard: EWF_WIZARD
do
create Result.make (Current)
end
end

View File

@@ -0,0 +1,210 @@
note
description: "Summary description for {EWF_WIZARD}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
EWF_WIZARD
inherit
WIZARD
create
make
feature -- Access
title: STRING_32 = "Web Application Wizard"
feature -- Factory
wizard_generator : EWF_WIZARD_GENERATOR
do
create Result.make (Current)
end
feature -- Pages
first_page: WIZARD_PAGE
once
Result := new_page ("first")
Result.set_title ("Web Application Wizard")
Result.set_subtitle ("Based on the EWF libraries...")
Result.add_section_text ("Create Web server application with EWF.")
Result.add_text ("[
Using the Eiffel Web Framework (EWF), the generated application
will run on any platforms.
Depending on the connector(s), you may need to use a
third-party httpd server (such as apache, nginx, ...)
]")
end
project_page: WIZARD_PAGE
once
Result := new_page ("project")
Result.set_title ("Project Name and Project Location")
Result.set_subtitle ("You can choose the name of the project and%Nthe directory where the project will be generated.")
Result.add_text ("[
Please fill in:
The name of the project (without space).
The directory where you want the eiffel classes to be generated.
]")
Result.extend (Result.new_string_question ("Project name:", "name", "ASCII name, without space"))
Result.add_directory_question ("Project location:", "location", "Valid directory path, it will be created if missing")
Result.data.force ("ewf_app", "name")
Result.data.force (application.available_directory_path ("ewf_app", application.layout.default_projects_location.extended ("ewf")).name, "location")
Result.set_validation (agent (a_page: WIZARD_PAGE)
do
if
not attached a_page.data.item ("name") as l_name
or else l_name.is_whitespace
then
a_page.report_error ("Invalid value for `name'!")
end
if not a_page.data.has ("location") then
a_page.report_error ("Missing value for `location'!")
end
end)
end
connectors_page: WIZARD_PAGE
once
Result := new_page ("connectors")
Result.set_title ("Connectors selection")
Result.set_subtitle ("You can choose one or multiple connectors%Nto use as the same time.")
Result.add_text ("[
Web application runs on top of connectors
(i.e layer handling httpd incoming connections)
Select connectors you want to support:
]")
Result.add_boolean_question ("Standalone", "use_standalone", "Using the Eiffel Web nino server")
Result.add_boolean_question ("CGI", "use_cgi", "Require a httpd server")
Result.add_boolean_question ("libFCGI", "use_libfcgi", "Require a httpd server")
Result.data.force ("yes", "use_standalone")
Result.data.force ("yes", "use_cgi")
Result.data.force ("yes", "use_libfcgi")
end
standalone_connector_page: WIZARD_PAGE
once
Result := new_page ("standalone_connector")
Result.set_title ("Standalone (nino) connector")
Result.set_subtitle ("Set options .")
Result.add_integer_question ("Port number", "port", "It happens port 80 is already taken, thus choose another one.")
Result.add_boolean_question ("Verbose", "verbose", "Verbose output")
Result.data.force ("80", "port")
Result.data.force ("no", "verbose")
end
routers_page: WIZARD_PAGE
once
Result := new_page ("routers")
Result.set_title ("Use Router (URL dispatching)")
Result.set_subtitle ("Use the router component to easily map url patterns to handlers.")
Result.add_text ("[
Use the router component to easily map URL patterns to handlers:
]")
Result.add_boolean_question ("use the router component", "use_router", "Check generated code to see how to configure it.")
Result.data.force ("yes", "use_router")
end
final_page: WIZARD_PAGE
local
-- s,sv: STRING_32
-- l_settings: ARRAYED_LIST [TUPLE [title: READABLE_STRING_GENERAL; value: READABLE_STRING_GENERAL]]
-- l_project_settings: STRING_32
-- l_ewf_settings: STRING_32
txt1, txt2: WIZARD_PAGE_TEXT_ITEM
once
Result := new_page ("final")
Result.set_title ("Completing the New Web Application Wizard")
Result.add_text ("You have specified the following settings:%N%N")
txt1 := Result.new_fixed_size_text_item ("...")
-- Result.add_fixed_size_text ("...", "projects_settings")
Result.extend (txt1)
txt2 := Result.new_fixed_size_text_item ("...")
-- Result.add_fixed_size_text ("...", "ewf_settings")
Result.extend (txt2)
Result.update_actions.extend (agent (a_page: WIZARD_PAGE; a_txt1, a_txt2: WIZARD_PAGE_TEXT_ITEM)
local
sv: STRING_32
l_settings: ARRAYED_LIST [TUPLE [title: READABLE_STRING_GENERAL; value: READABLE_STRING_GENERAL]]
do
-- Project
create l_settings.make (10)
if attached project_page.field_value ("name") as l_project_name then
l_settings.force (["Project name", l_project_name])
end
if attached project_page.field_value ("location") as l_project_location then
l_settings.force (["Location", l_project_location])
end
a_txt1.set_text (formatted_title_value_items (l_settings))
-- EWF
create l_settings.make (5)
create sv.make_empty
if connectors_page.boolean_field_value ("use_standalone") then
if not sv.is_empty then
sv.append (", ")
end
sv.append ("standalone")
end
if connectors_page.boolean_field_value ("use_cgi") then
if not sv.is_empty then
sv.append (", ")
end
sv.append ("cgi")
end
if connectors_page.boolean_field_value ("use_libfcgi") then
if not sv.is_empty then
sv.append (", ")
end
sv.append ("libfcgi")
end
l_settings.force (["Connectors", sv])
if routers_page.boolean_field_value ("use_router") then
l_settings.force (["Use Router", "yes"])
end
a_txt2.set_text (formatted_title_value_items (l_settings))
end(Result, txt1, txt2))
end
feature -- Events
next_page (a_current_page: detachable WIZARD_PAGE): WIZARD_PAGE
do
Result := notfound_page
if a_current_page = Void then
Result := first_page
elseif a_current_page = first_page then
Result := project_page
elseif a_current_page = project_page then
Result := connectors_page
elseif a_current_page = connectors_page then
if connectors_page.boolean_field_value ("use_standalone") then
Result := standalone_connector_page
else
Result := routers_page
end
elseif a_current_page = standalone_connector_page then
Result := routers_page
elseif a_current_page = routers_page then
Result := final_page
end
end
end

View File

@@ -0,0 +1,136 @@
note
description: "Summary description for {EWF_WIZARD_GENERATOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
EWF_WIZARD_GENERATOR
inherit
WIZARD_GENERATOR
redefine
copy_template
end
SHARED_TEMPLATE_CONTEXT
create
make
feature -- Query
collection: detachable WIZARD_DATA
feature -- Execution
execute (a_collection: WIZARD_DATA)
local
d: DIRECTORY
pdn, dn: PATH
tfn: PATH
res: WIZARD_SUCCEED_RESPONSE
-- k: STRING_32
do
collection := a_collection
if
attached a_collection.item ("project:name") as pn and
attached a_collection.item ("project:location") as l_loc
then
create pdn.make_from_string (l_loc)
variables.force (pn.as_lower, "APP_NAME")
variables.force (pn.as_upper, "APP_ROOT")
variables.force (new_uuid, "UUID")
variables.force ("none", "CONCURRENCY")
variables.force ("yes", "WIZ_YES")
variables.force ("no", "WIZ_NO")
dn := pdn
create d.make_with_path (dn)
if not d.exists then
d.recursive_create_dir
end
recursive_copy_templates (application.layout.resources_location, dn)
tfn := dn.extended (pn).appended_with_extension ("ecf")
create res.make (tfn, d.path)
send_response (res)
else
send_response (create {WIZARD_FAILED_RESPONSE})
end
end
feature -- Templates
smarty_template_extensions: ARRAY [READABLE_STRING_32]
once
Result := <<"e", "ecf", "ini">>
end
is_smarty_template_file (f: PATH): BOOLEAN
do
if attached f.extension as ext then
Result := across smarty_template_extensions as ext_ic some ext_ic.item.is_case_insensitive_equal_general (ext) end
end
end
is_template_file (f: PATH): BOOLEAN
do
Result := is_smarty_template_file (f)
end
copy_template (a_src: PATH; a_target: PATH)
do
if is_smarty_template_file (a_src) then
copy_smarty_template (a_src, a_target)
else
Precursor (a_src, a_target)
end
end
copy_smarty_template (a_res: PATH; a_target: PATH)
local
tpl: TEMPLATE_FILE
f,t: PLAIN_TEXT_FILE
inspectors: ARRAYED_LIST [TEMPLATE_INSPECTOR]
do
create f.make_with_path (a_res)
if f.exists and f.is_readable then
create tpl.make_from_file (f.path.name)
if attached collection as l_collection then
tpl.add_value (l_collection, "WIZ")
end
across
variables as ic
loop
tpl.add_value (ic.item, ic.key)
end
template_context.set_template_folder (application.layout.templates_location)
create inspectors.make (2)
inspectors.force (create {WIZARD_DATA_TEMPLATE_INSPECTOR}.register ({detachable WIZARD_DATA}))
inspectors.force (create {WIZARD_PAGE_DATA_TEMPLATE_INSPECTOR}.register ({detachable WIZARD_PAGE_DATA}))
tpl.analyze
tpl.get_output
across
inspectors as ic
loop
ic.item.unregister
end
if attached tpl.output as l_output then
create t.make_with_path (a_target)
if not t.exists or else t.is_writable then
t.create_read_write
t.put_string (l_output)
t.close
end
else
copy_file (a_res, a_target)
end
end
end
end

View File

@@ -0,0 +1,46 @@
note
description: "[
Objects that ...
]"
author: "$Author$"
date: "$Date$"
revision: "$Revision$"
class
EWF_GRAPHICAL_WIZARD
inherit
EV_APPLICATION
SHARED_EXECUTION_ENVIRONMENT
undefine
default_create, copy
end
create
make_and_launch
feature {NONE} -- Initialization
make_and_launch
local
w: like main_window
cons: EWF_CONSOLE_WIZARD_APPLICATION
do
default_create
if execution_environment.arguments.index_of_word_option ("-console") > 0 then
create cons.make
else
create w
main_window := w
w.show
launch
end
end
feature {NONE} -- Implementation
main_window: detachable EWF_WIZARD_WINDOW
end

View File

@@ -0,0 +1,38 @@
note
description: "Summary description for {EWF_WIZARD_WINDOW}."
date: "$Date$"
revision: "$Revision$"
class
EWF_WIZARD_WINDOW
inherit
GRAPHICAL_WIZARD_WINDOW
redefine
side_bar_items
end
feature {NONE} -- Initialization
new_wizard: EWF_WIZARD
do
create Result.make (Current)
end
feature -- Access
side_bar_items (a_page: WIZARD_PAGE): ARRAYED_LIST [WIZARD_PAGE_ITEM]
local
lab: EV_LABEL
do
Result := Precursor (a_page)
if a_page.page_id.is_case_insensitive_equal_general ("first")
or a_page.page_id.is_case_insensitive_equal_general ("final")
then
create lab.make_with_text ("EWF")
lab.set_foreground_color (colors.white)
Result.extend (create {GRAPHICAL_WIZARD_PAGE_WIDGET}.make_with_widget (lab))
end
end
end

View File

@@ -0,0 +1,46 @@
note
description: "Summary description for {WIZARD_DATA_TEMPLATE_INSPECTOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WIZARD_DATA_TEMPLATE_INSPECTOR
inherit
TEMPLATE_INSPECTOR
redefine
internal_data
end
create
register
feature {TEMPLATE_ROUTINES}
internal_data (field_name: STRING; obj: detachable ANY): detachable CELL [detachable ANY]
-- Return object in a cell
-- If not handled by this inspector, return Void
local
l_fn: STRING
utf: UTF_CONVERTER
do
if attached {WIZARD_DATA} obj as wiz then
l_fn := field_name.as_lower
if attached wiz.page_data (l_fn) as v then
Result := cell_of (v)
end
end
end
note
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,45 @@
note
description: "Summary description for {WIZARD_PAGE_DATA_TEMPLATE_INSPECTOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WIZARD_PAGE_DATA_TEMPLATE_INSPECTOR
inherit
TEMPLATE_INSPECTOR
redefine
internal_data
end
create
register
feature {TEMPLATE_ROUTINES}
internal_data (field_name: STRING; obj: detachable ANY): detachable CELL [detachable ANY]
-- Return object in a cell
-- If not handled by this inspector, return Void
local
l_fn: STRING
do
if attached {WIZARD_PAGE_DATA} obj as pg then
l_fn := field_name.as_lower
if attached pg.item (l_fn) as v then
Result := cell_of (v)
end
end
end
note
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end