| 1 | |
package org.webslinger.rules; |
| 2 | |
|
| 3 | |
import java.io.IOException; |
| 4 | |
import javax.servlet.ServletRequest; |
| 5 | |
|
| 6 | |
import org.webslinger.Webslinger; |
| 7 | |
import org.webslinger.container.WebslingerContainer; |
| 8 | |
|
| 9 | 1606 | public class CSSSplitValue extends AbstractListValue<String> { |
| 10 | |
private AbstractSingleValue value; |
| 11 | |
private String attribute; |
| 12 | |
private String def; |
| 13 | |
|
| 14 | |
public CSSSplitValue(int id) { |
| 15 | 0 | super(id); |
| 16 | 0 | } |
| 17 | |
|
| 18 | |
public CSSSplitValue(Rules p, int id) { |
| 19 | 23 | super(p, id); |
| 20 | 23 | } |
| 21 | |
|
| 22 | |
|
| 23 | |
public Object jjtAccept(RulesVisitor visitor, Object data) { |
| 24 | 0 | return visitor.visit(this, data); |
| 25 | |
} |
| 26 | |
|
| 27 | |
public String[] getValue(ServletRequest request, Webslinger top) throws IOException { |
| 28 | 1610 | if (attribute != null) return top.getSplitAttribute(attribute, def); |
| 29 | 0 | return value.getValue(request, top).split("[, ]"); |
| 30 | |
} |
| 31 | |
|
| 32 | |
public void compile(WebslingerContainer container) throws IOException { |
| 33 | 23 | value = (AbstractSingleValue) jjtGetChild(0); |
| 34 | 23 | if (value instanceof CSSLookupValue) { |
| 35 | 23 | CSSLookupValue lookup = (CSSLookupValue) value; |
| 36 | 23 | attribute = lookup.getAttribute(); |
| 37 | 23 | def = lookup.getDefault(); |
| 38 | 23 | } else { |
| 39 | 0 | value.compile(container); |
| 40 | |
} |
| 41 | 23 | } |
| 42 | |
|
| 43 | |
public String toString() { |
| 44 | 0 | return "SplitValue()"; |
| 45 | |
} |
| 46 | |
} |