01: /**
02: *
03: */package nl.hippo.cms.wizard.widgets;
04:
05: import nl.hippo.cms.wizard.WizardResult;
06:
07: import org.apache.avalon.framework.service.ServiceManager;
08: import org.apache.avalon.framework.service.WrapperServiceSelector;
09: import org.apache.cocoon.components.modules.input.InputModule;
10: import org.springframework.web.context.WebApplicationContext;
11:
12: /**
13: * @author a.bogaart@hippo.nl
14: *
15: */
16: public class CategoryConstantWidget extends ConstantWidget {
17:
18: public String getPath() {
19: return "";
20: }
21:
22: public void fillResult(WizardResult result,
23: WebApplicationContext context) throws Exception {
24: super .fillResult(result, context);
25:
26: ServiceManager manager = (ServiceManager) context
27: .getBean("serviceManager");
28: WrapperServiceSelector selector = (WrapperServiceSelector) manager
29: .lookup(InputModule.ROLE + "Selector");
30: InputModule model = (InputModule) selector
31: .select("locationmapmodel");
32:
33: //search for location[@src=$value]/parent::match/@pattern, using element names istead of * results in null,
34: //possibly a namespace thing
35: String xpath = "//*[@src='" + getValue()
36: + "']/parent::*/@pattern";
37: String path = (String) model.getAttribute(xpath, null, null);
38:
39: path = path.substring(path.indexOf("/"));
40: result.addPath(path);
41: }
42: }
|