IE ugly rendering of emptycells

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

IE ugly rendering of emptycells

snowch
Hi Forum,

I have made a small change to HtmlFormRenderer.java to fix the ugly IE table empty cell rendering for ofbiz release 4.0.  Unfortunately, my code is not synched with SVN so I can't submit a patch.  My changes below are pretty obvious though.

Regards,

Chris


    public void renderDisplayField(StringBuffer buffer, Map context, DisplayField displayField) {
        ModelFormField modelFormField = displayField.getModelFormField();

        StringBuffer str = new StringBuffer();

        if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle()) || modelFormField.shouldBeRed(context)) {
            str.append("<span class=\"");
            str.append(modelFormField.getWidgetStyle());
            // add a style of red if this is a date/time field and redWhen is true
            if (modelFormField.shouldBeRed(context)) {
                str.append(" alert");
            }
            str.append("\">");
        }

        if (str.length() > 0) {
            buffer.append(str);
        }
        String description = displayField.getDescription(context);
// CHS FIX - START
        if (description.trim().equals("")) {
        this.renderFormatEmptySpace(buffer, context, modelFormField.getModelForm());
        }
// CHS FIX - END
        //Replace new lines with <br>
        description = description.replaceAll("\n", "<br>");
        buffer.append(description);
        if (str.length() > 0) {
            buffer.append("");
        }

        if (displayField instanceof DisplayEntityField) {
            this.makeHyperlinkString(buffer, ((DisplayEntityField) displayField).getSubHyperlink(), context);
        }
       
        this.appendTooltip(buffer, context, modelFormField);

        //this.appendWhitespace(buffer);
    }
Reply | Threaded
Open this post in threaded view
|

Re: IE ugly rendering of emptycells

BJ Freeman
how about  ;&nspb  for blanks




snowch sent the following on 5/6/2009 3:14 PM:

> Hi Forum,
>
> I have made a small change to HtmlFormRenderer.java to fix the ugly IE table
> empty cell rendering for ofbiz release 4.0.  Unfortunately, my code is not
> synched with SVN so I can't submit a patch.  My changes below are pretty
> obvious though.
>
> Regards,
>
> Chris
>
>
>     public void renderDisplayField(StringBuffer buffer, Map context,
> DisplayField displayField) {
>         ModelFormField modelFormField = displayField.getModelFormField();
>
>         StringBuffer str = new StringBuffer();
>
>         if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle()) ||
> modelFormField.shouldBeRed(context)) {
>             str.append("");
>         }
>
>         if (str.length() > 0) {
>             buffer.append(str);
>         }
>         String description = displayField.getDescription(context);
> // CHS FIX - START
>         if (description.trim().equals("")) {
>         this.renderFormatEmptySpace(buffer, context,
> modelFormField.getModelForm());
>         }
> // CHS FIX - END
>         //Replace new lines with <br>
>         description = description.replaceAll("\n", "<br>");
>         buffer.append(description);
>         if (str.length() > 0) {
>             buffer.append("");
>         }
>
>         if (displayField instanceof DisplayEntityField) {
>             this.makeHyperlinkString(buffer, ((DisplayEntityField)
> displayField).getSubHyperlink(), context);
>         }
>        
>         this.appendTooltip(buffer, context, modelFormField);
>
>         //this.appendWhitespace(buffer);
>     }
>

--
BJ Freeman
http://www.businessesnetwork.com/automation
http://bjfreeman.elance.com
http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
Systems Integrator.

Reply | Threaded
Open this post in threaded view
|

Re: IE ugly rendering of emptycells

snowch
Hi BJ,

That's what the method renderFormatEmptySpace current does:

    public void renderFormatEmptySpace(StringBuffer buffer, Map context, ModelForm modelForm) {
        buffer.append(" ");
    }

Best regards,

Chris

BJ Freeman wrote
how about  ;&nspb  for blanks




