1. #1
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    64
    Vote Rating
    6
    jim@carroll.net is on a distinguished road

      0  

    Default Question about MVC design patterns -- separate view components as building blocks.

    Question about MVC design patterns -- separate view components as building blocks.


    Quick question.

    We're trying to follow the design pattern described in the article http://www.sencha.com/learn/architec...t-js-4-part-2/. It recommends separating views into individual classes, and then glueing them together with the Viewport.

    Question -- how does one accomplish this with Architect?

    One solution would seem to be to add a component to the Viewport, then 'Promote To Class' the component. Are we understanding/applying the recommended approach here?

    Thanks

  2. #2
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,310
    Vote Rating
    138
    ssamayoa is a glorious beacon of light ssamayoa is a glorious beacon of light ssamayoa is a glorious beacon of light ssamayoa is a glorious beacon of light ssamayoa is a glorious beacon of light ssamayoa is a glorious beacon of light

      1  

    Default


    You can start with top components then glue them together in the viewport. To do that drop a container (panel, tabpanel, raw container, etc.) into the canvas, edit it then LINK it to the viewport. To link, drag the component the drop it in the viewport and when SA asks "Copy/Move/Link" answer "Link".

    Note that this approach doesn't limits to viewport:

    Suppose you have an accounting application in which customers's properties are almost the same as vendors's or at least have common ones: code, name. address, phone, etc. Instead of creating a different view for the same fields you can create one container (fieldset, panel or whatever best suits you) then use it in the customer's edit window and in the vendor's edit window.

    Hope this helps.

    Regards.

    PD: if you find my answer (or any answer) please rate it!
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  3. #3
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,369
    Vote Rating
    128
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Architect makes it a lot easier to build from the top down with the promote to class feature.

    While using reusable building blocks is the best practice, often times you don't see them initially until they've been used a few times. Promote to class lets you create a top level class and "Link" it automatically.

    In short, Architect supports building your application from the bottom up or from the top down. Both ways will work equally well
    Aaron Conran
    @aconran
    Sencha Architect Development Team

Thread Participants: 2

Tags for this Thread