| 1 | |
package org.jtheque.core.spring.extension; |
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
import org.jtheque.core.managers.view.impl.actions.utils.CloseViewAction; |
| 20 | |
import org.jtheque.core.managers.view.impl.actions.utils.DisplayViewAction; |
| 21 | |
import org.springframework.beans.factory.support.BeanDefinitionBuilder; |
| 22 | |
import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser; |
| 23 | |
import org.springframework.beans.factory.xml.ParserContext; |
| 24 | |
import org.w3c.dom.Element; |
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
public final class JThequeActionBeanDefinitionParser extends AbstractSimpleBeanDefinitionParser { |
| 32 | |
private final String action; |
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
public JThequeActionBeanDefinitionParser(String action) { |
| 40 | 0 | super(); |
| 41 | |
|
| 42 | 0 | this.action = action; |
| 43 | 0 | } |
| 44 | |
|
| 45 | |
@Override |
| 46 | |
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { |
| 47 | 0 | builder.addConstructorArgValue(element.getAttribute("key")); |
| 48 | 0 | builder.addPropertyReference("view", element.getAttribute("view")); |
| 49 | 0 | } |
| 50 | |
|
| 51 | |
@Override |
| 52 | |
protected Class<?> getBeanClass(Element element) { |
| 53 | 0 | return "close".equals(action) ? CloseViewAction.class : DisplayViewAction.class; |
| 54 | |
} |
| 55 | |
} |