1 package jp.ac.aiit.xdf.component.swing.mappers;
3 import java.awt.event.WindowAdapter;
4 import java.awt.event.WindowEvent;
7 import javax.swing.JFrame;
8 import javax.swing.JMenuBar;
10 import jp.ac.aiit.xdf.application.Application;
11 import jp.ac.aiit.xdf.component.swing.attribute.AttributeProcessingUnit;
12 import jp.ac.aiit.xdf.component.swing.attribute.CommonAttributeStore;
13 import jp.ac.aiit.xdf.component.swing.attribute.GetterAttributeProcessor;
14 import jp.ac.aiit.xdf.component.swing.attribute.SetterAttributeProcessor;
15 import jp.ac.aiit.xdf.core.action.EventHandler;
16 import jp.ac.aiit.xdf.core.typeconvert.StringConverter;
19 * frameタグをSwingのJFrameにマッピングする
21 * @author Shunichi Takagi
23 public class JFrameMapper extends SwingLayoutingComponentMapperTemplate {
26 protected Map<String, AttributeProcessingUnit> initProcessingUnits() {
27 Map<String, AttributeProcessingUnit> result = CommonAttributeStore.commonAttributes(model);
28 result.put("title", new AttributeProcessingUnit(new SetterAttributeProcessor("setTitle", false), new GetterAttributeProcessor("getTitle"), new StringConverter()));
34 protected Object newComponent() {
35 JFrame frame = new JFrame();
36 frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
38 frame.addWindowListener(new WindowAdapter() {
39 @Override public void windowClosing(WindowEvent e) {
40 Application.getInstance().close( (String) model.rootModel().attr("windowName") );
45 if (model.hasAttr("menubar")){
46 JMenuBar menubar = (JMenuBar)model.attr("menubar");
47 frame.setJMenuBar(menubar);
54 protected Map<String, EventHandler> intiProcessingAction() {
55 // TODO Auto-generated method stub