wiki:UNPLANNED_GRADIENT_PERSISTER
Last modified 16 years ago Last modified on 07/29/09 13:06:14

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=UNPLANNED_GRADIENT_PERSISTER_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

A persister for save/load of the gradient of the background should be written.

Task requirements

  • Create persister for the ImmGradient class
  • Create persisters for all other classes used in ImmGradient, who haven't got one.
  • Create Unit Tests.

Task result

The result is source code.

Implementation idea

  • Create ValueRef-s and PropRef-s for all properties and attributes of the ImmGradient class.
  • Create Persister classes for those attributes/properties who haven't got one.

How to demo

  • Create new book, use gradient in the background, save/load it. Check that the gradient is the same as the one before the save.
  • Run the unit tests.

Design

  • Create ImmGradientPersister class, responsible for the persistence of the gradient.
  • In ImmGradient there are two attributes without persisters for them - GradientType and CycleMethodEnum - create classes to persist them too.
  • About GradientTypePersister class - write the gradient type as string in the storage. Change the enum GradientType in ImmGradient class in order to provide method to choose the correct enum member by given string. Provide attribute "stringRepresentation" in the enum and make every member to have a string representation for iself. later this string will be written to the sorage on save and the correct member will be chosen on load.
  • About CycleMethodEnumPersister class - The class MultipleGradientPaint has a fixed number of constants of its inner class CycleMethodEnum. So each of this constants can be written as string too, analogous to GradientTypePersister. On load the correcr constant will be chosen. The class CycleMethodEnum is not made to be instatiated and no instances should be created except for the three predefined - NO_CYCLE, REFLECT and REPEAT.
  • Create extensions for the new persisters in BasePersistenceModule class.
  • Add code for save/load of the gradient in BackgroundStylePersister.
  • Create class ImmGradientPersisterTest for testing save/load of the gradient.

Changesets: [4567]

Implementation

Implemented according to the design. Changeset: [4613]

Merged into the trunk at [4687].

Testing

Comments

  • The gradient types (linear and radial) can be written as strings in the storage on save and later the correct one to be chosen on load according to this string. Similar is the situation with CycleMethod. I will provide more details in the design section.
  • We are talking about adding this to the current Sophie book functionality. it is not correct to lose information about gradient on save/load.