/** this is the main method that generates the tag's HTML output */ public String getHTMLStringInternal(Tag parent, PageContext pageContext, View view) throws JspException { // make sure all the parameters are valid String msg = null; if (parent == null) { msg = "Tag parameter is null"; CCDebug.trace1(msg); throw new IllegalArgumentException(msg); } else if (pageContext == null) { msg = "PageContext parameter is null"; CCDebug.trace1(msg); throw new IllegalArgumentException(msg); } else if (view == null) { msg = "View parameter is null"; CCDebug.trace1(msg); throw new IllegalArgumentException(msg); } // verify is that the view passed is of the right type checkChildType(view, CCWizardWindow.class); theView = (CCWizardWindow) view; theModel = (CCWizardWindowModelInterface) theView.getModel(); // init tag setParent(parent); setPageContext(pageContext); setAttributes(); // holds the response string StringBuffer buffer = new StringBuffer(); // check for the client-side javascript method to be called to set // the client-side parameters. - default to 'getClientParams()' String jsMethod = (String) theModel.getValue(CLIENTSIDE_PARAM_JSFUNCTION); if (jsMethod == null) jsMethod = "getClientParams"; // retrieve the various parts of the 'window.open(...)' call String url = getWizardURL(); String defaultParameters = getDefaultWizardParameters(); String windowGeometry = getWindowGeometry(); String windowName = (new StringBuffer(WINDOW_NAME)).append("_").append(HtmlUtil.getUniqueValue()).toString(); // Set the Onclick attribute StringBuffer onClick = new StringBuffer(); onClick .append("javascript: var url='") .append(url) .append("'; var defaultParams='") .append(defaultParameters) .append("'; var geometry='") .append(windowGeometry) .append("'; var windowName='") .append(windowName) .append("'; alert('windowName: ' + windowName); var csParams=") .append(jsMethod) .append("(); alert('csParams: ' + csParams); ") .append("var fullURL = url; if (csParams != null) {") .append(" fullURL += csParams + '&';}") .append(" fullURL += defaultParams;") .append(" alert('hi2'); ") .append("var win = window.open(fullURL, windowName, geometry);") .append("win.focus();alert('hi3'); return true;"); // launchWizard(url, defaultParams,") // .append(" csParams, windowName, geometry);") setOnClick(onClick.toString()); // the tags payload buffer .append("\n<!-- Start Wizard Tag -->\n") .append(super.getHTMLStringInternal(parent, pageContext, theView)) .append("\n<!-- End Wizard Tag -->\n"); return buffer.toString(); }
/** constructor */ public WizardWindowTag_alerts() { super(); CCDebug.initTrace(); }