1 package jp.ac.aiit.xdf.component.swing.mappers;
5 import javax.swing.JTabbedPane;
7 import jp.ac.aiit.xdf.component.swing.Tabpanel;
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.core.action.EventHandler;
13 import jp.ac.aiit.xdf.core.model.ObjectModel;
14 import jp.ac.aiit.xdf.core.typeconvert.TypeConverter;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 * tabgroupをSwingのJTabbedPaneとしてマッピングするクラス
23 public class JTabbedPaneMapper extends SwingComponentMapperTemplate {
25 private static final Logger log
26 = LoggerFactory.getLogger(SwingComponentMapperTemplate.class);
29 protected Map<String, AttributeProcessingUnit> initProcessingUnits() {
30 Map<String, AttributeProcessingUnit> result = CommonAttributeStore.commonAttributes(model);
31 result.put("tabplace", new AttributeProcessingUnit(new SetterAttributeProcessor("setTabPlacement", true), new GetterAttributeProcessor("getTabPlacement"), new TabplaceValueConverter()));
37 protected Object newComponent() {
38 return new JTabbedPane();
42 protected void processingChildComponents() {
43 for(ObjectModel child : model.children()){
47 Tabpanel tab = (Tabpanel)child.getComponent();
48 tab.setContainer((JTabbedPane)this.component);
49 } catch(ClassCastException e){
50 log.warn("タブ区画の中にタブでないコンポネントが指定されている");
56 private static class TabplaceValueConverter implements TypeConverter<Integer>{
58 public Integer apply(String target) {
59 if( target == null ) {
60 return JTabbedPane.TOP;
62 String lowered = target.toLowerCase();
63 if( lowered.equals("top") ) {
64 return JTabbedPane.TOP;
65 } else if( lowered.equals("bottom") ) {
66 return JTabbedPane.BOTTOM;
67 } else if( lowered.equals("left") ) {
68 return JTabbedPane.LEFT;
69 } else if( lowered.equals("right") ) {
70 return JTabbedPane.RIGHT;
72 return JTabbedPane.TOP;
78 public boolean isAppliable(String target) {
84 protected Map<String, EventHandler> intiProcessingAction() {