Display the result in html table format.
@param out The http output stream.
@param reg The resource bundle
@exception DBException File exception.
169632
public void printScreen(PrintWriter out, ResourceBundle reg)
        throws DBException
    {
        this.getScreenFieldView().printScreen(out, reg);    
    }
107432
private void formatResultSet(ResultSet r) {

        if (r == null) {
            String[] g = new String[1];

            g[0] = "Result";

            gResult.setHead(g);

            g[0] = "(empty)";

            gResult.addRow(g);

            return;
        }

        try {
            ResultSetMetaData m         = r.getMetaData();
            int               col       = m.getColumnCount();
            Object[]          h         = new Object[col];
            boolean[]         isVarChar = new boolean[col];

            for (int i = 1; i <= col; i++) {
                h[i - 1] = m.getColumnLabel(i);
                isVarChar[i - 1] = (m.getColumnType(i)
                                    == java.sql.Types.VARCHAR);
            }

            gResult.setHead(h);

            while (r.next()) {
                for (int i = 1; i <= col; i++) {
                    try {
                        h[i - 1] = r.getObject(i);

                        if (r.wasNull()) {
                            h[i - 1] = (isVarChar[i - 1] ? NULL_STR
                                                         : null);
                        }
                    } catch (SQLException e) {}
                }

                gResult.addRow(h);
            }

            r.close();
        } catch (SQLException e) {

            //  Added: (weconsultants@users)
            CommonSwing.errorMessage(e);
        }
    }
96196
public void printStartRecordGridData(PrintWriter out, int iPrintOptions)
    {
        out.println(Utility.startTag(XMLTags.DETAIL));
        out.println(Utility.startTag(XMLTags.FILE));
    }
1236498
public static void writeTag(DataOutput out, Tag tag) throws IOException {
        out.writeByte(TagRegistry.getIdFor(tag.getClass()));
        out.writeUTF(tag.getName());
        tag.write(out);
    }
209848
public void processInputData(PrintWriter out)
        throws DBException
    {
        String strMoveValue = this.getProperty(DBParams.COMMAND);      // Display record
        if (strMoveValue == null)
            strMoveValue = Constants.BLANK;

        String strError = this.getTask().getLastError(0);
        if ((strError != null) && (strError.length() > 0))
            strError = strError + " on " + strMoveValue;
        if ((strError != null) && (strError.length() > 0))
        {
            out.println("<span class=\"error\">Error: " + strError + "</span><br />");
            Record record = ((BasePanel)this.getScreenField()).getMainRecord();
            if (record != null)
                record.setEditMode(Constants.EDIT_NONE);    // Make sure this isn't updated on screen free
        }
        else
        {
            String strMessage = this.getTask().getStatusText(DBConstants.INFORMATION_MESSAGE);
            if (strMessage != null)
                if (strMoveValue.length() > 0)
                    if ((strMessage.length() > 0) && (!(this.getScreenField() instanceof BaseGridScreen))) // TODO localize
                        out.println("<span class=\"information\">" + strMessage + "</span><br />");
        }
    }
598131
public void printScreen(PrintWriter out, ResourceBundle reg)
    {
        String strClassXML = XmlUtilities.createXMLStringRecord(this);
        
        if (strClassXML == null)
            strClassXML = DBConstants.BLANK;
        
        String strOptXML = DBConstants.BLANK;
        FileHdr fileHdr = new FileHdr(null);
        fileHdr.setKeyArea(FileHdr.FILE_NAME_KEY);
        fileHdr.getField(FileHdr.FILE_NAME).moveFieldToThis(this.getField(ClassInfo.CLASS_NAME));
        try   {
            if (fileHdr.seek("="))
            {
                strOptXML = XmlUtilities.createXMLStringRecord(fileHdr);
                FieldData fieldInfo = new FieldData(null);
                fieldInfo.setKeyArea(FieldData.FIELD_FILE_NAME_KEY);
                fieldInfo.addListener(new SubFileFilter(this.getField(ClassInfo.CLASS_NAME), FieldData.FIELD_FILE_NAME, null, null, null, null));
                strOptXML += Utility.startTag(XMLTags.FIELD_LIST);
                while (fieldInfo.hasNext())
                {
                    fieldInfo.next();
                    strOptXML += XmlUtilities.createXMLStringRecord(fieldInfo);
                }
                strOptXML += Utility.endTag(XMLTags.FIELD_LIST);
                fieldInfo.free();
        
                KeyInfo keyInfo = new KeyInfo(null);
                keyInfo.setKeyArea(KeyInfo.KEY_FILENAME_KEY);
                keyInfo.addListener(new SubFileFilter(this.getField(ClassInfo.CLASS_NAME), KeyInfo.KEY_FILENAME, null, null, null, null));
                strOptXML += Utility.startTag(XMLTags.KEY_LIST);
                while (keyInfo.hasNext())
                {
                    keyInfo.next();
                    strOptXML += XmlUtilities.createXMLStringRecord(keyInfo);
                }
                strOptXML += Utility.endTag(XMLTags.KEY_LIST);
                keyInfo.free();
            }
        } catch (DBException ex)    {
            ex.printStackTrace();
            strOptXML = DBConstants.BLANK;
        }
        fileHdr.free();
        
        String strContentArea =
                    strClassXML +
                    strOptXML;
        out.println(strContentArea);
    }
