Changes between Version 20 and Version 21 of GROUP_CHANGES_R0


Ignore:
Timestamp:
06/09/09 15:41:28 (16 years ago)
Author:
gogov
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GROUP_CHANGES_R0

    v20 v21  
    4141 
    4242= Design = 
    43 There is implementation changes and events now. There is an UndoManager that is used like a ChangeManager and additionally can perform undo-redo. There are a few step that have to be taken into when designing this task: 
    44  * First of all the old UndoManader has to be deprecated and later, when not needed, it should be removed (after the undo-redo-skip implementation). 
    45  * The current changes should be researched and their hierarchy may be will be enlarged. 
    46  * The resources are the most important part of the changes design, because their state will be saved or transfered to the server and back. 
    47  * The ProObjects should work with changes but if they are not part of a resource space, the changes should not be stored. 
    48  * The grouping for the user have to have prototype. 
     43There is implementation changes and events now. There is an UndoManager that is used like a ChangeManager and additionally can perform undo-redo. There are a few step that have to be taken into consideration when designing this task: 
     44 * First of all the old UndoManader has to be deprecated and later, when not needed, it should be removed (after the undo-redo-skip implementation is done). 
     45 * The existing Changes should be explored and their hierarchy may be expanded. 
     46 * Resources are the most important part of the Changes design, because their state will be saved or transfered from the client to the server and vice versa. 
     47 * ProObjects should work with Changes but if they are not part of a ResourceSpace, their respective Changes should not be saved anywhere. 
     48 * The grouping for the user needs to have a prototype implementation. 
    4949 
    5050That is a diagram of some of the changes that are used now and some that I will add:[[BR]] 
    5151[[Image(source:branches/private/meddle/sophie2-platform/modules/org.sophie2.base.model.resources/doc/Changes.jpg)]][[BR]] 
    52  * In the new design of the changes: 
    53   * All the actions that on the pro-objects will be trackable and will be Changes. 
    54   * The Undo and Redo actions will have changes, because they can be skipped, unskipped. 
    55   * Skip and Unskip have to be Changes to because they are also undo-able redo-able, skip-able and unskip-able. 
    56  * The changes will use the old GroupChange for grouping. 
    57   * Groups can be created from the developer using the AutoChanges. 
    58   * All AutoChanges will have to have descriptions, so they will be constructed with description and the description will be asserted to be not null or empty. 
     52 * In the new design of the Changes: 
     53  * All the actions and operations that are performed on ProObjects will be trackable and will be Changes. 
     54  * The Undo and Redo actions will have Changes, because they can be skipped and unskipped. 
     55  * Skip and unskip operations have to be Changes to because they are also undoable redoable, skippable and unskippable. 
     56 * Changes will use the existing GroupChange class for grouping. 
     57  * Groups can be created from the developer using AutoChanges. 
     58  * All AutoChanges need to have descriptions, so they will be constructed with description and the description will be asserted to be not null or empty. 
    5959  * The old DummyChange can be used for closing groups if there is no present closing change. (Think of a better name for the next revision.). 
    60  * About resources. Having in mind that Resources will be buildable from a list of Changes and will be transferable through the net to the server and back, we can look at the resources as a sequence of changes that describes their life time so: 
    61   * There will be changes for creating and destroying resource, as beginning and ending of it's lifetime. (Will be implemented with the serialization in some of the next revisions). 
    62   * There will be changes for entering of a pro object in a given resource space and exiting of a pro object from a given resource space. 
    63   * All of the resources have to have their own history, and that history will include the changes of all the objects in their own ResourceSpace => it will be part of the ResourceSpace. 
     60 * I have the following comments about Resources - having in mind that Resources will be buildable from a list of Changes and will be transferable over the net to the server and back, we can look at Resources as a sequence of Changes that describes their lifetime so: 
     61  * There will be Changes for creating and destroying a Resource respectively for the beginning and ending of their lifetime. (Will be implemented with serialization in some of the next revisions). 
     62  * There will be Changes for attaching a given ProObject to a given ResourceSpace and detaching a ProObject from a given ResourceSpace. 
     63  * All of the Resources need to have their own History, and that Gistory will include the Changes of all the objects in their own ResourceSpace => it will be part of the ResourceSpace. 
    6464 
    65 After all this ideas we can list all of the primitive changes that will be serializable and all the grouped changes will be set of them: 
    66  * Set a value to a non list property : ValueChange. 
    67  * Set an element to a given index of a pro-list : BaseProListChange.SET 
    68  * Add an element to a pro-list : BaseProListChange.ADD 
    69  * Remove an element from a pro-list : BaseProListChange.REMOVE 
     65After all these ideas we can list all of the primitive Changes that will be serializable and thus a GroupChange will simply represent a list of such primitive Changes: 
     66 * Set a value to a non-list property : ValueChange. 
     67 * Set an element to a given index of a BaseProList : BaseProListChange.SET 
     68 * Add an element to a BaseProList : BaseProListChange.ADD 
     69 * Remove an element from a BaseProList : BaseProListChange.REMOVE 
    7070 * Create a Resource : CreateResourceChange (will be designed in the next revision). 
    7171 * Destroy a Resource : DestroyResourceChange (will be designed in the next revision). 
    72  * Create a pro-object in a ResourceSpace (Attach) : CreateProObjectChange. (may be better name is AttachChange or AttachProObjectChange). 
    73  * Destroy a pro-object that is an a ResourceSpace (Detach) : DestroyProObjectChange. (may be better name is DetachChange or DetachProObjectChange). 
     72 * Attach a ProObject to ResourceSpace : CreateProObjectChange. (may be a better name is AttachChange or AttachProObjectChange). 
     73 * Detach a ProObject from a ResourceSpace : DestroyProObjectChange. (may be better name is DetachChange or DetachProObjectChange). 
    7474 * Undo a change : UndoChange. 
    7575 * Redo a change : RedoChange. 
    7676 * Skip a change : SkipChange. The Unskip action is skip of a skip so this change will work for it. 
    7777 
    78 Some ideas for the old changes and the new changes: 
    79  * Pro-object related changes: 
    80   * There are some changes that are not in the UML diagram, they are connected with the pro objects only and are already implemented: 
    81   * This changes are all descendants of the ProChange, and more accurately BaseProChanges: 
    82    * BaseProListChange - there are three such changes ADD, REMOVE and SET, they are primitive changes for the pro-lists. 
    83    * CountChange - Used for testing of the AutoTracker. 
     78Some ideas for the old Changes and the new Changes: 
     79 * ProObject related Changes: 
     80  * There are some Changes that are not in the UML diagram, they are connected with the ProObjects only and are already implemented. These Changes are all descendants of ProChange, and more accurately BaseProChange: 
     81   * BaseProListChange - there are three such changes: ADD, REMOVE and SET, and they are primitive changes for the BaseProLists. 
     82   * CountChange - Used for testing of AutoTracker. 
    8483   * StatusChange - changes that track the status of the properties: 
    85     * InitChanges - used for initializing of the properties they are not primitive changes, because when to a property a value is set they will be triggered automatically. 
    86     * ValueChange - a primitive change for setting properties to a pro-object. 
    87   * ProObjectChange - this change is not used so maybe it will be deleted in the next revisions... 
    88  * Changes connected to the Resources: 
    89   * When creating a pro-object in a ResourceSpace two thing are important, the id of the pro-object given by the resource space and the type of the pro-object, so the constructor of this change will take proObjectId:String and proObjectType:Class<T extends ProObject>. 
    90   * When destroying the pro-object only it's id will be important to know what we have destroyed. So the DestroyProObjectChange will be constructed only by id. 
    91   * When creating a resource we will need the id of the resource and it's type too but the change must be different than this of the pro-objects because it is the beginning of a Resource's lifetime. 
    92   * The destruction of a resource is analogical. 
    93  * Special changes 
     84    * InitChanges - used for initializing of the properties. They are not primitive Changes, because when a value is set to a property they will be triggered automatically. 
     85    * ValueChange - a primitive Change for setting values to properties of a ProObject. 
     86  * ProObjectChange - this Change is not used so maybe it will be deleted in the next revisions... 
     87 * Changes related to Resources: 
     88  * When creating a ProObject in a ResourceSpace two things are important: the id of the ProObject assigned by its container ResourceSpace and the type of the ProObject, so the constructor of this Change will take proObjectId:String and proObjectType:Class<T extends ProObject>. 
     89  * When destroying a ProObject, only its id will be important in order to know what we have destroyed. So the DestroyProObjectChange will be constructed only by id. 
     90  * When creating a Resource, we will need the id of the Resource and its type too but the Change must be different than this of the pro-objects because it is the beginning of a Resource's lifetime. 
     91  * The destruction of a Resource is analogical. 
     92 * Special Changes: 
    9493  * The UndoChange undoes a Change so it will be constructed with a Change. 
    9594  * The RedoChange redoes an undo, so it will be constructed with an UndoChange. 
    9695  * The SkipChange behavior is unclear for now, but may be it will be constructed with a Change to skip. 
    9796 
    98 All these points clear the model of the changes. Now the logic that will be used for their management will be introduced. First this is the UML diagram:[[BR]] 
     97All these comments clarify the model of the Changes. Now the logic that will be used for their management will be introduced. First this is the UML diagram:[[BR]] 
    9998[[Image(source:branches/private/meddle/sophie2-platform/modules/org.sophie2.base.model.resources/doc/ChangesLogic.jpg)]][[BR]] 
    100  * ChangeManager : The old Undomanager will be deprecated, and will be removed from everywhere it's used, but will be saved for now until the undo/redo implementation. In it's place there will be only a ChangeManager. All the changes will be registered in a ChangeManager, it will have only one method - register that takes a Change to register. What will be done with the Change when registered depends of the implementation. For now there will be two implementations : 
    101   * DefaultChangeManager - All the pro-objects by default will register their changes in it, and only one instance of it will be needed for all of the changes so it will be singleton. Other thing is that the changes that are not in a ResourceSpace will be not stored, because only the state of the resource will be important for the server and the persistence... So on registration, the Changes will be just executed. 
    102   * ResourceChangeManager. 
    103    * Every Resource will have it's own ResourceChangeManager. It will be responsible for storing and grouping of the changes in it's Resource's ResourceSpace. 
    104    * The old logic for grouping from the UndoManager will be used for closing and opening groups, the Changes will be grouped on registration. 
    105    * The changes : CreateProObjectChange and DestroyProObjectChange will be handled here and all the values of the properties of the new pro-object and it's sub-pro-objects when attached will be registered as Changes in the history of the resource. 
    106    * The ResourceChangeManager will have History, for now it will store all the changes that the manager gives it as a list but in future it will be used for synchronization with the server, so it will have to visible methods : 
    107     * sync(newChanges : List<Change>) : List<Change> that for now adds the new changes to History and returns the added, in future the returned ones will be these from the server. 
    108     * changeList : ProList<Change> : used to get the ciontent of the history. 
    109    * The UndoChange and RedoChange for now will be part of the ResourceChangeManager, because they are connected with the manager of their changes and automatically will register themselves in it. may be in the future the SkipChange will be the same. 
    110    * The manager will construct itself with a Resource, it's Resource. 
    111  * GlobalResourceChangeManager : It will be used for grouping for the user changes from more than one ResourceSpaces. 
    112   * Important thing is that all the changes will be packed into groups, to have Global grouping, so the ResourceChangeManagers will group single changes too. That is not bad, because when serializing we will ungroup all the groups anyway. 
    113   * It will be one for all the Resources, so it will be singleton, it will group the changes for the current book hierarchy, to be nice for the user. Good AutoChanges must be written from the developers... 
     99 * ChangeManager : The old Undomanager will be deprecated, and will be removed from everywhere it's used, but will be saved for now until the undo/redo implementation. A ChangeManager will replace it. All the Changes will be registered in a ChangeManager, which will be an interface with only one method, register(), which takes a Change to register as an argument. What will be done with the Change when it is registered depends of the implementation. For now there will be two implementations : 
     100  * DefaultChangeManager: All the ProObjects by default will register their Changes in it, and only one instance of it will be needed for all of the changes so it will be singleton. Other thing is that the Changes that are not in a ResourceSpace will be not stored, because only the state of the Resource will be important for the server and the persistence... So on registration, the Changes will be just executed. 
     101  * ResourceChangeManager: 
     102   * Every Resource will have its own ResourceChangeManager. It will be responsible for storing and grouping of the changes in its Resource's ResourceSpace. 
     103   * The old logic for grouping from the UndoManager will be used for closing and opening groups and Changes will be grouped on registration. 
     104   * The Changes : CreateProObjectChange and DestroyProObjectChange will be handled here. When a new ProObject and its owned ProObjects are attached to a ResourceSpace, the creation and destruction of all the values of the properties of the ProObjects will be registered as Changes in the History of the Resource. 
     105   * The ResourceChangeManager will have a History, which for now will store all the Changes that the manager gives it as a list but in future it will be used for synchronization with the server, so it will have to visible methods : 
     106    * sync(newChanges : List<Change>) : List<Change> that for now adds the new changes to History of the Resource and returns the Cnanges which were actually added to the History. In the future, the returned ones will be these from the server. 
     107    * changeList : ProList<Change> : used to get the content of the History. 
     108   * The UndoChange and RedoChange for now will be part of the ResourceChangeManager, because they are connected with the manager the Changes they undo and respectively redo, and automatically will register themselves in it. Maybe in the future the SkipChange will be created in the same way. 
     109   * The manager will be constructed with a Resource as argument, because it's contained in ResourceSpace. 
     110 * GlobalResourceChangeManager : It will be used for grouping of the user Changes from more than one ResourceSpaces. 
     111  * Important thing is that all the Changes will be packed into groups, to have global grouping, so the ResourceChangeManagers will group single Changes too. That is not bad, because when serializing we will ungroup all the groups anyway. 
     112  * It will be one for all the Resources, so it will be singleton, it will group the Changes for the current book hierarchy, to be nice for the user. Good AutoChanges must be written from the developers... 
    114113  * It will work in this way: 
    115    * If global group must be opened (For every new set of changes or change it will open such a global group) it opens one with root Change the first change of the new set. The method shouldOpenGlobalGroup is used to check that. If there is already a root Change for the global group it will return false, otherwise true. 
    116    * If there is already opened global group it will add the incoming change to it, for that will be used hasOpenedGroup. 
    117    * If global group must be closed (The change that opened the group is closing itself) all the sub groups will be closed and the global group will be closed, so the root Change of the manager will be null. That's the purpose of the willCloseGroup method. 
    118    * All the changes grouped globally will be retrievable through the getAllChangesForResource method. 
    119   * All the global groups are virtual, they are not saved in the History of the Resources and are used only for displaying the list of the changes to the users nicely. 
     114   * If global group must be opened (for every new set of Changes or Change it will open such a global group), it opens one with root Change which is the first Change of the new set. The method shouldOpenGlobalGroup() is used to check that. If there is already a root Change for the global group, it will return false, otherwise true. 
     115   * If there is already opened global group, it will add the incoming Change to it. For that purpose, the method hasOpenedGroup() will be used. 
     116   * If global group must be closed (the Change that opened the group is closing itself), all the subgroups will be closed and the global group will be closed, so the root Change of the manager will be null. That's the purpose of the willCloseGroup() method. 
     117   * All the Changes grouped globally will be retrievable through the getAllChangesForResource() method. 
     118  * All the global groups are virtual, they are not saved in the History of the Resources and are used only for displaying the list of the Changes to the users nicely. 
    120119 * ResourceUndoManager - the new undo manager 
    121   * It will be singleton, because it will be used only from the currently selected resource and it don't need to know it at all, only the changes that will be unoded, redoed, skipped. 
    122   * For now it is only a skeleton that will be implemented in the next revisions, it will be able to work with skipping. 
    123   * It will be able to:  
     120  * It will be singleton, because it will be used only from the currently selected Resource and it doesn't need to know it at all, only the Changes that will be undone, redone, skipped. 
     121  * For now it is only a skeleton that will be implemented in the next revisions, but it will be able to work with skipping. 
     122  * It will be able to: 
    124123   * Retrieve the undo and redo Changes from a Change. 
    125    * To check if is possible to undo or to redo 
     124   * To check if is possible to undo or to redo. 
    126125   * To execute (register) Undo and Redo. 
    127126 
    128 That's all for the logic... The visible part: 
     127That's all for the logic... Now for the visible part: 
    129128 * The edit menu items will be modified to use the new ResourceUndoManager. 
    130  * Will be added AllChangesPalette that will list all the Changes for the current book globally grouped. 
     129 * An AllChangesPalette will be added which will list all the Changes for the current Book, globally grouped. 
    131130   * For now there will be no interactions. 
    132    * Most of the changes won't be grouped nicely, because of bad AutoChanges and the lack of the resource creation/destruction changes. 
    133    * The palette will use the GlobalResourceChangeManager.getAllChangesForResource(resource : Resource) method to get all of it's changes globally grouped. 
     131   * Most of the Canges won't be grouped nicely, because of bad AutoChanges and the lack of the Resource creation/destruction Changes. 
     132   * The palette will use the GlobalResourceChangeManager.getAllChangesForResource(resource : Resource) method to get all of its changes, globally grouped. 
    134133    
    135 For now that will be the visible part, the next step is to make the undo/redo work, after that skipping (may be interacting with the changes palette). The primitive changes must be serializable to work with client-server communication and saving the history of a Resource. The changes for creation and destruction of Resources must be designed and all the grouping of changes (AutoChanges) have to be refactored. After that we can work on the visual part :) 
     134For now, that will be the visible part. The next step is to make the undo/redo work, after that skipping (may be interacting with the Changes palette). The primitive Changes must be serializable to work with client-server communication and saving the History of a Resource. The Changes for creation and destruction of Resources must be designed and all the grouping of Changes (AutoChanges) have to be refactored. After that we can work on the visual part :) 
    136135 
    137136There are tests for the new logic: