Changes between Version 3 and Version 4 of UNPLANNED_SCRIPTING_REFACTORING_R0


Ignore:
Timestamp:
09/02/09 17:36:37 (16 years ago)
Author:
mitex
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UNPLANNED_SCRIPTING_REFACTORING_R0

    v3 v4  
    5656 
    5757= Design = 
    58 ^(Describe your design here.)^ 
     58 
     59 * Common design ideas: 
     60  * In all methods in {{{JS*}}} classes that modify the model execute a new insignificant {{{AutoAction}}}. 
     61 
     62 * Rename {{{JSApp}}} to {{{JSAppMainWindow}}} and make it to extend {{{BaseJSAdapter<AppMainWindow>}}}. 
     63  * Reimplement {{{jsFunction_newBook}}}: 
     64   * Use {{{BookH.createEmptyBook}}} to create {{{ResourceAccess}}} to a new book. Use default settings from {{{BookInfo.DEFAULT_INFO}}}. 
     65   * Create a new {{{BookDocView}}} for the newly created resource access object and add it to the documents list in the {{{AppMainWindow}}}. 
     66   * Create a new {{{JSBook}}} using {{{Context.getCurrentContext().newObject}}}. Set its adapted object to the {{{BookView}}} in the newly created {{{BookDocView}}}. 
     67 
     68 * {{{JSBook}}} should extend {{{BaseJSAdapter<BookView>}}}. 
     69  * In {{{jsGet_title()}}} and {{{jsGet_pageSize()}}} just return the value of corresponding getter in {{{getAdaptedObject().getModel()}}}. 
     70  * In {{{jsSet_title}}} and {{{jsSet_pageSize}}} set {{{BookR4.KEY_TITLE}}} and {{{BookR4.KEY_PAGE_SIZE}}}, respectively. 
     71  * Refactor {{{jsGet_pages}}} to iterate over the immutable list from {{{BookH.getPages()}}}. 
     72   * For each created {{{JSPage}}} set the adapted object to the {{{RootPageView}}} that corresponds to the page, using {{{BookView.getPageView(page reference)}}}. 
     73  * {{{jsFunction_newPage}}} should create a new resource reference with {{{ResourceRefR4.generateRandomSub(PageH.NAME_PREFIX)}}}, then call {{{BookH.addNewPage}}} in the AutoAction, and finally create a new {{{JSPage}}}. 
     74  * {{{jsFunction_removePage}}} should call {{{BookH.removePage}}}. 
     75  * {{{jsFunction_movePage}}} should call {{{BookH.movePage}}}. 
     76  * {{{jsFunction_setCurrentPage}}} should call {{{BookView.goToPage}}}. 
     77 
     78 * {{{JSPage}}} should extend {{{BaseJSAdapter<RootPageView>}}}. 
     79 
     80 
     81  * Replace all hardcoded String literals, representing javascript class names, such as "Book", "Page", etc. with String constants. 
     82   * For example, create a constant {{{public static final String CLASS_NAME = "App"}}} in {{{JSAppMainWindow}}} and replace all occurrences of "App" in the scripting module to {{{JSAppMainWindow.CLASS_NAME}}}. 
     83   * Do the same for {{{JSBook}}}, {{{JSPage}}} and {{{JSFrame}}}. 
     84 
     85 * In all {{{JS*}}} classes remove the {{{jsConstructor}}} method. 
     86  * JavaScript users should not use the constructors. There are instance methods for creating books, pages and so on. 
     87 
     88 * {{{RunScriptLogic}}} ... 
    5989 
    6090= Implementation =