255215
protected void writeHtml(final MBasicTable table, final OutputStream outputStream,
			final boolean isSelection) throws IOException {
		final Writer out = new OutputStreamWriter(outputStream, "UTF-8");

		final String eol = isSelection ? "\n" : System.getProperty("line.separator");
		// eol = "\n" si sélection, "\r\n" sinon pour un fichier windows et "\n" pour un fichier unix

		out.write("<!-- Fichier genere par ");
		out.write(System.getProperty("user.name"));
		out.write(" le ");
		out.write(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG)
				.format(new Date()));
		out.write(" -->");
		out.write(eol);

		out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
		out.write("<html>");
		out.write(eol);
		final String title = buildTitle(table);
		writeHtmlHead(title, out, eol);
		out.write("<body>");
		out.write(eol);
		if (title != null) {
			out.write("<h3>");
			out.write(title);
			out.write("</h3>");
		}
		out.write(eol);

		writeHtmlTable(table, isSelection, out, eol);
		out.write("</body>");
		out.write(eol);
		out.write("</html>");
		out.flush();
	}
413274
public void printHtmlField(PrintWriter out, String strTag, String strParams, String strData)
    {
        String strField = ((BasePanel)this.getRecordOwner()).getProperty("name");
        if ((strField != null) && (strField.length() > 0) && (m_recDetail.getField(strField) != null))
        {
            String string = m_recDetail.getField(strField).toString();
            out.print(string);
        }
    }
1068637
def display_results_html
		  output ="<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title></title></head><body>"
		  output.concat("<table><thead><tr><td>FileName</td></tr><tr><td>#{@folder1}</td></tr><tr><td>#{@folder2}</td></tr><tr><td>Equal</td></tr></thead>")
      @filehash.each{ |key, value| output.concat("<tbody><tr><td>#{value.file_name}</td></tr><tr><td>#{value.file_hash1}</td></tr><tr><td>#{value.file_hash2}</td></tr><tr><td>#{value.file_hash1==value.file_hash2}</td></tr>")}
      output.concat("</tbody></table></body></html>")
      puts output
    end
