1 package jp.ac.aiit.xdf.component.swing.mappers;
5 import javax.swing.JCheckBox;
7 import jp.ac.aiit.xdf.component.swing.attribute.AttributeProcessingUnit;
8 import jp.ac.aiit.xdf.component.swing.attribute.CommonAttributeStore;
9 import jp.ac.aiit.xdf.component.swing.attribute.DoNothingAttributeProcessor;
10 import jp.ac.aiit.xdf.component.swing.attribute.GetterAttributeProcessor;
11 import jp.ac.aiit.xdf.component.swing.attribute.ObjectModelAttributeGetProcessor;
12 import jp.ac.aiit.xdf.component.swing.attribute.SetterAttributeProcessor;
13 import jp.ac.aiit.xdf.component.swing.event.ActionEventHandler;
14 import jp.ac.aiit.xdf.component.swing.event.SwingEventHandler;
15 import jp.ac.aiit.xdf.component.swing.event.SwingEventType;
16 import jp.ac.aiit.xdf.core.action.EventHandler;
17 import jp.ac.aiit.xdf.core.typeconvert.BooleanConverter;
18 import jp.ac.aiit.xdf.core.typeconvert.StringConverter;
21 * checkboxタグをSwingのJCheckBoxにマッピングする
22 * @author Shunichi Takagi
24 public class JCheckboxMapper extends SwingComponentMapperTemplate {
28 protected Map<String, AttributeProcessingUnit> initProcessingUnits() {
29 Map<String, AttributeProcessingUnit> result = CommonAttributeStore.commonAttributes(model);
30 result.put("text", new AttributeProcessingUnit(new SetterAttributeProcessor("setText", false), new GetterAttributeProcessor("getText"), new StringConverter()));
31 result.put("value", new AttributeProcessingUnit(new DoNothingAttributeProcessor(), new ObjectModelAttributeGetProcessor(model), new StringConverter()));
32 result.put("checked", new AttributeProcessingUnit(new SetterAttributeProcessor("setSelected", true), new GetterAttributeProcessor("isSelected"), new BooleanConverter()));
38 protected Object newComponent() {
39 return new JCheckBox();
43 protected void processingChildComponents() { }
46 protected Map<String, EventHandler> intiProcessingAction() {
47 Map<String, EventHandler> action = SwingEventHandler.commonEvent();
48 action.put("check", new ActionEventHandler(SwingEventType.CHECK));
49 action.put("uncheck", new ActionEventHandler(SwingEventType.UNCHECK));