Dataset columns with row-conditional readonly and backgroundColor

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

Dataset columns with row-conditional readonly and backgroundColor

Paul Baumann

Does someone know of a way to configure the #backgroundColor of a DataSetColumn based on a condition determined from the row being displayed?

 

I have a dataset with about 70 columns. Most of the columns are read-write. There are two similar kinds of objects that are shown as rows of the dataset. I want a read-write column to be read-only for one kind of row object but to remain read-write for the other kind of row object. I'd like the background color to reflect whether column-row field is read-write or read-only. I'm looking for techniques to do this.

 

This is what I've explored so far...

 

Right now DataSetColumnSpec.model for each column is set with aspect models created by window specs like (...#model: #'productRow opsLabel'). If I were to get conditional read/write by creating and using special kinds of aspect adaptors it seems that it is still the DataSetColumns that determine display/rendering for the backgroundColor. A color defined for #readonly.backgroundColor (in color configuration objects like HierarchicalSymbolicPaint and ChainedColorPreferences) wouldn't get used even after I figured out how to get it properly configured.

 

Right now some of the columns are configured with a #requestFocusInSelector: callback that answers false when editing is not allowed for the row object. That works when used but developers forgot to use the callback as columns were added. The protection was spotty at best and the approach is one that proved to be too easily missed as code evolved. Also, the read/write status of the column doesn't change with this technique; therefore, it seems unable to show read-only rows with a different backgroundColor than read-write rows. The column is always read-write but you just can't get focus to change anything.

 

I know the foreground color could be customized by defining column rules for #Text rendering; unfortunately this approach fails when editing with some kinds of adaptors and subjectChannels. Converters either didn't solve that problem or had nuances that were tricky to maintain later. Besides, the background color of the field is what I really want to configure.

 

I've been looking for a way to configure DataSetColumn, RowVisual, and/or AspectAdaptors to be conditionally read-write and to render themselves with a backgroundColor to reflect that. I'm thinking that a #postBuildWith: would configure the columnDescriptors of the DataSet such that read-write columns can be shown read-only based on row-specific conditions. It may that in the configuration of the RowVisual.renderers that this could be achieved. After spending a day looking at that code I thought it might be worth checking to see if someone else has already done this.

 

Ideas or examples are appreciated.

 

Thanks,

 

Paul Baumann

 

 

 

 



This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Dataset columns with row-conditional readonly and backgroundColor

jarober
You can define a visualBlock for the dataset, and the block looks like this:

widget := self widgetAt: #idOfDataset.
widget visualBlock: [:view :cell :gc | codeGoesHere]

The cell is a point (the x@y of the cell to be modified).
I used this recently to change the background color for an entire cell to a given color, based on the state of the underlying object.

One caveat - the safest way to use that approach is to not allow columns to be moved

On Nov 9, 2012, at 11:41 AM, Paul Baumann wrote:

Does someone know of a way to configure the #backgroundColor of a DataSetColumn based on a condition determined from the row being displayed?
 
I have a dataset with about 70 columns. Most of the columns are read-write. There are two similar kinds of objects that are shown as rows of the dataset. I want a read-write column to be read-only for one kind of row object but to remain read-write for the other kind of row object. I'd like the background color to reflect whether column-row field is read-write or read-only. I'm looking for techniques to do this.
 
This is what I've explored so far...
 
Right now DataSetColumnSpec.model for each column is set with aspect models created by window specs like (...#model: #'productRow opsLabel'). If I were to get conditional read/write by creating and using special kinds of aspect adaptors it seems that it is still the DataSetColumns that determine display/rendering for the backgroundColor. A color defined for #readonly.backgroundColor (in color configuration objects like HierarchicalSymbolicPaint and ChainedColorPreferences) wouldn't get used even after I figured out how to get it properly configured.
 
Right now some of the columns are configured with a #requestFocusInSelector: callback that answers false when editing is not allowed for the row object. That works when used but developers forgot to use the callback as columns were added. The protection was spotty at best and the approach is one that proved to be too easily missed as code evolved. Also, the read/write status of the column doesn't change with this technique; therefore, it seems unable to show read-only rows with a different backgroundColor than read-write rows. The column is always read-write but you just can't get focus to change anything.
 
I know the foreground color could be customized by defining column rules for #Text rendering; unfortunately this approach fails when editing with some kinds of adaptors and subjectChannels. Converters either didn't solve that problem or had nuances that were tricky to maintain later. Besides, the background color of the field is what I really want to configure.
 
I've been looking for a way to configure DataSetColumn, RowVisual, and/or AspectAdaptors to be conditionally read-write and to render themselves with a backgroundColor to reflect that. I'm thinking that a #postBuildWith: would configure the columnDescriptors of the DataSet such that read-write columns can be shown read-only based on row-specific conditions. It may that in the configuration of the RowVisual.renderers that this could be achieved. After spending a day looking at that code I thought it might be worth checking to see if someone else has already done this.
 
Ideas or examples are appreciated.
 
Thanks,
 
Paul Baumann
 
 
 
 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Dataset columns with row-conditional readonly and backgroundColor

Paul Baumann

It looks like #visualBlock: isn't a feature of DataSetView-RowVisual in the VW 7.5 we use. I had used #visualBlock: and #selectedVisualBlock: to do things like this in other code. That was a useful hint because it got me thinking about how it could be done for DataSetView.

 

The #displayOn: sends in DataSetView>>displayVisualAt: is approximately where a visualBlock could be evaluated to configure the backgroundColor and possibly the editor for a row. One way to disable editing for a row is to return nil from DataSetView>>setupEditor:at:downcast:. It is looking like it may only take a couple VW mods to enable cells to be configurable for rows.

Thanks for your help James. Have a nice weekend.

 

Paul Baumann

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of James Robertson
Sent: Friday, November 09, 2012 12:00
To: VWNC NC
Subject: Re: [vwnc] Dataset columns with row-conditional readonly and backgroundColor

 

You can define a visualBlock for the dataset, and the block looks like this:

 

widget := self widgetAt: #idOfDataset.

widget visualBlock: [:view :cell :gc | codeGoesHere]

 

The cell is a point (the x@y of the cell to be modified).

I used this recently to change the background color for an entire cell to a given color, based on the state of the underlying object.

 

One caveat - the safest way to use that approach is to not allow columns to be moved

 

On Nov 9, 2012, at 11:41 AM, Paul Baumann wrote:



Does someone know of a way to configure the #backgroundColor of a DataSetColumn based on a condition determined from the row being displayed?

 

I have a dataset with about 70 columns. Most of the columns are read-write. There are two similar kinds of objects that are shown as rows of the dataset. I want a read-write column to be read-only for one kind of row object but to remain read-write for the other kind of row object. I'd like the background color to reflect whether column-row field is read-write or read-only. I'm looking for techniques to do this.

 

This is what I've explored so far...

 

Right now DataSetColumnSpec.model for each column is set with aspect models created by window specs like (...#model: #'productRow opsLabel'). If I were to get conditional read/write by creating and using special kinds of aspect adaptors it seems that it is still the DataSetColumns that determine display/rendering for the backgroundColor. A color defined for #readonly.backgroundColor (in color configuration objects like HierarchicalSymbolicPaint and ChainedColorPreferences) wouldn't get used even after I figured out how to get it properly configured.

 

Right now some of the columns are configured with a #requestFocusInSelector: callback that answers false when editing is not allowed for the row object. That works when used but developers forgot to use the callback as columns were added. The protection was spotty at best and the approach is one that proved to be too easily missed as code evolved. Also, the read/write status of the column doesn't change with this technique; therefore, it seems unable to show read-only rows with a different backgroundColor than read-write rows. The column is always read-write but you just can't get focus to change anything.

 

I know the foreground color could be customized by defining column rules for #Text rendering; unfortunately this approach fails when editing with some kinds of adaptors and subjectChannels. Converters either didn't solve that problem or had nuances that were tricky to maintain later. Besides, the background color of the field is what I really want to configure.

 

I've been looking for a way to configure DataSetColumn, RowVisual, and/or AspectAdaptors to be conditionally read-write and to render themselves with a backgroundColor to reflect that. I'm thinking that a #postBuildWith: would configure the columnDescriptors of the DataSet such that read-write columns can be shown read-only based on row-specific conditions. It may that in the configuration of the RowVisual.renderers that this could be achieved. After spending a day looking at that code I thought it might be worth checking to see if someone else has already done this.

 

Ideas or examples are appreciated.

 

Thanks,

 

Paul Baumann

 

 

 

 

 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

 

James Robertson

 

 

 



This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Dataset columns with row-conditional readonly and backgroundColor

jarober
Mmm, looks like that code I recommended is an extension added to the project I'm working on

On Nov 9, 2012, at 6:36 PM, Paul Baumann wrote:

It looks like #visualBlock: isn't a feature of DataSetView-RowVisual in the VW 7.5 we use. I had used #visualBlock: and #selectedVisualBlock: to do things like this in other code. That was a useful hint because it got me thinking about how it could be done for DataSetView.
 
The #displayOn: sends in DataSetView>>displayVisualAt: is approximately where a visualBlock could be evaluated to configure the backgroundColor and possibly the editor for a row. One way to disable editing for a row is to return nil from DataSetView>>setupEditor:at:downcast:. It is looking like it may only take a couple VW mods to enable cells to be configurable for rows.
Thanks for your help James. Have a nice weekend.
 
Paul Baumann
 
 
From: [hidden email] [mailto:[hidden email]] On Behalf Of James Robertson
Sent: Friday, November 09, 2012 12:00
To: VWNC NC
Subject: Re: [vwnc] Dataset columns with row-conditional readonly and backgroundColor
 
You can define a visualBlock for the dataset, and the block looks like this:
 
widget := self widgetAt: #idOfDataset.
widget visualBlock: [:view :cell :gc | codeGoesHere]
 
The cell is a point (the x@y of the cell to be modified).
I used this recently to change the background color for an entire cell to a given color, based on the state of the underlying object.
 
One caveat - the safest way to use that approach is to not allow columns to be moved
 
On Nov 9, 2012, at 11:41 AM, Paul Baumann wrote:


Does someone know of a way to configure the #backgroundColor of a DataSetColumn based on a condition determined from the row being displayed?
 
I have a dataset with about 70 columns. Most of the columns are read-write. There are two similar kinds of objects that are shown as rows of the dataset. I want a read-write column to be read-only for one kind of row object but to remain read-write for the other kind of row object. I'd like the background color to reflect whether column-row field is read-write or read-only. I'm looking for techniques to do this.
 
This is what I've explored so far...
 
Right now DataSetColumnSpec.model for each column is set with aspect models created by window specs like (...#model: #'productRow opsLabel'). If I were to get conditional read/write by creating and using special kinds of aspect adaptors it seems that it is still the DataSetColumns that determine display/rendering for the backgroundColor. A color defined for #readonly.backgroundColor (in color configuration objects like HierarchicalSymbolicPaint and ChainedColorPreferences) wouldn't get used even after I figured out how to get it properly configured.
 
Right now some of the columns are configured with a #requestFocusInSelector: callback that answers false when editing is not allowed for the row object. That works when used but developers forgot to use the callback as columns were added. The protection was spotty at best and the approach is one that proved to be too easily missed as code evolved. Also, the read/write status of the column doesn't change with this technique; therefore, it seems unable to show read-only rows with a different backgroundColor than read-write rows. The column is always read-write but you just can't get focus to change anything.
 
I know the foreground color could be customized by defining column rules for #Text rendering; unfortunately this approach fails when editing with some kinds of adaptors and subjectChannels. Converters either didn't solve that problem or had nuances that were tricky to maintain later. Besides, the background color of the field is what I really want to configure.
 
I've been looking for a way to configure DataSetColumn, RowVisual, and/or AspectAdaptors to be conditionally read-write and to render themselves with a backgroundColor to reflect that. I'm thinking that a #postBuildWith: would configure the columnDescriptors of the DataSet such that read-write columns can be shown read-only based on row-specific conditions. It may that in the configuration of the RowVisual.renderers that this could be achieved. After spending a day looking at that code I thought it might be worth checking to see if someone else has already done this.
 
Ideas or examples are appreciated.
 
Thanks,
 
Paul Baumann
 
 
 
 
 

This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
 
 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Dataset columns with row-conditional readonly and backgroundColor

Paul Baumann

The implementation I finished with was a modification to two methods of UI.DataSetView. This is what it achieves:

 

1) The backgroundColor of each cell can be customized by defining

   #backgroundColor_dataSetView:column:cell:paintAsSelection:graphicsContext:

   on the ApplicationModel.

 

2) A read-write cell can be made read-only by a

   #canEdit_dataSetView:column:cell: method on the ApplicationModel.

 

3) The default backgroundColor of read-only cells has been changed

   to one that shows a contrast from read-write cells.

 

The attached zip file contains a filein .st file with the changes. Simple example code is in the filein comments. For convenience, this implementation uses #respondsTo: to determine if an ApplicationModel may want to customize how cells. Use or change it however you want. Hopefully Cincom will do something to support cell-level customization in a future VW release.

 

Paul Baumann

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of James Robertson
Sent: Friday, November 09, 2012 19:11
To: VWNC NC
Subject: Re: [vwnc] Dataset columns with row-conditional readonly and backgroundColor

 

Mmm, looks like that code I recommended is an extension added to the project I'm working on

 

On Nov 9, 2012, at 6:36 PM, Paul Baumann wrote:



It looks like #visualBlock: isn't a feature of DataSetView-RowVisual in the VW 7.5 we use. I had used #visualBlock: and #selectedVisualBlock: to do things like this in other code. That was a useful hint because it got me thinking about how it could be done for DataSetView.

 

The #displayOn: sends in DataSetView>>displayVisualAt: is approximately where a visualBlock could be evaluated to configure the backgroundColor and possibly the editor for a row. One way to disable editing for a row is to return nil from DataSetView>>setupEditor:at:downcast:. It is looking like it may only take a couple VW mods to enable cells to be configurable for rows.

Thanks for your help James. Have a nice weekend.

 

Paul Baumann

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of James Robertson
Sent: Friday, November 09, 2012 12:00
To: VWNC NC
Subject: Re: [vwnc] Dataset columns with row-conditional readonly and backgroundColor

 

You can define a visualBlock for the dataset, and the block looks like this:

 

widget := self widgetAt: #idOfDataset.

widget visualBlock: [:view :cell :gc | codeGoesHere]

 

The cell is a point (the x@y of the cell to be modified).

I used this recently to change the background color for an entire cell to a given color, based on the state of the underlying object.

 

One caveat - the safest way to use that approach is to not allow columns to be moved

 

On Nov 9, 2012, at 11:41 AM, Paul Baumann wrote:




Does someone know of a way to configure the #backgroundColor of a DataSetColumn based on a condition determined from the row being displayed?

 

I have a dataset with about 70 columns. Most of the columns are read-write. There are two similar kinds of objects that are shown as rows of the dataset. I want a read-write column to be read-only for one kind of row object but to remain read-write for the other kind of row object. I'd like the background color to reflect whether column-row field is read-write or read-only. I'm looking for techniques to do this.

 

This is what I've explored so far...

 

Right now DataSetColumnSpec.model for each column is set with aspect models created by window specs like (...#model: #'productRow opsLabel'). If I were to get conditional read/write by creating and using special kinds of aspect adaptors it seems that it is still the DataSetColumns that determine display/rendering for the backgroundColor. A color defined for #readonly.backgroundColor (in color configuration objects like HierarchicalSymbolicPaint and ChainedColorPreferences) wouldn't get used even after I figured out how to get it properly configured.

 

Right now some of the columns are configured with a #requestFocusInSelector: callback that answers false when editing is not allowed for the row object. That works when used but developers forgot to use the callback as columns were added. The protection was spotty at best and the approach is one that proved to be too easily missed as code evolved. Also, the read/write status of the column doesn't change with this technique; therefore, it seems unable to show read-only rows with a different backgroundColor than read-write rows. The column is always read-write but you just can't get focus to change anything.

 

I know the foreground color could be customized by defining column rules for #Text rendering; unfortunately this approach fails when editing with some kinds of adaptors and subjectChannels. Converters either didn't solve that problem or had nuances that were tricky to maintain later. Besides, the background color of the field is what I really want to configure.

 

I've been looking for a way to configure DataSetColumn, RowVisual, and/or AspectAdaptors to be conditionally read-write and to render themselves with a backgroundColor to reflect that. I'm thinking that a #postBuildWith: would configure the columnDescriptors of the DataSet such that read-write columns can be shown read-only based on row-specific conditions. It may that in the configuration of the RowVisual.renderers that this could be achieved. After spending a day looking at that code I thought it might be worth checking to see if someone else has already done this.

 

Ideas or examples are appreciated.

 

Thanks,

 

Paul Baumann

 

 

 

 

 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

 

James Robertson

 

 

 

 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

 

James Robertson

 

 

 



This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

DataSet cell configuration.zip (3K) Download Attachment