OSDN Git Service

srcディレクトリとdocディレクトリを作成
[xdf/git-repos.git] / src / xdf-swing / src / main / java / jp / ac / aiit / xdf / component / swing / mappers / JTextAreaMapper.java
1 package jp.ac.aiit.xdf.component.swing.mappers;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 import javax.swing.JTextArea;
7 import javax.swing.border.Border;
8
9 import jp.ac.aiit.xdf.component.swing.attribute.AttributeProcessingUnit;
10 import jp.ac.aiit.xdf.component.swing.attribute.GetterAttributeProcessor;
11 import jp.ac.aiit.xdf.component.swing.attribute.SetterAttributeProcessor;
12 import jp.ac.aiit.xdf.component.swing.event.KeyEventHandler;
13 import jp.ac.aiit.xdf.component.swing.event.SwingEventHandler;
14 import jp.ac.aiit.xdf.component.swing.event.SwingEventType;
15 import jp.ac.aiit.xdf.component.swing.typeconvert.BorderConverter;
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.IntegerConverter;
19 import jp.ac.aiit.xdf.core.typeconvert.StringConverter;
20
21 /**
22  * textareaタグをSwingのJTextAreaとしてマッピングするクラス
23  * 
24  * @author kodama
25  */
26 public class JTextAreaMapper extends SwingComponentMapperTemplate {
27
28         @Override
29         protected Map<String, AttributeProcessingUnit> initProcessingUnits() {
30                 Map<String, AttributeProcessingUnit> result = new HashMap<String, AttributeProcessingUnit>();
31                 result.put("value", new AttributeProcessingUnit(new SetterAttributeProcessor("setText", false), new GetterAttributeProcessor("getText"), new StringConverter()));
32                 result.put("rows", new AttributeProcessingUnit(new SetterAttributeProcessor("setRows", true), new GetterAttributeProcessor("getRows"), new IntegerConverter()));
33                 result.put("columns", new AttributeProcessingUnit(new SetterAttributeProcessor("setColumns", true), new GetterAttributeProcessor("getColumns"), new IntegerConverter()));
34                 result.put("border", new AttributeProcessingUnit(new SetterAttributeProcessor("setBorder", Border.class), new GetterAttributeProcessor("getBorder"), new BorderConverter()));
35                 result.put("editable", new AttributeProcessingUnit(new SetterAttributeProcessor("setEditable", true), new GetterAttributeProcessor("isEditable"), new BooleanConverter()));
36                 
37                 return result;
38         }
39         
40         @Override
41         protected Object newComponent() {
42                 return new JTextArea();
43         }
44
45         @Override
46         protected void processingChildComponents() { }
47
48         @Override
49         protected Map<String, EventHandler> intiProcessingAction() {
50                 Map<String, EventHandler> action = SwingEventHandler.commonEvent();
51                 action.put("edit", new KeyEventHandler(SwingEventType.EDIT));
52                 return action;
53         }
54
55 }