GLM: preserving columns width in tables // getting the actual column

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

GLM: preserving columns width in tables // getting the actual column

Arturo Zambrano
Hi All,
 I would like to preserve the width of columns for tables after a user has changed them (not fast tables, but it should be similar).
  To do this I plan to get the actual width of the columns and use it the next time I need to create the table.
 Please consider the following snippet:

browser := GLMTabulator new.
browser row: #Example.
browser transmit
to: #Example;
andShow: [ :a | 
table:=  a table.
table  
  column: 'Class Name' evaluated:[:clazz| clazz name] width:100;
column: '# of methods' evaluated:[:clazz| clazz methods size] width:150;
  children:[:clazz| clazz subclasses]; 
  shouldRootsExpand: true ].
browser openOn: {Object}.

 If I resize the columns in the UI and then run

table columns collect:[:c| c width]

I get the original sizes but not the actual ones.

I have two questions:
  1- Is there a way to get the actual values for column width?
  2 - Is there an event that gets fired when column sizes are changed in the UI?

If there is such an event maybe all that is needed it to update the width inst. var in the columns (GLMTableColumns). 

TIA
Arturo




Reply | Threaded
Open this post in threaded view
|

Re: GLM: preserving columns width in tables // getting the actual column

Tudor Girba-2
Hi,

There is no built-in support for something like this.

You would have to change the internal logic of the TablePresentation renderer.

Cheers,
Doru



> On Oct 4, 2018, at 7:16 PM, Arturo Zambrano <[hidden email]> wrote:
>
> Hi All,
>  I would like to preserve the width of columns for tables after a user has changed them (not fast tables, but it should be similar).
>   To do this I plan to get the actual width of the columns and use it the next time I need to create the table.
>  Please consider the following snippet:
>
> browser := GLMTabulator new.
> browser row: #Example.
> browser transmit
> to: #Example;
> andShow: [ :a |
> table:=  a table.
> table  
>  column: 'Class Name' evaluated:[:clazz| clazz name] width:100;
> column: '# of methods' evaluated:[:clazz| clazz methods size] width:150;
>  children:[:clazz| clazz subclasses];
>  shouldRootsExpand: true ].
> browser openOn: {Object}.
>
>  If I resize the columns in the UI and then run
>
> table columns collect:[:c| c width]
>
> I get the original sizes but not the actual ones.
>
> I have two questions:
>   1- Is there a way to get the actual values for column width?
>   2 - Is there an event that gets fired when column sizes are changed in the UI?
>
> If there is such an event maybe all that is needed it to update the width inst. var in the columns (GLMTableColumns).
>
> TIA
> Arturo
>
>
>
>

--
www.feenk.com

"From an abstract enough point of view, any two things are similar."






Reply | Threaded
Open this post in threaded view
|

Re: GLM: preserving columns width in tables // getting the actual column

Arturo Zambrano
Hi Tudor, all
 thanks for your reply. 
 I would like your opinion about the cleanest way to add this considering that:
  •  Columns are added in GLMMorphicListingRenderer>> treeMorphFor: tmpTreeModel and: aPresentation
  • GLMMorphTreeColumn implements currentWidth: and currentWidth
Should I setup an observer so that when the GLMMorphTreeColumn has its width changed the presentation is notified? then expose in GLMTablePresentation the actual widths of the columns?

That would do the trick for me, but not sure about the proper way to add this behavior

Thanks!
Arturo





On Thu, Oct 4, 2018 at 4:27 PM Tudor Girba <[hidden email]> wrote:
Hi,

There is no built-in support for something like this.

You would have to change the internal logic of the TablePresentation renderer.

Cheers,
Doru



> On Oct 4, 2018, at 7:16 PM, Arturo Zambrano <[hidden email]> wrote:
>
> Hi All,
>  I would like to preserve the width of columns for tables after a user has changed them (not fast tables, but it should be similar).
>   To do this I plan to get the actual width of the columns and use it the next time I need to create the table.
>  Please consider the following snippet:
>
> browser := GLMTabulator new.
> browser row: #Example.
> browser transmit
>       to: #Example;
>       andShow: [ :a |
>               table:=  a table.
>               table 
>                 column: 'Class Name' evaluated:[:clazz| clazz name] width:100;
>                       column: '# of methods' evaluated:[:clazz| clazz methods size] width:150;
>                 children:[:clazz| clazz subclasses];
>                 shouldRootsExpand: true ].                   
>        browser openOn: {Object}.     
>
>  If I resize the columns in the UI and then run
>
> table columns collect:[:c| c width]           
>
> I get the original sizes but not the actual ones.
>
> I have two questions:
>   1- Is there a way to get the actual values for column width?
>   2 - Is there an event that gets fired when column sizes are changed in the UI?
>
> If there is such an event maybe all that is needed it to update the width inst. var in the columns (GLMTableColumns).
>
> TIA
> Arturo
>
>
>
>

--
www.feenk.com

"From an abstract enough point of view, any two things are similar."