Changes between Version 3 and Version 4 of UNPLANNED_LOGIC_REFACTORING_R0


Ignore:
Timestamp:
08/20/09 20:12:47 (16 years ago)
Author:
mitex
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UNPLANNED_LOGIC_REFACTORING_R0

    v3 v4  
    1111  * Menu items have {{{clicked}}} method instead of firing an R3 event. For some items it is trivial to switch to R3 Logic. 
    1212   * Not all menu items will be refactored. 
     13  * Code duplication due to copy-paste. 
    1314 * No new functionality is going to be added. 
    1415 
     
    2122 * For halo buttons, extract logics and group them by functionality. 
    2223  * For example, create {{{org.sophie2.main.app.halos.grouping.GroupHalosLogic}}} which handles events from all halo buttons related to grouping. 
     24 * Refactor the align buttons: Reuse the code where possible. 
    2325 * In menu items deprecate the method {{{clicked}}}. 
    2426  * Create a new event CLICKED that should be fired when a menu item is clicked. 
     
    3941 
    4042= Design = 
    41 ^(Describe your design here.)^ 
     43 * For the align buttons: 
     44  * Create two abstract methods in AlignElementsButton: 
     45   * {{{float calculateAlignValue(List<ElementView> selected)}}} - for a given list of element views calculates some align value, for example, the Y-axis of the top-most element. 
     46   * {{{ImmPoint calculateNewLocation(ImmRect bounds, float alignValue)}}} - calculates a new location for a single element, given the old bounds and the align value, returned from the above method. 
     47  * Replace the {{{clicked}}} method in all align buttons with the above methods. 
     48  * Create {{{AlignElementsLogic}}} with a single handler - {{{ON_ALIGN}}}, which listens for {{{CLICKED}}} from {{{AlignElementsButton}}}. 
     49   * Calculates the align value 
     50   * Creates an immutable list of new locations 
     51   * Creates an immutable list of references to elements. Only elements of type {{{MemberElement}}} are collected. 
     52   * Creates a new {{{AutoAction}}} that iterates over all references and changes {{{MemberElement.KEY_LOCATION}}} with the newly calculated location. 
    4253 
    4354= Implementation =