612785
public void printAppletHtmlScreen(PrintWriter out, ResourceBundle reg)
        throws DBException
    {
    	reg = ((BaseApplication)this.getTask().getApplication()).getResources("HtmlApplet", false);
    	
        Map<String,Object> propApplet = new Hashtable<String,Object>();

        Task task = this.getTask();
        Map<String,Object> properties = null;
        if (task instanceof ServletTask)
            properties = ((ServletTask)task).getRequestProperties(((ServletTask)task).getServletRequest(), true);
        else
            properties = task.getProperties();
        
        properties = ((AppletHtmlScreen)this.getScreenField()).getAppletProperties(propApplet, properties);

        out.println("<center>");
        
        char DEFAULT = ' ';
        char ch = ScreenFieldViewAdapter.getFirstToUpper(this.getProperty(DBParams.JAVA), DEFAULT);

        if (ch == DEFAULT)
            if (this.getTask() instanceof ServletTask)
        { // Default - 'P'lug-in/'A'pplet depends on browser
            ch = 'P'; // by Default - use plug-in
            HttpServletRequest req = ((ServletTask)this.getTask()).getServletRequest();
            Enumeration<?> e = req.getHeaderNames();
            while (e.hasMoreElements())
            {
                String name = (String)e.nextElement();
                String value = req.getHeader(name);
                if ((name != null) && (name.equalsIgnoreCase("User-Agent")) && (value != null))
                { // This is what I'm looking for... the browser type
                    value = value.toUpperCase();
                    if (value.indexOf("MOZILLA/5") != -1)
                        ch = UserInfoModel.WEBSTART.charAt(0); // Browser 5.x... Use plug-in (yeah!)
                    if (value.indexOf("MOZILLA/4") != -1)
                        ch = UserInfoModel.WEBSTART.charAt(0); // Browser 4.x... must use plug-in
                    if (value.indexOf("MSIE") != -1)
                        ch = UserInfoModel.WEBSTART.charAt(0); // Microsoft... must use plug-in
                    if (value.indexOf("WEBKIT") != -1)
                        ch = UserInfoModel.WEBSTART.charAt(0); // Chrome/Safari... must use plug-in
                    if (value.indexOf("CHROME") != -1)
                        ch = UserInfoModel.WEBSTART.charAt(0); // Chrome... must use plug-in
                    if (value.indexOf("SAFARI") != -1)
                        ch = UserInfoModel.WEBSTART.charAt(0); // Safari... must use plug-in
                    break;
                }
            }
        }

        if (ch != UserInfoModel.PLUG_IN.charAt(0))
        { // Not the plug-in, use jnlp applet tags
        	String strWebStartResourceName = this.getProperty("webStart");
        	if (strWebStartResourceName == null)
        		strWebStartResourceName = "webStart";
            String strApplet = reg.getString(strWebStartResourceName);
            String strJnlpURL = reg.getString(strWebStartResourceName + "Jnlp");
            
            if ((strApplet == null) || (strApplet.length() == 0))
            	strApplet = WEB_START_DEFAULT;
            StringBuilder sb = new StringBuilder(strApplet);
            
            StringBuffer sbParams = new StringBuffer();
            for (Map.Entry<String,Object> entry : properties.entrySet())
            {
                String strKey = (String)entry.getKey();
                Object objValue = entry.getValue();
                String strValue = null;
                if (objValue != null)
                    strValue = objValue.toString();
                if (strValue != null)
//x                    if (strValue.length() > 0)
                        sbParams.append(strKey + ":\"" + strValue + "\",\n");
            }
            if (propApplet.get(HtmlConstants.ARCHIVE) != null)
            	sbParams.append("archive:\"" + propApplet.get(HtmlConstants.ARCHIVE) + "\", \n");
            if (propApplet.get(HtmlConstants.NAME) != null)
                if (sbParams.indexOf("name:") == -1)
                	sbParams.append("name:\"" + propApplet.get(HtmlConstants.NAME) + "\", \n");
            if (propApplet.get(HtmlConstants.ID) != null)
            	sbParams.append("id:\"" + propApplet.get(HtmlConstants.ID) + "\", \n");
            if (sbParams.indexOf("hash:") == -1)
            	sbParams.append("hash:location.hash,\n");
            if (sbParams.indexOf("draggable:") == -1)
            	sbParams.append("draggable:true,");
            Utility.replace(sb, "{other}", sbParams.toString());

            strJnlpURL = Utility.encodeXML(this.getJnlpURL(strJnlpURL, propApplet, properties));
            Utility.replace(sb, "{jnlpURL}", strJnlpURL);

            Utility.replaceResources(sb, reg, propApplet, null);

            out.println(sb.toString());
        }
        else
        {
            out.println("<OBJECT classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\"");
            out.println(" width=\"" + propApplet.get(HtmlConstants.WIDTH) + "\"");
            out.println(" height=\"" + propApplet.get(HtmlConstants.HEIGHT) + "\"");
            if (propApplet.get(HtmlConstants.NAME) != null)
                out.println(" name=\"" + propApplet.get(HtmlConstants.NAME) + "\"");
            out.println(" codebase=\"http://java.sun.com/update/1.5.0/jinstall-1_6_0-windows-i586.cab#Version=1,6,0,0\">");
            if (propApplet.get(HtmlConstants.ARCHIVE) != null)
                out.println("<param name=\"ARCHIVE\" value=\"" + propApplet.get(HtmlConstants.ARCHIVE) + "\">");
            out.println("<param name=\"CODE\" value=\"" + propApplet.get(DBParams.APPLET) +  "\">");
            out.println("<param name=\"CODEBASE\" value=\"" + propApplet.get(HtmlConstants.CODEBASE) + "\">");
            
            for (Map.Entry<String,Object> entry : properties.entrySet())
            {
                String strKey = (String)entry.getKey();
                Object objValue = entry.getValue();
                String strValue = null;
                if (objValue != null)
                    strValue = objValue.toString();
                if (strValue != null)
                    if (strValue.length() > 0)
                        out.println("<param name=\"" + strKey + "\" value=\"" + strValue + "\">");
            }
    
            out.println("<param name=\"type\" value=\"application/x-java-applet;version=1.6.0\">");
            out.println("<COMMENT>");
            out.println("<EMBED type=\"application/x-java-applet;version=1.6\"");

            if (propApplet.get(HtmlConstants.ARCHIVE) != null)
                out.println(" java_ARCHIVE=\"" + propApplet.get(HtmlConstants.ARCHIVE) + "\"");
            out.println(" java_CODE=\"" + propApplet.get(DBParams.APPLET) + "\"");
            out.println(" width=\"" + propApplet.get(HtmlConstants.WIDTH) + "\"");
            out.println(" height=\"" + propApplet.get(HtmlConstants.HEIGHT) + "\"");
            if (propApplet.get(HtmlConstants.NAME) != null)
                out.println(" name=\"" + propApplet.get(HtmlConstants.NAME) + "\"");
            out.println(" java_CODEBASE=\"" + propApplet.get(HtmlConstants.CODEBASE) + "\"");
            
            for (Map.Entry<String,Object> entry : properties.entrySet())
            {
                String strKey = (String)entry.getKey();
                Object objValue = entry.getValue();
                String strValue = null;
                if (objValue != null)
                    strValue = objValue.toString();
                if (strValue != null)
                    if (strValue.length() > 0)
                        out.println(" " + strKey + " =\"" + strValue + "\"");
            }
    
            out.println(" pluginspage=\"http://java.sun.com/javase/downloads/ea.jsp\"><NOEMBED></COMMENT>");
            out.println(" alt=\"Your browser understands the &lt;APPLET&gt; tag but is not running the applet, for some reason.\"");
            out.println(" Your browser is completely ignoring the &lt;APPLET&gt; tag!");
            out.println("</NOEMBED></EMBED>");
            out.println("</OBJECT>");
        }
        out.println("</center>");
    }
