OSDN Git Service

srcディレクトリとdocディレクトリを作成
[xdf/git-repos.git] / src / xdf-swing / src / main / java / jp / ac / aiit / xdf / component / swing / mappers / TabpanelMapper.java
1 package jp.ac.aiit.xdf.component.swing.mappers;
2
3 import java.awt.FlowLayout;
4 import java.util.Map;
5
6 import javax.swing.Icon;
7 import javax.swing.ImageIcon;
8
9 import jp.ac.aiit.xdf.component.swing.Tabpanel;
10 import jp.ac.aiit.xdf.component.swing.attribute.AttributeProcessingUnit;
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.SwingEventHandler;
16 import jp.ac.aiit.xdf.core.action.EventHandler;
17 import jp.ac.aiit.xdf.core.typeconvert.StringConverter;
18
19 /**
20  * &lttab />のComponentMaper。&ltgroup>のもの(JPanelMapper)を基本とする。
21  * @author kodama
22  */
23 public class TabpanelMapper extends JPanelMapper {
24
25         @Override
26         protected Map<String, AttributeProcessingUnit> initProcessingUnits() {
27                 Map<String, AttributeProcessingUnit> result = super.initProcessingUnits();
28                 result.put("title", new AttributeProcessingUnit(new SetterAttributeProcessor("setName", false), new GetterAttributeProcessor("getName"), new StringConverter()));
29                 result.put("img", new AttributeProcessingUnit(new IconProcessor(), new ObjectModelAttributeGetProcessor(model), new StringConverter()));
30                 result.put("access", new AttributeProcessingUnit(new SetterAttributeProcessor("setAccessKey", false), new GetterAttributeProcessor("getAccessKey"), new StringConverter()));
31                 
32                 return result;
33         }
34
35         @SuppressWarnings("serial")
36         @Override
37         protected Object newComponent() {
38                 Tabpanel tabpanel = new Tabpanel(){
39                         @SuppressWarnings("unused")
40                         public void setIcon(ImageIcon icon){setIcon((Icon)icon);}
41                 };
42                 tabpanel.setLayout(new FlowLayout());
43
44                 return tabpanel;
45         }
46
47         @Override
48         protected Map<String, EventHandler> intiProcessingAction() {
49                 Map<String, EventHandler> action = SwingEventHandler.commonEvent();
50                 return action;
51         }
52 }