11 |
:Scope: Trivial |
:Scope: Trivial |
12 |
:Type: Feature |
:Type: Feature |
13 |
|
|
14 |
This PEG proposes creating **Abstract ColorableVob** class, which |
This PEG proposes creating **AbstractColorableVob** class, which |
15 |
implements a new **Colorable interface** also defined by this PEG. |
implements a new **ColorableVob interface** also defined by this PEG. |
16 |
|
|
17 |
**Colorable Vob** is a very basic vob type, which enhances the regular |
**ColorableVob** is a very basic vob type, which enhances the regular |
18 |
Vob with interface for placing multiple solid colors on its |
Vob with interface for placing multiple solid colors on its |
19 |
background. The multiple solid colors are used a lot in basic views |
background. The multiple solid colors are used a lot in basic views |
20 |
i.e. to show cursor location and node properties. In the current |
i.e. to show cursor location and node properties. In the current |
23 |
|
|
24 |
This PEG replaces the older `PEG for Abstract Background Vob`__. |
This PEG replaces the older `PEG for Abstract Background Vob`__. |
25 |
|
|
26 |
|
This PEG is depends on replacing current abstract class Vob with |
27 |
|
interface Vob and abstract class AbstractVob, which implements the |
28 |
|
first one. |
29 |
|
|
30 |
.. _PEG: ../vob_bgvob--humppake/peg.gen.html |
.. _PEG: ../vob_bgvob--humppake/peg.gen.html |
31 |
__ PEG_ |
__ PEG_ |
32 |
|
|
61 |
Multi-coloring stored vob prototype (which implements Colorable Vob) |
Multi-coloring stored vob prototype (which implements Colorable Vob) |
62 |
could be cloned using method:: |
could be cloned using method:: |
63 |
|
|
64 |
Colorable cloneColored(Color[] colors); |
ColorableVob cloneColored(Color[] colors); |
65 |
|
|
66 |
|
There will be also several shorthands for that method, which are |
67 |
|
discussed later. |
68 |
|
|
69 |
- How is Colorable Vob related to background vobs? |
- How is Colorable Vob related to background vobs? |
70 |
|
|
71 |
RESOLVED: Colorable Vob won't define any background vob properties |
RESOLVED: Colorable Vob won't define any background vob properties |
72 |
like background color or border. Although, background vobs should be |
like background color or border. Although, background vobs should be |
73 |
immutable and use the common interface for multiple solid colors; |
immutable and use the common interface for multiple solid colors; |
74 |
They should be inherited from ``ColorableVob``. |
They should be inherited from ``AbstractColorableVob``. |
75 |
|
|
76 |
- How should Colorable Vob be assembled? |
- How should Colorable Vob be assembled? |
77 |
|
|
78 |
RESOLVED: ColorableVob extends the basic Vob class and implements |
RESOLVED: ColorableVob extends the basic Vob class and implements |
79 |
Colorable interface for multiple background colors. |
Colorable interface for multiple background colors. |
80 |
|
|
81 |
|
RE-RESOLVED: AbstractColorableVob extends AbstractVob and implements |
82 |
|
ColorableVob interface. ColorableVob interface is extended from |
83 |
|
interface Vob. |
84 |
|
|
85 |
- How should the new interfaces and classes be named? |
- How should the new interfaces and classes be named? |
86 |
|
|
87 |
RESOLVED: **public interface Colorable** and **public abstract class |
RESOLVED: **public interface Colorable** and **public abstract class |
97 |
interface Colorable + abstract class Vob = |
interface Colorable + abstract class Vob = |
98 |
abstract class ColorableVob |
abstract class ColorableVob |
99 |
|
|
100 |
|
RE-RESOLVED: **public interface ColorableVob** and |
101 |
|
**public abstract class AbstractColorableVob**, because creation of |
102 |
|
AbstractVob |
103 |
|
|
104 |
- Where they should be located? |
- Where they should be located? |
105 |
|
|
106 |
RESOLVED: Currently in the package **``gzz.vob``** |
RESOLVED: Currently in the package **``gzz.vob``** |
107 |
(``gzz.vob.Colorable`` and ``gzz.vob.ColorableVob``. Probably in the |
(``gzz.vob.ColorableVob`` and |
108 |
|
``gzz.vob.AbstractColorableVob``. Probably in the |
109 |
future they will be moved into package ``org.libvob.vob``. |
future they will be moved into package ``org.libvob.vob``. |
110 |
|
|
111 |
- How should *solids* be renamed? |
- How should *solids* be renamed? |
129 |
It still possible to use ArrayList for building up the colors and pass |
It still possible to use ArrayList for building up the colors and pass |
130 |
``List.toArray()`` to ``Colorable.cloneColored()``. |
``List.toArray()`` to ``Colorable.cloneColored()``. |
131 |
|
|
132 |
|
Even the inner presentation of colors in ColorableVob is Color Array, |
133 |
|
It should also be possible to call cloneColored with an ArrayList. |
134 |
|
|
135 |
- How should the colors be set? |
- How should the colors be set? |
136 |
|
|
137 |
RESOLVED: Since Colorable Vob should be immutable, colors |
RESOLVED: Since Colorable Vob should be immutable, colors |
147 |
colors == its own colors, but it's not obligated to compare the |
colors == its own colors, but it's not obligated to compare the |
148 |
lists. |
lists. |
149 |
|
|
150 |
|
There should be also several shorthands for the default |
151 |
|
cloneColored:: |
152 |
|
|
153 |
|
ColorableVob cloneColored(List); // for List |
154 |
|
ColorableVob cloneColored(Color); // for single color |
155 |
|
|
156 |
|
RE-RESOLVED: Previously introduced methods add the new colors |
157 |
|
(parameters) next to old ones (the colors of the original vob). |
158 |
|
Actually, the methods are only overloading methods for ones |
159 |
|
with overriding flag:: |
160 |
|
|
161 |
|
ColorableVob cloneColored(Color[], boolean); |
162 |
|
ColorableVob cloneColored(List), boolean; |
163 |
|
ColorableVob cloneColored(Color, boolean); |
164 |
|
|
165 |
|
When flag is set, old colors will |
166 |
|
be replaced when cloning, if unset, the new colors |
167 |
|
will be added next to old ones. ? |
168 |
|
|
169 |
|
|
170 |
- Should SolidBgVob be inherited from Colorable Vob? |
- Should SolidBgVob be inherited from Colorable Vob? |
171 |
|
|
172 |
RESOLVED: No. ``SolidBgVob`` is not a such background vob than other |
RESOLVED: No. ``SolidBgVob`` is not a such background vob than other |
185 |
- Interface Colorable needs Object.clone(), that needs implenting |
- Interface Colorable needs Object.clone(), that needs implenting |
186 |
java.lang.Cloneable interface. Who should implement it? |
java.lang.Cloneable interface. Who should implement it? |
187 |
|
|
188 |
RESOLVED: Since it's currently needed only by interface Colorable, |
RESOLVED: Since it's currently needed only by interface ColorableVob, |
189 |
its implementation ColorableVob should implement also interface |
its implementation AbstractColorableVob should implement also interface |
190 |
Cloneable. |
Cloneable. |
191 |
|
|
192 |
Changes |
Changes |
193 |
------- |
------- |
194 |
|
|
195 |
The Java classes **public interface Colorable** and **public abstract |
The Java classes **public interface ColorableVob** and **public abstract |
196 |
class ColorableVob** should be created after the following |
class AbstractColorableVob** should be created after the following |
197 |
diagram: |
diagram: |
198 |
|
|
199 |
.. UML:: abstractcolorablevob |
.. UML:: abstractcolorablevob |
200 |
|
|
201 |
jlinkpackage gzz.vob |
jlinkpackage gzz.vob |
202 |
|
|
203 |
class Vob "abstract" |
class Vob "interface" |
|
jlink |
|
204 |
|
|
205 |
class Colorable "interface" |
class AbstractVob "abstract" |
206 |
|
realize Vob |
207 |
|
|
208 |
|
class ColorableVob "interface" |
209 |
|
inherit Vob |
210 |
methods |
methods |
211 |
+Colorable cloneColored(Color[] colors) |
+ColorableVob cloneColored(Color[] colors) |
212 |
|
+ColorableVob cloneColored(List colors) |
213 |
|
+ColorableVob cloneColored(Color c) |
214 |
|
+ColorableVob cloneColored(Color[] colors, boolean override) |
215 |
|
+ColorableVob cloneColored(List colors, boolean override) |
216 |
|
+ColorableVob cloneColored(Color c, boolean override) |
217 |
+Color[] getColors() |
+Color[] getColors() |
218 |
|
|
219 |
class java.lang.Cloneable "interface" |
class java.lang.Cloneable "interface" |
220 |
|
|
221 |
class ColorableVob "abstract" |
class AbstractColorableVob "abstract" |
222 |
realize java.lang.Cloneable |
realize java.lang.Cloneable |
223 |
realize Colorable |
realize ColorableVob |
224 |
inherit Vob |
inherit AbstractVob |
225 |
methods |
methods |
226 |
#Color[] colors |
#Color[] colors |
227 |
|
|
228 |
class vobs.RectBgVob |
class vobs.RectBgVob |
229 |
realize ColorableVob |
realize AbstractColorableVob |
230 |
|
|
231 |
class vobs.OvalBgVob |
class vobs.OvalBgVob |
232 |
realize ColorableVob |
realize AbstractColorableVob |
233 |
|
|
234 |
class vobs.ColoredSectorVob |
class vobs.ColoredSectorVob |
235 |
inherit vobs.OvalBgVob |
inherit vobs.OvalBgVob |
238 |
inherit vobs.ColoredSectorVob |
inherit vobs.ColoredSectorVob |
239 |
|
|
240 |
--- |
--- |
241 |
horizontally(50, vob_h, Colorable, Vob, java.lang.Cloneable); |
horizontally(50, vob_h, Vob, AbstractVob, java.lang.Cloneable); |
242 |
vertically(50, vob_v, Vob, ColorableVob, vobs.RectBgVob); |
vertically(50, vob_v, java.lang.Cloneable, AbstractColorableVob, vobs.OvalBgVob); |
243 |
|
horizontally(50, colorable_h, ColorableVob, AbstractColorableVob); |
244 |
horizontally(50, vobs_h, vobs.RectBgVob, vobs.OvalBgVob); |
horizontally(50, vobs_h, vobs.RectBgVob, vobs.OvalBgVob); |
245 |
vertically(50, sector_v, vobs.OvalBgVob, vobs.ColoredSectorVob); |
vertically(50, sector_v, vobs.OvalBgVob, vobs.ColoredSectorVob); |
246 |
horizontally(50, sector_h, vobs.ColoredSquareSectorVob, vobs.ColoredSectorVob); |
horizontally(50, sector_h, vobs.ColoredSquareSectorVob, vobs.ColoredSectorVob); |
247 |
|
|
248 |
The following background vobs should be modified to inherit |
The following background vobs should be modified to inherit |
249 |
``ColorableVob``: |
``AbstractColorableVob``: |
250 |
|
|
251 |
- ``gzz.vob.vobs.RectBgVob`` |
- ``gzz.vob.vobs.RectBgVob`` |
252 |
- ``gzz.vob.vobs.OvalBgVob`` |
- ``gzz.vob.vobs.OvalBgVob`` |
261 |
implements Colorable) is needed, it will be created by passing colors |
implements Colorable) is needed, it will be created by passing colors |
262 |
to prototype's cloning method:: |
to prototype's cloning method:: |
263 |
|
|
264 |
Colorable cloneColored(Color[] colors); |
ColorableVob cloneColored(Color[] colors); |