ROGridLayout versus ROCellLayout semantics

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ROGridLayout versus ROCellLayout semantics

Ben Coman

With the understanding that: I might be missing some context or use-case; that the behaviour has probably been inherited from MOGridLayout; and you might not want to mess it for for backward compatability, I'm going to have a nit-pick at the semantics of ROGridLayout.  The class comment says "A ROGridLayout places elements as a grid." 

By "grid", I had expected the usual definition [1] of "a network of uniformly spaced horizontal and perpendicular" items
However I was surprised that ROGridLayout did not provide such uniformly spaced items, as seen with the following script that produced the attached ROGridLayout.png:

view := ROView new.
bytes := (0 to: 255) asOrderedCollection.
40 timesRepeat: [bytes add: 0 ].
bytes do:
[    :byte |
    view add: ( ROElement on: byte) + ( ROLabel new text: [ :element | element model printStringBase: 16 ] ).
].
ROGridLayout on: view elements.
view open.

For my requirements, thankfully this seems to have been addressed by adding ROCellLayout**, with the class comment "A ROCellLayout is like ROGridLayout. Elements of each column are centered along the same vertical line. And elements of each row are centered along the same horizontal line."   In the script above repalcing ROGridLayout by ROCellLayout produces attached file ROCellLayout.png. It looks much better .

To me, ROCellLayout doesn't sound like the right name for its behaviour, whereas ROGridLayout would be a perfect fit.  The existing ROGridLayout behaviour seems more a "block" or "rectangle" or layout.

So with that background, the questions I wanted raise were: 
1. What is the use case for preferring the behaviour of ROGridLayout over that of ROCellLayout ?
2. Can ROCellLayout replace the existing ROGridLayout, to remove its "surprising" behaviour
3. What am I'm missing, or am I being needlessly controversial ? :)

cheers -ben

[1] http://www.merriam-webster.com/dictionary/grid
** From method versions this looks like ROCellLayout was added by Jura. Good work and thanks.
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev

ROGridLayout.png (15K) Download Attachment
ROCellLayout.png (17K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: ROGridLayout versus ROCellLayout semantics

Tudor Girba-2
Hi,

I agree. I would rename:
- ROCellLayout to ROGridLayout
- ROGridLayout to ROCountFlowLayout
- ROFlowLayout to ROWidthFlowLayout

The last two are the same, the difference being that they limit the size of the row based on either the element count or the total element width.

Cheers,
Doru



On Mon, Sep 9, 2013 at 10:54 AM, Ben Coman <[hidden email]> wrote:

With the understanding that: I might be missing some context or use-case; that the behaviour has probably been inherited from MOGridLayout; and you might not want to mess it for for backward compatability, I'm going to have a nit-pick at the semantics of ROGridLayout.  The class comment says "A ROGridLayout places elements as a grid." 

By "grid", I had expected the usual definition [1] of "a network of uniformly spaced horizontal and perpendicular" items
However I was surprised that ROGridLayout did not provide such uniformly spaced items, as seen with the following script that produced the attached ROGridLayout.png:

view := ROView new.
bytes := (0 to: 255) asOrderedCollection.
40 timesRepeat: [bytes add: 0 ].
bytes do:
[    :byte |
    view add: ( ROElement on: byte) + ( ROLabel new text: [ :element | element model printStringBase: 16 ] ).
].
ROGridLayout on: view elements.
view open.

For my requirements, thankfully this seems to have been addressed by adding ROCellLayout**, with the class comment "A ROCellLayout is like ROGridLayout. Elements of each column are centered along the same vertical line. And elements of each row are centered along the same horizontal line."   In the script above repalcing ROGridLayout by ROCellLayout produces attached file ROCellLayout.png. It looks much better .

To me, ROCellLayout doesn't sound like the right name for its behaviour, whereas ROGridLayout would be a perfect fit.  The existing ROGridLayout behaviour seems more a "block" or "rectangle" or layout.

So with that background, the questions I wanted raise were: 
1. What is the use case for preferring the behaviour of ROGridLayout over that of ROCellLayout ?
2. Can ROCellLayout replace the existing ROGridLayout, to remove its "surprising" behaviour
3. What am I'm missing, or am I being needlessly controversial ? :)

cheers -ben

[1] http://www.merriam-webster.com/dictionary/grid
** From method versions this looks like ROCellLayout was added by Jura. Good work and thanks.

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev