You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Hintringer Nina <nh...@mbi.eu> on 2006/07/24 11:04:54 UTC

How to display an image within a schedule entry?

Dear all,

 

I use the schedule component and I'd like to display an image within
every schedule entry. When I put the html-code of the image (e.g. <img
src='/images/myImage.png' border='0' alt=''>) for example into the
subtitle-tag then the image-tag is shown in plain-text (like that: <img
src='/images/ myImage.png' border='0' alt=''>)  in the schedule entry
because the HTMLEncoder-Class encodes following special characters:

 

                case '"': app = "&quot;"; break;    //"

                case '&': app = "&amp;"; break;     //&

                case '<': app = "&lt;"; break;      //<

                case '>': app = "&gt;"; break;      //>

 

In the tooltip the image is rendered correct.

 

Is there any possibility to show images within a schedule entry to?

 

Regards,

Nina


Re: How to display an image within a schedule entry?

Posted by Zhi <zh...@gmail.com>.
Hi Nina,

You can customize the entry renderer of t:schedule with "entryRenderer" property. Please check the schedule4.jsp of tomahawk's simple example. Here is the sample to add an imgage for entry.

In jsp,

<t:schedule ...
    entryRenderer="#{myEntryRenderer}" />

In "#{myEntryRenderer}" Java Bean,

public class TaskScheduleEntryRenderer extends DefaultScheduleEntryRenderer {
    public void renderContent(FacesContext context, ResponseWriter writer, HtmlSchedule schedule, ScheduleDay day, ScheduleEntry entry, 
            boolean compact, boolean selected) throws IOException {

        writer.startElement(HTML.IMG_ELEM, null);
        writer.writeAttribute(HTML.SRC_ATTR, <YOUR_IMG_SRC>, null);
        writer.writeAttribute(HTML.TITLE_ATTR, <YOUR_IMG_TITLE>, null);
        writer.endElement(HTML.IMG_ELEM);
        writer.write("&nbsp;");

        super.renderContent(...);
    }
}

Good luck,

Zhi


----- Original Message ----- 
From: Hintringer Nina 
To: users@myfaces.apache.org 
Sent: Monday, July 24, 2006 5:04 PM
Subject: How to display an image within a schedule entry?


Dear all,
 
I use the schedule component and I'd like to display an image within every schedule entry. When I put the html-code of the image (e.g. <img src='/images/myImage.png' border='0' alt=''>) for example into the subtitle-tag then the image-tag is shown in plain-text (like that: <img src='/images/ myImage.png' border='0' alt=''>)  in the schedule entry because the HTMLEncoder-Class encodes following special characters:
 
                case '"': app = "&quot;"; break;    //"
                case '&': app = "&amp;"; break;     //&
                case '<': app = "&lt;"; break;      //<
                case '>': app = "&gt;"; break;      //>
 
In the tooltip the image is rendered correct.
 
Is there any possibility to show images within a schedule entry to?
 
Regards,
Nina