snowch sent the following on 5/6/2009 3:14 PM:
> Hi Forum,
>
> I have made a small change to HtmlFormRenderer.java to fix the ugly IE table
> empty cell rendering for ofbiz release 4.0.  Unfortunately, my code is not
> synched with SVN so I can't submit a patch.  My changes below are pretty
> obvious though.
>
> Regards,
>
> Chris
>
>
>     public void renderDisplayField(StringBuffer buffer, Map context,
> DisplayField displayField) {
>         ModelFormField modelFormField = displayField.getModelFormField();
>
>         StringBuffer str = new StringBuffer();
>
>         if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle()) ||
> modelFormField.shouldBeRed(context)) {
>             str.append("");
>         }
>
>         if (str.length() > 0) {
>             buffer.append(str);
>         }
>         String description = displayField.getDescription(context);
> // CHS FIX - START
>         if (description.trim().equals("")) {
>         this.renderFormatEmptySpace(buffer, context,
> modelFormField.getModelForm());
>         }
> // CHS FIX - END
>         //Replace new lines with <br>
>         description = description.replaceAll("\n", "<br>");
>         buffer.append(description);
>         if (str.length() > 0) {
>             buffer.append("");
>         }
>
>         if (displayField instanceof DisplayEntityField) {
>             this.makeHyperlinkString(buffer, ((DisplayEntityField)
> displayField).getSubHyperlink(), context);
>         }
>        
>         this.appendTooltip(buffer, context, modelFormField);
>
>         //this.appendWhitespace(buffer);
>     }
>

--
BJ Freeman
http://www.businessesnetwork.com/automation
http://bjfreeman.elance.com
http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
Systems Integrator.
Reply | Threaded
Open this post in threaded view
|

Re: IE ugly rendering of emptycells

snowch
That should have been:

    public void renderFormatEmptySpace(StringBuffer buffer, Map context, ModelForm modelForm) {
        buffer.append("&nbsp;");
    }


snowch wrote
Hi BJ,

That's what the method renderFormatEmptySpace current does:

    public void renderFormatEmptySpace(StringBuffer buffer, Map context, ModelForm modelForm) {
        buffer.append(" ");
    }

Best regards,

Chris

BJ Freeman wrote
how about  ;&nspb  for blanks




snowch sent the following on 5/6/2009 3:14 PM:
> Hi Forum,
>
> I have made a small change to HtmlFormRenderer.java to fix the ugly IE table
> empty cell rendering for ofbiz release 4.0.  Unfortunately, my code is not
> synched with SVN so I can't submit a patch.  My changes below are pretty
> obvious though.
>
> Regards,
>
> Chris
>
>
>     public void renderDisplayField(StringBuffer buffer, Map context,
> DisplayField displayField) {
>         ModelFormField modelFormField = displayField.getModelFormField();
>
>         StringBuffer str = new StringBuffer();
>
>         if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle()) ||
> modelFormField.shouldBeRed(context)) {
>             str.append("");
>         }
>
>         if (str.length() > 0) {
>             buffer.append(str);
>         }
>         String description = displayField.getDescription(context);
> // CHS FIX - START
>         if (description.trim().equals("")) {
>         this.renderFormatEmptySpace(buffer, context,
> modelFormField.getModelForm());
>         }
> // CHS FIX - END
>         //Replace new lines with <br>
>         description = description.replaceAll("\n", "<br>");
>         buffer.append(description);
>         if (str.length() > 0) {
>             buffer.append("");
>         }
>
>         if (displayField instanceof DisplayEntityField) {
>             this.makeHyperlinkString(buffer, ((DisplayEntityField)
> displayField).getSubHyperlink(), context);
>         }
>        
>         this.appendTooltip(buffer, context, modelFormField);
>
>         //this.appendWhitespace(buffer);
>     }
>

--
BJ Freeman
http://www.businessesnetwork.com/automation
http://bjfreeman.elance.com
http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
Systems Integrator.