1 23 24 package com.sun.enterprise.tools.guiframework.view.descriptors; 25 26 import com.iplanet.jato.ModelManager; 27 import com.iplanet.jato.RequestManager; 28 import com.iplanet.jato.RequestContext; 29 import com.iplanet.jato.view.ContainerView; 30 import com.iplanet.jato.view.ContainerViewBase; 31 import com.iplanet.jato.view.View; 32 import com.sun.web.ui.model.CCPropertySheetModel; 33 import com.sun.web.ui.model.CCPropertySheetModelInterface; 34 import com.sun.web.ui.view.propertysheet.CCPropertySheet; 35 36 import com.sun.enterprise.tools.guiframework.exception.FrameworkException; 37 import com.sun.enterprise.tools.guiframework.view.DescriptorCCPropertySheet; 38 39 import java.io.InputStream ; 40 41 42 45 public class CCPropertySheetDescriptor extends ViewDescriptor implements FakeContainerDescriptor { 46 47 50 public CCPropertySheetDescriptor(String name) { 51 super(name); 52 } 53 54 55 public void registerChildren(ContainerViewBase instance) { 56 super.registerChildren(instance); 58 59 getModel().registerChildren(instance); 60 } 61 62 63 67 public ViewDescriptor getChildDescriptor(String name) { 68 ViewDescriptor desc = super.getChildDescriptor(name); 70 if (desc != null) { 71 return desc; 72 } 73 74 CCPropertySheetModelInterface model = getModel(); 76 if (model != null && model.isChildSupported(name)) { 77 desc = new CCPropertySheetChildDescriptor(name); 79 addChildDescriptor(desc); 86 return desc; 87 } 88 89 return null; 90 } 91 92 93 104 public CCPropertySheetModelInterface getModel() { 105 boolean fromSession = shouldGetModelFromSession(); 107 boolean toSession = shouldPutModelToSession(); 108 String instanceName = getModelInstanceName(); 109 110 ModelManager mgr = RequestManager.getRequestContext().getModelManager(); 112 CCPropertySheetModelInterface model = 113 (CCPropertySheetModelInterface)mgr.getModel( 114 CCPropertySheetModelInterface.class, 115 instanceName, fromSession, toSession); 116 117 if (model.getDocument() == null) { 119 InputStream in = getXMLFileAsStream(); 120 model.setDocument(in); 121 try { 122 in.close(); 123 } catch (java.io.IOException ex) { 124 } 126 } 127 return model; 128 } 129 130 131 137 public View getInstance(RequestContext ctx, ContainerView container, String name) { 138 return new DescriptorCCPropertySheet(ctx, container, name, this, getModel()); 139 } 140 } 141 | Popular Tags |