on 05-16-2008 3:38 PM
Hi, i want to set the negative values in the table in the red color.I have created the table dynamically.So i have created a context node called "ColorData" and in that i created a context attribute "grossSemantic". I have set the type of this attribute as "com.sap.ide.webdynpro.uielementdefinitions.TextViewSemanticColor" .And i have written the below code.
But there is no effect at all. Where am i going wrong? Please suggest.
String color = "ColorData";
IPrivate<ViewName>.IColorDataNode colorNode = wdContext.nodeColorData();
IPrivate<ViewName>.IColorDataElement colorElem = colorNode.createColorDataElement();
for(int flag = 0; flag < wdContext.node<BapiNodeName>.size(); flag++){
IPrivate<ViewName>.I<BapiNodeElement> tableElem = bapiNode.get<BapiElement>(flag);
if(tableElem.get<ColumnName()>.signum() == -1){
editor.bindDesign(color "." "grossSemantic");
colorElem.setGrossSemantic(WDTextViewSemanticColor.NEGATIVE);
column.setTableCellEditor(editor);
}
}
Regards,
Padmalatha.K
Say the table data source is named "Rows".
Add a calculated context attribute "color" of type TextViewSemanticColor to node "Rows" (or an 1:1 subnode if needed).
Bind the table cell editor (TextView) property "semanticColor" to attribute "color".
Implement calculated attribute as
WDTextViewSemanticColor getRowsColor(..., IRowsElement element)
{
return element.getSign() == -1 : WDTextViewSemanticColor.NEGATIVE : WDTextViewSemanticColor.STANDARD;
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanq for the reply but i cannot create a context attribute in the node which is bound as the data source to the table as im directly binding the model node to the data source of the table.
Is there any other way of doing it?
Please suggest as im unable to proceed further.
Regards,
Padmalatha.K
Hi Ayyaparaj,
Thanq for the reply.
I created a node with cardinality 1:1 and in the node i created an attribute of the type "TextViewSemanticColor" and set the "Calculated" property of this attribute as true.
But in the getter method, when i try to add the code
return element.getSign() == -1 ? WDTextViewSemanticColor.NEGATIVE : WDTextViewSemanticColor.STANDARD; } (Fixed typo with ternary operator )
Im not getting the method "element.getSign()"
And where do i need to call this method?
Please suggest.
Regards,
Padmalatha.K
Context
>> Bapi - (Node)
>>OutputNode - (Node)
>>DesignData - (Node)
>>ColorData - (Attribute).
In the above context structure, Output node is the table data source. In this node i created a node "DesignData" of cardinality 1: 1 and in this node i created an attribute "ColoData" of type TextViewSemanticColor and set the calculated property as true.
Regards,
Padmalatha.K
Hi,
Is it mandatory to use only this line of code in the get method?
return element.getSign() == -1 ? WDTextViewSemanticColor.NEGATIVE : WDTextViewSemanticColor.STANDARD; }
Can i not use my own code?
If i can use my own code in the get method, please tell me where and how to call this get method?
Regards,
Padmalatha.K
Edited by: padmalatha kontham on May 20, 2008 10:47 AM
Hi,
Is it necessary to write only this line of code in the get method?
No.
Can i not write my own code in the get method?
Yes
If i can write, how do i call this method and where do i call this method?
It will be called by the framework if its bound to a UI element
or if you want to call explicitly call using element.get<AttributeName>()
Regards
Ayyapparaj
Hi,
From your post i can understand that you want to display negative value in red color throughout the table. For this you can use CellVariants. Create two cellvariants and add one textview to each. Give one text view the semantic color for red and for another give the normal one (for black).
In runtime you can choose the cellvariant for a column according to the value for display purpose.
Hope it helps.
thanks & regards,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.