1 26 27 package org.objectweb.util.browser.core.panel; 28 29 import org.objectweb.util.browser.api.Panel; 30 import org.objectweb.util.browser.api.Table; 31 import org.objectweb.util.browser.core.api.ContextProperty; 32 import org.objectweb.util.browser.core.api.TableFactory; 33 import org.objectweb.util.browser.core.common.DynamicTree; 34 35 43 public class DefaultTableFactory 44 implements TableFactory { 45 46 52 53 protected Class class_ = null; 54 55 56 protected DynamicTree tree_ = null; 57 58 64 public DefaultTableFactory(DynamicTree tree){ 65 tree_ = tree; 66 } 67 68 74 80 86 public Panel newPanel(Object object){ 87 Table table = null; 88 if (class_ != null) { 89 try { 90 table = (Table)class_.newInstance(); 91 } catch (java.lang.InstantiationException e) { 92 System.out.println(class_.getName() + " : Instanciation exception"); 93 } catch (java.lang.IllegalAccessException e) { 94 System.out.println(class_.getName() + " : Illegal access exception"); 95 } 96 } 97 if(table!=null && tree_!=null){ 98 ContextProperty cp = tree_.getContextProperty(); 99 if(cp!=null) 100 return new DefaultTablePanel(table, tree_.getAdminCustomization(), cp.getDecoder()); 101 else 102 return new DefaultTablePanel(table, tree_.getAdminCustomization()); 103 } 104 return null; 105 } 106 107 111 public void setClassName(Class theClass) { 112 class_ = theClass; 113 } 114 115 } 116 117 | Popular Tags |