This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 248418

Summary: Swing independent UI for template creation
Product: platform Reporter: Jaroslav Tulach <jtulach>
Component: TemplatesAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: normal CC: apireviews, jhavlin, maxnitribitt, sdedic, tzezula
Priority: P2 Keywords: API_REVIEW
Version: 8.1   
Hardware: PC   
OS: Linux   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 247926, 248918, 249319    
Bug Blocks:    
Attachments: wizardchome.html showing how a wizard skeleton around a wizard content could look like in a browser

Description Jaroslav Tulach 2014-11-05 09:33:23 UTC
Issue 247926 is trying to separate the definition of templates from the data systems (and their Swing based UI). In addition to that I believe we should have a way to design custom UI for more complicated templates that can be used in non-Swing UI environment, possibly in a browser.
Comment 1 Jaroslav Tulach 2014-11-05 09:39:23 UTC
I am going to describe the plan for inception review at
http://wiki.netbeans.org/HtmlUIForTemplates
Comment 2 Jaroslav Tulach 2014-11-05 13:17:54 UTC
Created attachment 150293 [details]
wizardchome.html showing how a wizard skeleton around a wizard content could look like in a browser
Comment 3 Jaroslav Tulach 2014-11-21 16:26:43 UTC
Guys, can we start an inception review for this enhancement? Please see the associated wiki page and leave your comments here.

Can we meet on Dec 2, 2pm? I'd like the reviewers to be Jaroslav Havlín, Tomáš Zezula, Svatopluk Dědic and Toni Epple. Prague will meet in Giza. I'll provide the call in info before the meeting.
Comment 4 Jaroslav Tulach 2014-11-25 20:29:38 UTC
Any comments?
Comment 5 Jaroslav Havlin 2014-11-28 13:25:30 UTC
I would prefer some solution that does not depend on global element ids (if possible).
Reusing the wizard would be easier then, as there would be no risk of id conflict.

Ideas
 - Possibility to set step id and step display name in the template
 - Avoid need to list steps in both model and template
 - Separate models for data and for controls (current step, validations)
 - Would some support for progress bar make sense?
 - Is some support for internationalization needed?
Comment 6 Jaroslav Havlin 2014-12-01 09:01:03 UTC
We can also consider template format similar to some JQuery plugins.
Example:

<div class="someEmbeddableSelector">
    <h1 data-step="init">Initial Page</h1>
        <section>
        <p>
        JavaScript will ask you few questions about your mood.
        </p>
    </section>

    <h1 data-step="info">Query Page</h1>
    <section>
        <p>
        Is everything OK?
        </p>
        <input type="checkbox" data-bind="checked: ok"/>
        <p>How do you feel?
        </p>
        <input type='text' data-bind="value: msg"/>
    </section>

    <h1 data-step="summary">Summary Page</h1>
    <section>
        <p>
        You are feeling <span data-bind="text: msg"></span>!
        </p>
    </section>
</div>
Comment 7 Jaroslav Havlin 2014-12-01 13:40:23 UTC
Notes from inception review:

TCR: Avoid knockout templates, use data-step approach.
TCR: Filter control data
TCR: Support for progress bar
TCR: Do not depend on JavaFX

TCA: Prepare TCK (Technology Compatibility Kit)
Comment 8 Jaroslav Tulach 2014-12-15 09:32:41 UTC
> TCR: Do not depend on JavaFX

Addressed in
https://hg.netbeans.org/ergonomics/rev/6576fe363d45
now there is api.templates and templatesui module connected via org.netbeans.api.templates.wizard token.
Comment 9 Jaroslav Tulach 2014-12-15 12:40:40 UTC
> TCA: Prepare TCK (Technology Compatibility Kit)

This is the way to write new TCK tests:
http://hg.netbeans.org/ergonomics/rev/c2fce646315b
A test is composed from an HTML page, initialization code and set of JavaScript operations to perform. These operations may acces "tck" object with various methods defined by the wizard framework implementation - e.g. other implementations would define the "tck" object differently to expose their own internals.
Comment 10 Jaroslav Tulach 2014-12-15 13:53:03 UTC
> TCR: Avoid knockout templates, use data-step approach.

While having a way to define the list of steps in HTML is convenient, the data-step approach is too "jQuery-like" - e.g. one would need to mangle around the DOM a bit too much. Here is more knockoutish approach - use of custom 'step' binding: http://hg.netbeans.org/ergonomics/rev/c5ec0030bd76 - hopefully it will be found acceptable too.
Comment 11 Jaroslav Tulach 2014-12-15 14:05:56 UTC
> TCR: Filter control data

Done: http://hg.netbeans.org/ergonomics/rev/31f42048137a
Comment 12 Jaroslav Havlin 2014-12-15 14:11:03 UTC
(In reply to Jaroslav Tulach from comment #10)
> Here is more knockoutish approach - use of
> custom 'step' binding: http://hg.netbeans.org/ergonomics/rev/c5ec0030bd76 -
> hopefully it will be found acceptable too.
It seems fine to me. Thank you.
Comment 13 Jaroslav Tulach 2014-12-16 14:29:33 UTC
Everything is done, including wizard to generate the wizard:
http://hg.netbeans.org/ergonomics/rev/c46aa831443d

The only missing piece is "TCR: Support for progress bar". There is no progress support in our Wizard API - only ProgressInstantiatingIterator - but so far the instantiation is handled by the system itself (using a freemarker templating engine). The only place for progress would be on "Next" button. For that there is AsynchronousValidatingPanel, but that one does not show progress. Anyway I will try to think about ways to bridge AsynchronousValidatingPanel into JavaScript by the final review.

Btw. can we have the review on Thursday, Dec 18? Say 11am CET? Tomáš is leaving for vacation, but he promised to review the change in advance. Can others Sváťa, Toni and Jarda join on Thursday?
Comment 14 Jaroslav Tulach 2014-12-17 11:12:03 UTC
The validation is implemented and tested in the TCK as of
http://hg.netbeans.org/ergonomics/rev/3c0135fb4681

I will work on better documentation now.
Comment 15 Jaroslav Tulach 2014-12-18 09:58:32 UTC
Finally the builder succeeded and we have Javadoc:
http://deadlock.netbeans.org/job/prototypes-WizardFor247926/javadoc/
Comment 16 Jaroslav Tulach 2014-12-18 11:53:10 UTC
Final review happened on Dec 18, 2014 with Jaroslav Havlín, Toni Epple, Martin Entlicher and Ondřej Vrabec being the reviewers. The change was approved for integration. See the notes at http://wiki.netbeans.org/wiki/index.php?title=HtmlUIForTemplates&diff=67358&oldid=67344

I'd like to especially thank Ondřej for bringing up his requirejs experience and spelling his global namespace initialization requirements. Thanks.
Comment 17 Jaroslav Tulach 2014-12-22 15:37:04 UTC
Documentation improved as of
http://hg.netbeans.org/ergonomics/rev/db40c3773567
Comment 18 Quality Engineering 2014-12-23 04:36:02 UTC
Integrated into 'main-silver', will be available in build *201412230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/45cde3eda538
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: Review of #248418 went OK, the tests seem to be passing. Integrating. Still pending documentation fixes.