How to change the cell background color? [message #1516798] |
Thu, 18 December 2014 23:06  |
Eclipse User |
|
|
|
I created editable Natable with combo and text editor. I am not able to find the approach to change the cell backgroud color based on the editable rule.
When the cell is not editable then i need to change the cell background color form white to gray color.
Is there anyway to get the isEditable value from cell and render with different color?
Please help me .
|
|
|
|
Re: How to change the cell background color? [message #1517559 is a reply to message #1517408] |
Fri, 19 December 2014 10:39   |
Eclipse User |
|
|
|
Hi Dirk,
I have used some custom rule and also IEditableRule.NEVER_EDITABLE. We override the getConfigLabelsByPosition() method in the DataLayer like below. Its working fine.
In my table editable/non editable is dynamic not the static and its controlled from other UI field in the same application. During the loading of the table, the entire table might be editable when the users change some option in the table or outside the table then we have to disable some columns cells in the row and paint cell with gray color.
In order to implements this requirement, I have override the datalayer like below. I found this is calling very time and repairing the cell. I was able to get the isEditable flag from the configuration.
Please let me know is this right approach.
bodyDataLayer = new DataLayer(bodyDataProvider)
{
@Override
public LabelStack getConfigLabelsByPosition(int columnPosition,
int rowPosition) {
// TODO Auto-generated method stub
LabelStack configLabel = super.getConfigLabelsByPosition(columnPosition, rowPosition);
ILayerCell layer = super.getCellByPosition(columnPosition, rowPosition);
IEditableRule editableRule = (IEditableRule)configRegistry.getConfigAttribute(
EditConfigAttributes.CELL_EDITABLE_RULE,
"EDIT", configLabel.getLabels());
boolean isEditable = editableRule.isEditable(layer, configRegistry);
if(isEditable)
{
getConfigLabelAccumulator().accumulateConfigLabels(configLabel, columnPosition, rowPosition);
configLabel.addLabelOnTop(MyUICommon.EDITABLE_LABEL);
}
else
{
getConfigLabelAccumulator().accumulateConfigLabels(configLabel, columnPosition, rowPosition);
configLabel.addLabelOnTop(MyUICommon.NONEDITABLE_LABEL);
}
return configLabel;
}
};
|
|
|
|
Powered by
FUDForum. Page generated in 0.03763 seconds