1 package jp.ac.aiit.xdf.component.swing.mappers;
5 import javax.swing.Icon;
6 import javax.swing.ImageIcon;
7 import javax.swing.JButton;
9 import jp.ac.aiit.xdf.component.swing.attribute.AttributeProcessingUnit;
10 import jp.ac.aiit.xdf.component.swing.attribute.CommonAttributeStore;
11 import jp.ac.aiit.xdf.component.swing.attribute.GetterAttributeProcessor;
12 import jp.ac.aiit.xdf.component.swing.attribute.IconProcessor;
13 import jp.ac.aiit.xdf.component.swing.attribute.ObjectModelAttributeGetProcessor;
14 import jp.ac.aiit.xdf.component.swing.attribute.SetterAttributeProcessor;
15 import jp.ac.aiit.xdf.component.swing.event.ActionEventHandler;
16 import jp.ac.aiit.xdf.component.swing.event.SwingEventHandler;
17 import jp.ac.aiit.xdf.component.swing.event.SwingEventType;
18 import jp.ac.aiit.xdf.core.action.EventHandler;
19 import jp.ac.aiit.xdf.core.typeconvert.StringConverter;
23 * buttonタグをSwingのJButtonにマッピングするクラス
25 * @author Shunichi Takagi
27 public class JButtonMapper extends SwingComponentMapperTemplate {
30 protected Map<String, AttributeProcessingUnit> initProcessingUnits() {
31 Map<String, AttributeProcessingUnit> result = CommonAttributeStore.commonAttributes(model);
32 result.put("text", new AttributeProcessingUnit(new SetterAttributeProcessor("setText", false), new GetterAttributeProcessor("getText"), new StringConverter()));
33 result.put("img", new AttributeProcessingUnit(new IconProcessor(), new ObjectModelAttributeGetProcessor(model), new StringConverter()));
39 protected Map<String, EventHandler> intiProcessingAction() {
40 Map<String, EventHandler> action = SwingEventHandler.commonEvent();
41 action.put("click", new ActionEventHandler(SwingEventType.CLICK));
45 @SuppressWarnings("serial")
47 protected Object newComponent() {
49 @SuppressWarnings("unused")
50 public void setIcon(ImageIcon defaultIcon){setIcon((Icon)defaultIcon);}
55 protected void processingChildComponents() { }