776583
public boolean printData(PrintWriter out, int iPrintOptions)
    {
        if (this.getProperty(DBParams.XML) != null)
            return this.getScreenFieldView().printData(out, iPrintOptions);
        else
            return super.printData(out, iPrintOptions);
    }
327463
public static void print(PrintStream out, String xpath, Object result){
        out.printf("XPath: %s%n", xpath);
        print(out, result, 2);
    }
884818
public void printEndGridScreenData(PrintWriter out, int iPrintOptions)
    {
        out.println(Utility.endTag(XMLTags.DATA));
    }
1287179
void appendHtmlReport(StringBuilder sb) {
    sb.append("<table class=\"storage\">");
    sb.append("<thead><tr><td>JN</td><td>Status</td></tr></thead>\n");
    for (AsyncLogger l : loggers) {
      sb.append("<tr>");
      sb.append("<td>" + JspUtil.escapeXml(l.toString()) + "</td>");
      sb.append("<td>");
      l.appendHtmlReport(sb);
      sb.append("</td></tr>\n");
    }
    sb.append("</table>");
  }
989285
@Override
	public void printContentVerticalDivider(ChainWriter out, WebSiteRequest req, HttpServletResponse resp, int direction, int colspan, int rowspan, String align, String width) {
		out.print("    </td>\n");
		switch(direction) {
			case UP_AND_DOWN:
				out.print("    <td>&#160;</td>\n");
				break;
			case NONE:
				break;
			default: throw new IllegalArgumentException("Unknown direction: "+direction);
		}
		out.print("    <td");
		if(width!=null && width.length()>0) {
			out.append(" style='width:");
			out.append(width);
			out.append('\'');
		}
		out.print(" valign='top'");
		if(colspan!=1) out.print(" colspan='").print(colspan).print('\'');
		if(rowspan!=1) out.print(" rowspan='").print(rowspan).print('\'');
		if(align!=null && !align.equals("left")) out.print(" align='").print(align).print('\'');
		out.print('>');
	}
