on 09-19-2006 5:12 PM
Hi,
I have created an roadmap project. The navigation is working. except when i need to skipp a stip.
When i for instance pus a back putton the roadmap shows me that i am at step 2 instead of step 1`
The code i am using in te viewcontroller for the back button:
wdThis.wdGetOm_Webforms_CustController().visibleSelectionContainer();
wdThis.wdGetOm_Webforms_CustController().InvisibleRequestDetailsContainer();
wdThis.wdGetOm_Webforms_CustController().PreviousStep();
code in the custom controller:
String attrName = null;
boolean found = false;
//copy iterator into list to get list iterator
Iterator it = wdContext.nodeRoadMapSteps().getNodeInfo().iterateAttributes();
List steps = new ArrayList();
while (it.hasNext()) {
steps.add(it.next());
}
ListIterator lit = steps.listIterator();
// find current element and deselect it
while (lit.hasNext() && !found) {
//get attribute name
IWDAttributeInfo info = (IWDAttributeInfo) lit.next();
attrName = info.getName();
if (WDRoadMapStepDesign.SELECTED.equals(wdContext.currentRoadMapStepsElement().getAttributeValue(attrName))){
//selected element found
wdContext.currentRoadMapStepsElement().setAttributeValue(attrName, WDRoadMapStepDesign.STANDARD);
found = true;
}
}
found = false;
lit.previous(); // correction
// one step backwards, but skip disabled steps
while(lit.hasPrevious() && !found) {
//get attribute name
IWDAttributeInfo info = (IWDAttributeInfo) lit.previous();
attrName = info.getName();
if (!WDRoadMapStepDesign.DISABLED.equals(wdContext.currentRoadMapStepsElement().getAttributeValue(attrName))) {
// element is not disabled => select it
wdContext.currentRoadMapStepsElement().setAttributeValue(attrName, WDRoadMapStepDesign.SELECTED);
found = true;
}
}
what kind of methods did you make?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I get a nulpointer exception when i am going to te next step
code i used for next step
int currentIndex = wdContext.currentRoadMapElement().getSelectedStepIndex();
if (currentIndex < 2) {
wdContext.currentRoadMapElement().setSelectedStepIndex(
currentIndex + 1);
erroro message
java.lang.NullPointerException
at com.shell.teamflow.wd.omwebforms.Om_Webforms_Cust.NextStep(Om_Webforms_Cust.java:284)
at com.shell.teamflow.wd.omwebforms.wdp.InternalOm_Webforms_Cust.NextStep(InternalOm_Webforms_Cust.java:205)
at com.shell.teamflow.wd.omwebforms.RequestType_View.onActionCreatePosition(RequestType_View.java:227)
at com.shell.teamflow.wd.omwebforms.wdp.InternalRequestType_View.wdInvokeEventHandler(InternalRequestType_View.java:215)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:101)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:304)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:649)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:248)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:160)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
code in there is following
// create new steps node element
IRoadMapStepsElement steps = wdContext.nodeRoadMapSteps().createRoadMapStepsElement();
// iterate through node attributes and initialize them
IWDNodeInfo nodeInfo = wdContext.nodeRoadMapSteps().getNodeInfo();
Iterator it = nodeInfo.iterateAttributes();
boolean first = true;
while (it.hasNext()) {
//get attribute name
IWDAttributeInfo info = (IWDAttributeInfo) it.next();
String attrName = info.getName();
// initialize context value
if (first) {
// first step in RoadMap => set to SELECTED
steps.setAttributeValue(attrName, WDRoadMapStepDesign.SELECTED);
first = false;
} else {
// all other steps set to STANDARD
steps.setAttributeValue(attrName, WDRoadMapStepDesign.STANDARD);
}
}
wdContext.nodeRoadMapSteps().bind(steps);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your code looks strange to me. You are working with context metadata instead of context data. Why?
To control the selection of a RoadMap, you simply have to provide a context attribute that stores the ID of the currently selected step.
Say you have 3 steps with IDs "step0", "step1", "step2".
Create context attribute "SelectedStep" of type "string" and bind property RoadMap.<b>selectedStep </b>to that attribute.
If you want to do "step arithmetic", you could create a context attribute "SelectedStepIndex" of type "integer" and make "SelectedStep" a calculated attribute with
String getSelectedStep(IWDNodeElement element)
{
return "step" + wdContext.currentContextElement().getSelectedStepIndex();
}
Then you can navigate through the steps by the following operations:
- Goto step "step<i>":
wdContext.currentContextElement().setSelectedStepIndex(i)
- Goto next step:
int currentIndex = wdContext.currentContextElement().getSelectedStepIndex();
if (currentIndex < 2)
{
wdContext.currentContextElement().setSelectedStepIndex(currentIndex + 1);
}
- Goto previous step:
int currentIndex = wdContext.currentContextElement().getSelectedStepIndex();
if (currentIndex > 0)
{
wdContext.currentContextElement().setSelectedStepIndex(currentIndex - 1);
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Armin,
I am pretty new at building roadmaps. I used also the code of Eoan. This code was working so that's why i used it. Do I understand it good that the best is to replace my code for the code you gave me?
where should i Implement this:
String getSelectedStep(IWDNodeElement element)
{
return "step" + wdContext.currentContextElement().getSelectedStepIndex();
}
Then you can navigate through the steps by the following operations:
- Goto step "step<i>":
wdContext.currentContextElement().setSelectedStepIndex(i)
Hi Cronan,
The first while loop in your code is used to get the selected step.
when the if condition true (inside while) , it finds the current selected element, then you should break the loop to stop the iteration.
insert a break; statement in your while loop as follows,
// find current element and deselect it
while (lit.hasNext() && !found) {
//get attribute name
IWDAttributeInfo info = (IWDAttributeInfo) lit.next();
attrName = info.getName();
if (WDRoadMapStepDesign.SELECTED.equals(wdContext.currentRoadMapStepsElement().getAttributeValue(attrName))){
//selected element found
wdContext.currentRoadMapStepsElement().setAttributeValue(attrName, WDRoadMapStepDesign.STANDARD);
found = true;
<b>break;</b>
}
}
hope this will help you.
java.lang.ClassCastException
at com.shell.teamflow.wd.omwebforms.wdp.IPublicOm_Webforms_Cust$IRoadMapStepsElement.wdSetObject(IPublicOm_Webforms_Cust.java:677)
at com.sap.tc.webdynpro.progmodel.context.NodeElement.setAttributeValue(NodeElement.java:876)
at com.shell.teamflow.wd.omwebforms.Om_Webforms_Cust.wdDoInit(Om_Webforms_Cust.java:131)
at com.shell.teamflow.wd.omwebforms.wdp.InternalOm_Webforms_Cust.wdDoInit(InternalOm_Webforms_Cust.java:148)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingCustomController.doInit(DelegatingCustomController.java:73)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.progmodel.controller.Component.getCustomControllerInternal(Component.java:436)
at com.sap.tc.webdynpro.progmodel.controller.Component.getMappableContext(Component.java:374)
at com.sap.tc.webdynpro.progmodel.controller.Component.getMappableContext(Component.java:403)
at com.sap.tc.webdynpro.progmodel.context.MappedAttributeInfo.initAttributeMapping(MappedAttributeInfo.java:304)
at com.sap.tc.webdynpro.progmodel.context.MappedAttributeInfo.init(MappedAttributeInfo.java:263)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.initAttributes(NodeInfo.java:669)
at com.sap.tc.webdynpro.progmodel.context.DataNodeInfo.doInit(DataNodeInfo.java:233)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:654)
at com.sap.tc.webdynpro.progmodel.context.Context.init(Context.java:40)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:199)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:540)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:422)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:130)
at com.sap.tc.webdynpro.progmodel.view.InterfaceView.initController(InterfaceView.java:41)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.displayToplevelComponent(ClientComponent.java:135)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:392)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:608)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:248)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:160)
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
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.