on 02-09-2009 11:26 AM
Hi all,
I have a text view in my layout with the ID "TextView1".
I need to change some properties of this element by coding.
How can i get this element in my editor..?
IWDTextView tv = -
???????????
tv.bindText("Test Data")
tv.setSemanticColor(WDTextViewSemanticColor.NEGATIVE);
tv.setVisible(WDVisibility.VISIBLE);
How can i get my element in editor. Please help.
Thanks in advance,
Jithin
Hi,
Only solution is
create attributes say
TextViewData of type String
TextViewSemanticColor of type com.sap.ide.webdynpro.uielementdefinitions.TextViewSemanticColor
TextViewVisibilty of type com.sap.ide.webdynpro.uielementdefinitions.Visibility
Assign all these properties to TextView
During an Action set these properties....
Regards
Akshaya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
For your requirement the best approach would be to create a context attribute , which is similar to the one where you need to change the property at runtime.
bind this attribute to the UI element property.
Assign the default value in wdDoinit
As you mentioned when the action is fired change the value accordingly.
Hope its clear.
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
solved
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you have to define a reference to TextView. Do this in "others":
//@@begin others
IWDTextView textView;
//@@end
you have to initialize this reference in wdDoModifyView:
if(firstTime){
textView = (IWDTextView) view.getElement("TextView1");
}
use this reference in actions or methods defined in view controller by calling its methods.
textView.setText("hello war");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, don't do that (and especially don't create a static reference).
Either
- bind the properties to context attributes and change the value of the context attribute, or
- set a flag (boolean context attribute) in the action handler, check and reset the flag inside wdDoModifyView() and access the UI element in wdDoModifyView() as described above
Armin
Dear all,
IWDTextView textview = (IWDTextView)view.getElement(IWDTextView.class , "textview");
This code which u guys have mentioed can only be used in DomodifyView.
i need my code to be written un an action.If i am correct, i need to create an object of my view here.can u please help me with that as i dont know how create an object of the view.
I need an object of my view only then i can write view.getElement(IWDTextView.class , "textview");
IWDView view = -
??????
thanks,
Jithin
Hi Jithin,
FYI..
You are not allowed to do any modifications to the view-layout anywhere other than the wdDoModifyView(). You can find the alias to your view only in the wdDoModifyView() and not anywhere else.
And, you will not be able to create an alias to the view, i.e,
IWDView view =..---???? is not possible!
Regards
Kishan
Hi Jithin,
Why don't you change the properties of your TextView in the wdDoModifyView() dynamically?
I don't understand why you aren't doing what I mentioned. wdDoModifyView() will be called everytime the view is modified. i.e, it would be called even when an action is performed.
Can you elaborate on your requirement?
Regards
Kishan
Hi
to get text view:
IWDTextView textview = (IWDTextView)view.getElement(IWDTextView.class , "textview");
and say you want to set the visibility then take a boolean type attribute bind it with the visibility property of text view. And manipulate this attribute at runtime.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try this in view controller:
//@@begin others
IWDTextView textView;
//@@end
in wdDoModifyView type this:
if(firstTime){
textView = (IWDTextView) view.getElement("TextView1");
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
As you said you need to change the properties in action then you need to have IWDview object to access that UI element. I am not sure if that'll work.
You can bind the property to an attribute and manipulate its value in action method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
try this
IWDTransparentContainer rootContainer = (IWDTransparentContainer)view.getElement("RootUIElementContainer");
//create the text view
IWDTextView textview = (IWDTextView)view.createElement(IWDTextView.class , "textview");
textview.bindText("somethingText");
textview.setWrapping(true);
//Add textview to the root container
rootContainer.addChild(textview);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jithin,
Try like this:
IWDTextView tv = (IWDTextView ) view.getElement("TextView1");
you can set properties dynamically to your textview element like
tv.setXXX(xxx);
Regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi jithin,
Create a Action say "Create" bound to the UI Element with an Parameter say "view" of type "com.sap.tc.webdynpro.progmodel.api.IWDView" and do the parameter mapping.right click on UI (in the outline view)Element -- > parameter Mapping..
using this view parameter , u will be able to create elements and get the elements .
Thanks and Regards
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.