1 26 package org.objectweb.util.explorer.parser.lib; 27 28 import java.util.Iterator ; 29 import java.util.List ; 30 31 import org.objectweb.util.explorer.core.common.api.ExplorerConstants; 32 import org.objectweb.util.explorer.core.panel.api.CompositePanelDescription; 33 import org.objectweb.util.explorer.core.panel.api.PanelDescription; 34 import org.objectweb.util.explorer.core.panel.api.TableDescription; 35 import org.objectweb.util.explorer.core.panel.lib.BasicCompositePanelDescription; 36 import org.objectweb.util.explorer.core.panel.lib.BasicPanelDescription; 37 import org.objectweb.util.explorer.core.panel.lib.BasicTableDescription; 38 import org.objectweb.util.explorer.explorerConfig.Node; 39 import org.objectweb.util.explorer.explorerConfig.Panel; 40 import org.objectweb.util.explorer.explorerConfig.Table; 41 import org.objectweb.util.explorer.explorerConfig.beans.PanelBean; 42 43 51 public class PanelManager 52 extends AbstractNodeParser 53 { 54 55 61 67 73 protected PanelDescription getPanelDescription(Table table){ 74 TableDescription tableDescription = null; 75 if(table!=null && table.getCode()!=null){ 76 tableDescription = new BasicTableDescription(); 77 tableDescription.setCodeDescription(ParserUtils.getCodeDescription(table.getCode())); 78 } 79 return tableDescription; 80 } 81 82 protected PanelDescription getPanelDescription(Panel panel){ 83 PanelDescription panelDesc = null; 84 if(panel!=null){ 85 if(panel.getCode()!=null){ 86 panelDesc = new BasicPanelDescription(); 87 panelDesc.setCodeDescription(ParserUtils.getCodeDescription(panel.getCode())); 88 } else { 89 panelDesc = new BasicCompositePanelDescription(); 90 CompositePanelDescription compositePanel = (CompositePanelDescription)panelDesc; 91 List subPanels = ((PanelBean)panel).getChildrenList(); 92 Iterator it = subPanels.iterator(); 93 while (it.hasNext()) { 94 Object element = it.next(); 95 if(Panel.class.isAssignableFrom(element.getClass())){ 96 compositePanel.addPanelDescription(getPanelDescription((Panel)element)); 97 } else if (Table.class.isAssignableFrom(element.getClass())){ 98 compositePanel.addPanelDescription(getPanelDescription((Table)element)); 99 } 100 } 101 } 102 panelDesc.setInheritTypePanel(panel.getInheritTypePanel().equals("false")?false:true); 103 } 104 return panelDesc; 105 } 106 107 113 116 public void parseNode(Object key, Node node) { 117 PanelDescription panelDesc = getPanelDescription(node.getPanel()); 118 if(panelDesc!=null && !panelDesc.isEmpty()){ 119 getFeeder().feed(ExplorerConstants.PANEL_PROPERTY, key, panelDesc); 120 } 121 } 122 123 } 124 125 126 | Popular Tags |