on 07-07-2005 4:41 AM
Hello Experts,
We have a requirement to highlight some of the fields in a view if its value are above or below the normal value range. Say if the no of passengers in flight is 500 and aircraft type is A320, we need to highlight the Inputfield/TextView.
Please note this is not an error. The user should still be able to continue with his work, like saving this data. Its only to bring this to his notice. Also I am taking about highlighting multiple fields and not just one of the fields.
Is this possible.
Any inputs will be valuable.
Regards,
Shubham
Hi Subham,
You want to highlight the input field based on some values .You can use the context specific methods of message manager .The IWDMessageManager allows you to link the errors to a specific node attribute so that if you want tocheck the setting of certain values to the attribute you can use this method
public void reportInvalidContextAttributeException(
IWDNodeElement element,
String attributeName,
String message
boolean cancelNavigation);
.
here is the sample code.
Suppose you want to highlight the input field which is bound to the attribute ABC of node XYZ
wdContext.currentContextElement().setAtt1("a");
IWDNodeElement element = wdContext.nodeXyz().currentXyzElement();
IWDAttributeInfo attributeInfo = element.node().getNodeInfo().getAttribute("ABC");
IWDMessageManager messmgr = wdComponentAPI.getMessageManager();
String message = "hello............";
if(condition)
{
messmgr.reportInvalidContextAttributeException(element,attributeInfo,message,false);
}
In this case the message will be displayed along with the highlighted field
For changing the color of text view is easy .You have to change the value of context attribute attached to the design property of text view like netweaver expert has said
Hope this helps you
Dont forget to give points if this helps
Regards
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In MessagePool of component create messages of type warning.
In some action handler use the following code:
if ( wdContext.currentAirplanesElement().getPassengersRegistered() > 500 )
{
wdComponentAPI.getMessageManager()
.reportContextAttributeMessage
(
wdContext.currentAirplanesElement(),
wdContext.currentAirplanesElement()
.node().getNodeInfo().getAttribute("PassengersRegistered") ,
IMessage<YourComponent>.PASSENGERS_LIMIT_EXCEED,
null, /* If no parameters */
false
);
}
You may place as many checks / messages as you wish
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi VS,
Thanks for the reply. Actually I dont want to show any message to the user. Its just to catch his attention. I have 150 UI Elements on a screen. If we give messages, there can be 20-30 messages in a screen depending on these warnings. Is there anyway I can highlight without displaying a message.
Regards,
Shubham
Not sure thi works but anyway:
1. Place a MessageArea UI control on view (at bottom)
2. Set it visibility to BLANK (pay attention: BLANK, not NONE)
3. Use code I provided.
This way you will (probably have messages posted & applied to controls but not collected at bottom of screen. Also you may place message area in scrollable container and set height of container to 1px (this saves screen space)
VS
Hello,
the framework is probably too smart to be fooled by changing the visibility. The ScrollContainer with zero height trick might do, BUT: then you will not see any messages anymore! DO NOT DO THIS! And please, don't recommend it to others. It just gets them into trouble when their users don't see the error messages anymore.
Best regards,
Thomas
hello Shubham,
U can change the colour of a TextView by setting its semantic color property to critical or negative (other than standard).
take the text view object in wdModify() and set the semantic color to the decired value.
Regards,
Piyush.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.