| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
package org.apache.tapestry5.internal; |
| 16 | |
|
| 17 | |
import org.apache.tapestry5.OptionGroupModel; |
| 18 | |
import org.apache.tapestry5.OptionModel; |
| 19 | |
|
| 20 | |
import java.util.List; |
| 21 | |
import java.util.Map; |
| 22 | |
|
| 23 | |
public final class OptionGroupModelImpl implements OptionGroupModel |
| 24 | |
{ |
| 25 | |
private final String label; |
| 26 | |
|
| 27 | |
private final boolean disabled; |
| 28 | |
|
| 29 | |
private final List<OptionModel> options; |
| 30 | |
|
| 31 | |
private final Map<String, String> attributes; |
| 32 | |
|
| 33 | |
public OptionGroupModelImpl(String label, boolean disabled, List<OptionModel> options, |
| 34 | |
String... attributeKeysAndValues) |
| 35 | |
{ |
| 36 | 10 | this(label, disabled, options, attributeKeysAndValues.length == 0 ? null : TapestryInternalUtils |
| 37 | |
.mapFromKeysAndValues(attributeKeysAndValues)); |
| 38 | 10 | } |
| 39 | |
|
| 40 | |
public OptionGroupModelImpl(String label, boolean disabled, List<OptionModel> options, |
| 41 | |
Map<String, String> attributes) |
| 42 | 14 | { |
| 43 | 14 | this.label = label; |
| 44 | 14 | this.disabled = disabled; |
| 45 | 14 | this.options = options; |
| 46 | 14 | this.attributes = attributes; |
| 47 | 14 | } |
| 48 | |
|
| 49 | |
public Map<String, String> getAttributes() |
| 50 | |
{ |
| 51 | 14 | return attributes; |
| 52 | |
} |
| 53 | |
|
| 54 | |
public String getLabel() |
| 55 | |
{ |
| 56 | 8 | return label; |
| 57 | |
} |
| 58 | |
|
| 59 | |
public List<OptionModel> getOptions() |
| 60 | |
{ |
| 61 | 10 | return options; |
| 62 | |
} |
| 63 | |
|
| 64 | |
public boolean isDisabled() |
| 65 | |
{ |
| 66 | 10 | return disabled; |
| 67 | |
} |
| 68 | |
|
| 69 | |
@Override |
| 70 | |
public String toString() |
| 71 | |
{ |
| 72 | 2 | return String.format("OptionGroupModel[%s]", label); |
| 73 | |
} |
| 74 | |
|
| 75 | |
} |