on 01-22-2006 8:39 AM
Hello,
I've created a checkbox dynamically like this:
IWDCheckBox box = (IWDCheckBox) view.createElement(IWDCheckBox.class, null);
box.setText("Roy");
wdContext.getNodeInfo().addAttribute(new String("Praticipant1"),"com.sap.dictionary.boolean");
box.bindChecked(wdContext.getNodeInfo().getAttribute("Praticipant1"));
I would like, later in the code to see if this checkbox is checked. How do I get the value off the context that I've created above?
Regards,
Roy
Boolean checked = (Boolean) wdContext.currentContextElement().getAttributeValue("Praticipant1");
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, and as a matter of style, I would write
IWDAttributeInfo attrib = wdContext.getNodeInfo().addAttribute("Participant1", "ddic:com.sap.dictionary.boolean");
box.bindChecked(attrib);
instead of your original code:
wdContext.getNodeInfo().addAttribute(new String("Praticipant1"),"com.sap.dictionary.boolean");
box.bindChecked(wdContext.getNodeInfo().getAttribute("Praticipant1"));
Armin
Roy,
1. String a = "ABC" uses string from constant pool directly, String a = new String("ABC") create an object as a copy to string from constant pool. Do you need an extra object for garbage collector to play with. I guess no
2. In Armin's code you create and save reference to newly create attribute info in one step, in your example you first create it (and ignore result), then lookup it right afterwards. More instructions to execute, something that should be (easily) avoided.
3. Having ddic: prefix in this case is optional, while default is ddic:. On other hand, if you create type as Java type, prefix java: is mandatory, i.e. java:java.util.List.
Valery Silaev
EPAM Systems
Hallo,
it is good style to add the type-prefix in all cases. The Web Dynpro Runtime tries to match the retrieved type name with types of different name-spaces. To avoid naming conflicts which can possibley occur the prefix should allways be specified.
- <b>"ddic:"</b> - dictionary simple types
- <b>"java:"</b> - java native types
- <b>"external:"</b> - dictionary types in logical Adaptive RFC model dictionaries
Regards, Bertram
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.