Analysis
Overview
Frame property locking provides the ability a property to be protected from changing. Frame property locking should be presented to the user as a checkbox in the Frame hud. When the checkbox is checked for a property, it's value will not be changeable until it's checkbox is unchecked.
Task requirements
Provide a prototype of frame property locking. Locking should be available for frame:
- content
- insets
- bounds
- border style
- background style
- shadow style
Providing locking for these is enough for this revision. In later revisions, they may be split into sub-elements (border style - border thickness, border color, etc).
Task result
The result of this task must be code.
Implementation idea
Create a value property
- contentLock
- insetsLock
- boundsLock
- borderLock
- backgroundLock
- shadowLock
at the Frame class.
Related
How to demo
- Create a frame.
- Lock the border.
- Change border width.
- Assert that border width is the same.
Design
- In the TemplateField class in org.sophie2.base.model module add property boolean value property locked which will provide if property could be changed. If the value of this property locked() is true, then the value of property could not be changed.
- Create method setOwnValue(T value) which will set value of the own property depending on if locked() is true or false.
- Add boolean value property contentLock() in Frame class that will provide if the content of the Frame is locked.
- Add setFrameContent(FrameContent content) method that will sets the own content of the frame depending on whether locked property is true or false.
- org.sophie2.base.model.book.FramePropertyLockingTest is a test for frame properties locking.
Implementation
(Implementation results should be described and linked here (from the wiki or the repository))
Testing
Comments
- The current situation with properties is as follow:
- Frame
- RwProp<Page> parent()
- Prop<UUID> id() (final)
- Prop<ShadowStyle> shadow() (auto, @own)
- RwProp<ImmPoint> position()
- RwProp<Color> color()
- RwProp<Double> opacity()
- RwProp<Boolean> enabled()
- RwProp<Integer> zOrder() (auto)
- RwProp<FrameContent> content() (value, own)
- RwProp<Frame> template() (value)
- RwProp<ImmSize> size() (value)
- RwProp<ImmPoint> location() (value)
- RwProp<ImmRect> bounds() (value)
- Prop<BorderStyle> border() (auto)
- RwProp<Integer> borderThickness()
- RwProp<Color> borderColor()
- Prop<BackgroundStyle> background()
- RwProp<BackgroundType> bgType()
- RwProp<Color> bgColor()
- RwProp<ImageBookResource> bgImageResource()
- RwProp<Double> bgOpacity()
- RwProp<MultipleGradientPaint> bgGradient()
- Prop<ColorProps> borderColor()
- RwProp<Color> color()
- RwProp<Float> transparency()
- RwProp<ColorProps> ownBorderColor()
- RwProp<Boolean> borderColorLock()
- RwProp<Insets> borderInsets() -> Prop (auto, @own)
- RwProp<Float> top()
- RwProp<Float> left()
- RwProp<Float> bottom()
- RwProp<Float> right()
- RwProp<Insets> ownBorderInsets()
- RwProp<Boolean> borderInsetsLock()
- RwProp<Insets> paddingInsets()
- RwProp<Insets> marginsInsets()
- RwProp<ImmSize> sizeTodo()
- RwProp<ImmPoint> locationTodo()
- RwProp<ImmRect> boundsTodo()
- Frame