1 23 24 package com.sun.enterprise.tools.admingui.handlers; 25 26 import com.iplanet.jato.*; 27 import com.iplanet.jato.model.*; 28 import com.iplanet.jato.view.*; 29 import com.iplanet.jato.view.event.*; 30 import com.iplanet.jato.view.html.*; 31 32 import com.sun.web.ui.taglib.header.*; 33 import com.sun.enterprise.tools.guiframework.view.DescriptorContainerView; 34 import com.sun.enterprise.tools.guiframework.view.HandlerContext; 35 import com.sun.enterprise.tools.guiframework.view.descriptors.ViewDescriptor; 36 37 import com.sun.enterprise.tools.admingui.tree.*; 38 import com.sun.enterprise.tools.admingui.util.Util; 39 import com.sun.enterprise.tools.admingui.util.MBeanUtil; 40 41 import java.util.EventObject ; 42 import javax.management.ObjectName ; 43 44 public class MastHeadHandlers { 45 46 public String endReplaceHrefDisplay(RequestContext ctx, HandlerContext handlerCtx) { 47 ChildContentDisplayEvent ev = (ChildContentDisplayEvent)handlerCtx.getEvent(); 48 String content = ev.getContent(); 49 50 String URL = (String )handlerCtx.getInputValue("URL"); 51 if (URL == null) 52 URL = "#"; 53 content = Util.addHtmlProp(Util.removeHtmlProp(content, "href"), "href=\""+URL+"\""); 54 return content; 55 } 56 57 public String endRegistrationLinkDisplay(RequestContext ctx, HandlerContext handlerCtx) { 58 ChildContentDisplayEvent ev = (ChildContentDisplayEvent)handlerCtx.getEvent(); 59 String content = ev.getContent(); 60 61 String URL = (String )handlerCtx.getInputValue("URL"); 62 if (URL == null) 63 URL = "#"; 64 content = Util.addHtmlProp(Util.removeHtmlProp(content, "href"), 65 "href=\""+ URL +"\" target=\"_blank\""); 66 return content; 67 } 68 69 public String endQuickStartLinkDisplay(RequestContext ctx, HandlerContext handlerCtx) { 70 ChildContentDisplayEvent ev = (ChildContentDisplayEvent)handlerCtx.getEvent(); 71 String content = ev.getContent(); 72 String baseName = "com.sun.enterprise.tools.admingui.resources.Helplinks"; 73 74 String key = (String )handlerCtx.getInputValue("key"); 75 if (key == null) { 76 key = "QuickStartGuide"; 77 } 78 String fileName = Util.getMessage(baseName, key, null, ctx.getRequest().getLocale()); 79 fileName = "../quickstart/"+fileName; 81 content = Util.addHtmlProp(Util.removeHtmlProp(content, "href"), 82 "href=\""+ fileName +"\" target=\"_blank\""); 83 return content; 84 } 85 86 public String endVersionLinkDisplay(RequestContext ctx, HandlerContext handlerCtx) { 87 String openWindow; 88 ChildContentDisplayEvent ev = (ChildContentDisplayEvent)handlerCtx.getEvent(); 89 String content = ev.getContent(); 90 93 openWindow = "../admingui/Version?&productNameSrc=../images/fullname.gif&"+ 94 "versionFile=../admingui/copyright&productNameHeight=56&"+ 95 "productNameWidth=400"; 96 97 content = Util.addHtmlProp(Util.removeHtmlProp(content, "href"), "href=\""+openWindow+"\""); 98 return content; 99 } 100 101 public void versionTextDisplay(RequestContext ctx, HandlerContext handlerCtx) { 102 View bean = handlerCtx.getView(); 103 BasicDisplayField version = (BasicDisplayField)bean; 104 String versionText = ServerInstGeneralHandlers.endInstallVersionDisplay(ctx, handlerCtx); 105 version.setValue(versionText); 106 } 108 109 public String endServerNameDisplay(RequestContext ctx, HandlerContext handlerCtx) { 110 View bean = handlerCtx.getView(); 111 DescriptorContainerView view = (DescriptorContainerView)bean.getParent(); 112 return ctx.getRequest().getServerName(); 113 } 114 115 public String endDomainNameDisplay(RequestContext ctx, HandlerContext handlerCtx) { 116 String name = ""; 117 try { 118 Object domain = MBeanUtil.invoke( 119 new ObjectName ("com.sun.appserv:type=domain,category=config"), "getName", null, null); 120 name = domain.toString(); 121 } catch (Exception ex) { 122 if (Util.isLoggableINFO()) { 123 Util.logINFO("Exception thrown in getting domaim name.", ex); 124 } 125 } 126 return name; 127 } 128 129 public String endUserNameDisplay(RequestContext ctx, HandlerContext handlerCtx) { 130 View bean = handlerCtx.getView(); 131 DescriptorContainerView view = (DescriptorContainerView)bean.getParent(); 132 return ctx.getRequest().getRemoteUser(); 133 } 134 } 135 | Popular Tags |