239186
public void printScreen(PrintWriter out, ResourceBundle reg)
        throws DBException
    {
        String strParamRecord = this.getProperty(DBParams.RECORD);      // Display record
        String strParamScreen = this.getProperty(DBParams.SCREEN);      // Display screen
//?        String strParamLimit = this.getProperty("limit");   // Display record
        if (strParamRecord == null)
            strParamRecord = DBConstants.ROOT_PACKAGE;
        if (strParamScreen == null)
            strParamScreen = Constants.BLANK;
        String strHTML = reg.getString("Default");
        if ((strHTML == null) || (strHTML.length() == 0))
            strHTML = "<hr>" +
            "<form action=\"/" + HtmlConstants.SERVLET_PATH + "\" method=\"get\">" +
            "<pre>" +
            " Record : <input type=\"text\" length=\"50\" name=\"record\" value=\"" + HtmlConstants.RECORD_TAG + "\"/>\n" +
            " Screen : <input type=\"text\" length=\"50\" name=\"screen\" value=\"" + HtmlConstants.SCREEN_TAG + "\"/>\n" +
            "  Limit : <input type=\"text\" maxlength=\"7\" name=\"limit\" value=\"200\">\n" +
            "</pre>" +
            "<input type=submit\"submit\" name=\"" + DBParams.COMMAND + "\" VALUE=\"" + ThinMenuConstants.SUBMIT + "\"/>" +
            "</form>";
        strHTML = Utility.replace(strHTML, HtmlConstants.RECORD_TAG, strParamRecord);
        strHTML = Utility.replace(strHTML, HtmlConstants.SCREEN_TAG, strParamScreen);

        if (this.getProperty(DBParams.JOB) != null)
        {
            String strCommand = this.getProperty(DBParams.JOB);
            try   {
                strCommand = URLDecoder.decode(strCommand, DBConstants.URL_ENCODING);
            } catch (Exception ex)  {
                // Ignore
            }
            strHTML = "<p>Job: " + strCommand;
            if (this.getScreenField().handleCommand(strCommand, this.getScreenField(), ScreenConstants.USE_SAME_WINDOW | DBConstants.PUSH_TO_BROWSER))
                strHTML += " queued successfully</p>";
            else
                strHTML += " queued unsuccessfully</p>";
        }
        else if (this.getProperty("menutasks") != null)
        {
            String strCommand = this.getProperty("menutasks");
            Task task = this.getTask();
            if (task == null)
                task = BaseApplet.getSharedInstance();  // ??
//x         TaskScheduler js = task.getApplication().getTaskScheduler();
            PrivateTaskScheduler js = new PrivateTaskScheduler(task.getApplication(), 0, true);
            strHTML = "<p>Multiple Job queue: " + strCommand + "</p>";
            Record recMenu = Record.makeRecordFromClassName(MenusModel.THICK_CLASS, ((DefaultHtmlScreen)this.getScreenField()));
            recMenu.setKeyArea(MenusModel.CODE_KEY);
            recMenu.getField(MenusModel.CODE).setString(strCommand);
            String strMenuObjectID = null;
            if (recMenu.seek("="))
                strMenuObjectID = recMenu.getField(MenusModel.ID).toString();
            if ((strMenuObjectID != null) && (strMenuObjectID.length() > 0))
            {
                recMenu.close();
                recMenu.setKeyArea(MenusModel.PARENT_FOLDER_ID_KEY);
                StringSubFileFilter behMenu = new StringSubFileFilter(strMenuObjectID, recMenu.getField(MenusModel.PARENT_FOLDER_ID), null, null, null, null);
                recMenu.addListener(behMenu);
                while (recMenu.hasNext())
                {
                    recMenu.next();
                    String strLink = ((MenusModel)recMenu).getLink();
                    Map<String,Object> properties = new Hashtable<String,Object>();
                    Util.parseArgs(properties, strLink);
                    strCommand = (String)properties.get(DBParams.JOB);
                    if (strCommand != null)
                    {
                        try   {
                            strCommand = URLDecoder.decode(strCommand, DBConstants.URL_ENCODING);
                        } catch (java.io.UnsupportedEncodingException ex) {
                            ex.printStackTrace();
                        }
                        strHTML += "<p>Job: " + strCommand;
                        js.addTask(strCommand);
                        strHTML += " queued successfully</p>";
                    }
                    else
                        strHTML += "<p>Job: " + strCommand + " illegal job name</p>";
                }
            }
            recMenu.free();
            recMenu = null;
            js.endOfJobs();     // This thing will stop now when its done.
        }
        
        out.println(strHTML);
    }
565655
public void printScreen(PrintWriter out, ResourceBundle reg)
        throws DBException
    {
        out.println("<html>");
        this.printAppletHtmlScreen(out, reg);
        out.println("</html>");
/*        Map<String,Object> propApplet = new Hashtable<String,Object>();
        Map<String,Object> properties = ((AppletHtmlScreen)this.getScreenField()).getAppletProperties(propApplet);
        Utility.startTag("applet-properties");
        out.println(XMLPropertiesField.propertiesToXML(propApplet));
        Utility.endTag("applet-properties");
        Utility.startTag("properties");
        out.println(XMLPropertiesField.propertiesToXML(properties));
        Utility.endTag("properties");
        Utility.startTag("jnlp-url");
        String strJnlpURL = this.getJnlpURL(propApplet, properties);
        out.println(Utility.encodeXML(strJnlpURL));
        Utility.endTag("jnlp-url");
*/    }