1 package jp.ac.aiit.xdf.component.swing.mappers;
5 import javax.swing.JTextField;
6 import javax.swing.border.Border;
8 import jp.ac.aiit.xdf.component.swing.attribute.AttributeProcessingUnit;
9 import jp.ac.aiit.xdf.component.swing.attribute.CommonAttributeStore;
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.StringConverter;
21 * textfieldタグをSwingのJTextFieldとしてマッピングするクラス
23 * @author Shunichi Takagi
25 public class JTextFieldMapper extends SwingComponentMapperTemplate {
28 protected Map<String, AttributeProcessingUnit> initProcessingUnits() {
29 Map<String, AttributeProcessingUnit> result = CommonAttributeStore.commonAttributes(model);
30 result.put("value", new AttributeProcessingUnit(new SetterAttributeProcessor("setText", false), new GetterAttributeProcessor("getText"), new StringConverter()));
31 result.put("border", new AttributeProcessingUnit(new SetterAttributeProcessor("setBorder", Border.class), new GetterAttributeProcessor("getBorder"), new BorderConverter()));
32 result.put("editable", new AttributeProcessingUnit(new SetterAttributeProcessor("setEditable", true), new GetterAttributeProcessor("isEditable"), new BooleanConverter()));
38 protected Object newComponent() {
39 return new JTextField();
43 protected void processingChildComponents() { }
46 protected Map<String, EventHandler> intiProcessingAction() {
47 Map<String, EventHandler> action = SwingEventHandler.commonEvent();
48 action.put("edit", new KeyEventHandler(SwingEventType.EDIT));
49 action.put("press-enter", new KeyEventHandler(SwingEventType.PRESSENTER));