1 package jp.ac.aiit.xdf.component.swing.mappers;
5 import javax.swing.ImageIcon;
6 import javax.swing.JMenuItem;
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.event.KeyEventHandler;
11 import jp.ac.aiit.xdf.component.swing.event.SwingEventHandler;
12 import jp.ac.aiit.xdf.component.swing.event.SwingEventType;
13 import jp.ac.aiit.xdf.core.action.EventHandler;
16 * menuitemタグをSwingのJMenuItemにマッピングする
20 public class JMenuItemMapper extends SwingComponentMapperTemplate {
23 protected Map<String, AttributeProcessingUnit> initProcessingUnits() {
24 Map<String, AttributeProcessingUnit> result = CommonAttributeStore.commonAttributes(model);
25 //result.put("access", new AttributeProcessingUnit(new ReplaceAllProcessor(), new GetValuesProcessor(), new StringValuesConverter()));
31 protected Object newComponent() {
32 JMenuItem menuitem = null;
33 if (model.hasAttr("image")){
34 menuitem = new JMenuItem(model.hasAttr("text")? (String)model.attr("text") : " ",
35 new ImageIcon(ClassLoader.getSystemResource((String)model.attr("image"))));
37 menuitem = new JMenuItem(model.hasAttr("text")? (String)model.attr("text") : " ");
44 protected void processingChildComponents() { }
47 protected Map<String, EventHandler> intiProcessingAction() {
48 Map<String, EventHandler> action = SwingEventHandler.commonEvent();
49 action.put("change", new KeyEventHandler(SwingEventType.ACTIONED));