You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Torben Lauritzen <to...@gmail.com> on 2012/06/21 11:00:23 UTC

Tomahawk code allocated calendar control, missing resources

Hi.

I have a problem with Tomahawk.

I have a xhtml page with a PanelGroup that are bound to a backend. If I
allocate a calendar control as a child in the backend,  the javascript
resources isn't added to the output.

I would appreciate any hints how do debug.

/Torben

============ versions ======================

Tomahawk20 1.1.11
MyFaces 2.1.7

============ xhtml page ====================

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:t="http://myfaces.apache.org/tomahawk" >

<h:body>

  <ui:composition template="/WEB-INF/templates/sandbox.xhtml">
  <ui:define name="body">

  <h:form id="sandbox">

      <h:panelGroup binding="#{sandbox.dynamicGroup}"/>
  </h:form>

  </ui:define>
 </ui:composition>

</h:body>
</html>

============ Backend ======================

import javax.faces.bean.ManagedBean;
import javax.faces.component.html.HtmlPanelGroup;

import org.apache.myfaces.custom.calendar.HtmlInputCalendar;

@ManagedBean
public class Sandbox
{
  private HtmlPanelGroup dynamicGroup = null;

  public HtmlPanelGroup getDynamicGroup()
  {
    if ( dynamicGroup == null )
    {
      dynamicGroup = new HtmlPanelGroup();
      HtmlInputCalendar calendar = new HtmlInputCalendar();
      calendar.setRenderAsPopup(true);
      dynamicGroup.getChildren().add(calendar);
    }
    return dynamicGroup;
  }

  public void setDynamicGroup(HtmlPanelGroup dynamicGroup)
  {
    this.dynamicGroup = dynamicGroup;
  }

}

Re: Tomahawk code allocated calendar control, missing resources

Posted by Torben Lauritzen <to...@gmail.com>.
Hi

Thank you, this works for me as well.

/Torben


On Thu, Jun 21, 2012 at 11:11 AM, Dennis Hörsch <ho...@his.de> wrote:

> Hi,
>
> I had a similar situation and there I had to create the component create
> as follows, to give it a chance to register its resources:
>
> HtmlInputCalendar calendar = (HtmlInputCalendar) FacesContext.**
> getCurrentInstance().**getApplication().**createComponent(FacesContext.**getCurrentInstance(),
> "org.apache.myfaces.**HtmlInputCalendar", "org.apache.myfaces.Calendar")**
> ;
>
> Greetings
> dennis
>
> Am 21.06.2012 11:00, schrieb Torben Lauritzen:
>
>  Hi.
>>
>> I have a problem with Tomahawk.
>>
>> I have a xhtml page with a PanelGroup that are bound to a backend. If I
>> allocate a calendar control as a child in the backend,  the javascript
>> resources isn't added to the output.
>>
>> I would appreciate any hints how do debug.
>>
>> /Torben
>>
>> ============ versions ======================
>>
>> Tomahawk20 1.1.11
>> MyFaces 2.1.7
>>
>> ============ xhtml page ====================
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>         "http://www.w3.org/TR/xhtml1/**DTD/xhtml1-transitional.dtd<http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
>> ">
>> <html xmlns="http://www.w3.org/1999/**xhtml<http://www.w3.org/1999/xhtml>
>> "
>>       xmlns:f="http://java.sun.com/**jsf/core<http://java.sun.com/jsf/core>
>> "
>>       xmlns:h="http://java.sun.com/**jsf/html<http://java.sun.com/jsf/html>
>> "
>>       xmlns:ui="http://java.sun.com/**jsf/facelets<http://java.sun.com/jsf/facelets>
>> "
>>       xmlns:t="http://myfaces.**apache.org/tomahawk<http://myfaces.apache.org/tomahawk>
>> ">
>>
>> <h:body>
>>
>>   <ui:composition template="/WEB-INF/templates/**sandbox.xhtml">
>>   <ui:define name="body">
>>
>>   <h:form id="sandbox">
>>
>>       <h:panelGroup binding="#{sandbox.**dynamicGroup}"/>
>>   </h:form>
>>
>>   </ui:define>
>>  </ui:composition>
>>
>> </h:body>
>> </html>
>>
>> ============ Backend ======================
>>
>> import javax.faces.bean.ManagedBean;
>> import javax.faces.component.html.**HtmlPanelGroup;
>>
>> import org.apache.myfaces.custom.**calendar.HtmlInputCalendar;
>>
>> @ManagedBean
>> public class Sandbox
>> {
>>   private HtmlPanelGroup dynamicGroup = null;
>>
>>   public HtmlPanelGroup getDynamicGroup()
>>   {
>>     if ( dynamicGroup == null )
>>     {
>>       dynamicGroup = new HtmlPanelGroup();
>>       HtmlInputCalendar calendar = new HtmlInputCalendar();
>>       calendar.setRenderAsPopup(**true);
>>       dynamicGroup.getChildren().**add(calendar);
>>     }
>>     return dynamicGroup;
>>   }
>>
>>   public void setDynamicGroup(HtmlPanelGroup dynamicGroup)
>>   {
>>     this.dynamicGroup = dynamicGroup;
>>   }
>>
>> }
>>
>>
>
> --
>
> HIS Hochschul-Informations-System GmbH
> Goseriede9| 30159 Hannover | _www.his.de_ <http://www.his.de/>
>
> Dennis Hörsch
> Unternehmensbereich Hochschul-IT
> Arbeitsbereich Personalmanagement
> Telefon +49 (0)511 1220-403 | Fax +49 (0)511 1220-250
> E-Mail hoersch@his.de <ma...@his.de>
>
> Registergericht: Amtsgericht Hannover, HRB 6489
> Geschäftsführer: Prof. Dr. Martin Leitner
> Vorsitzender des Aufsichtsrats: Prof. Dr. Andreas Geiger
>
>

Re: Tomahawk code allocated calendar control, missing resources

Posted by Dennis Hörsch <ho...@his.de>.
Hi,

I had a similar situation and there I had to create the component create 
as follows, to give it a chance to register its resources:

HtmlInputCalendar calendar = (HtmlInputCalendar) 
FacesContext.getCurrentInstance().getApplication().createComponent(FacesContext.getCurrentInstance(), 
"org.apache.myfaces.HtmlInputCalendar", "org.apache.myfaces.Calendar");

Greetings
dennis

Am 21.06.2012 11:00, schrieb Torben Lauritzen:
> Hi.
>
> I have a problem with Tomahawk.
>
> I have a xhtml page with a PanelGroup that are bound to a backend. If I
> allocate a calendar control as a child in the backend,  the javascript
> resources isn't added to the output.
>
> I would appreciate any hints how do debug.
>
> /Torben
>
> ============ versions ======================
>
> Tomahawk20 1.1.11
> MyFaces 2.1.7
>
> ============ xhtml page ====================
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
>        xmlns:f="http://java.sun.com/jsf/core"
>        xmlns:h="http://java.sun.com/jsf/html"
>        xmlns:ui="http://java.sun.com/jsf/facelets"
>        xmlns:t="http://myfaces.apache.org/tomahawk">
>
> <h:body>
>
>    <ui:composition template="/WEB-INF/templates/sandbox.xhtml">
>    <ui:define name="body">
>
>    <h:form id="sandbox">
>
>        <h:panelGroup binding="#{sandbox.dynamicGroup}"/>
>    </h:form>
>
>    </ui:define>
>   </ui:composition>
>
> </h:body>
> </html>
>
> ============ Backend ======================
>
> import javax.faces.bean.ManagedBean;
> import javax.faces.component.html.HtmlPanelGroup;
>
> import org.apache.myfaces.custom.calendar.HtmlInputCalendar;
>
> @ManagedBean
> public class Sandbox
> {
>    private HtmlPanelGroup dynamicGroup = null;
>
>    public HtmlPanelGroup getDynamicGroup()
>    {
>      if ( dynamicGroup == null )
>      {
>        dynamicGroup = new HtmlPanelGroup();
>        HtmlInputCalendar calendar = new HtmlInputCalendar();
>        calendar.setRenderAsPopup(true);
>        dynamicGroup.getChildren().add(calendar);
>      }
>      return dynamicGroup;
>    }
>
>    public void setDynamicGroup(HtmlPanelGroup dynamicGroup)
>    {
>      this.dynamicGroup = dynamicGroup;
>    }
>
> }
>


-- 

HIS Hochschul-Informations-System GmbH
Goseriede9| 30159 Hannover | _www.his.de_ <http://www.his.de/>

Dennis Hörsch
Unternehmensbereich Hochschul-IT
Arbeitsbereich Personalmanagement
Telefon +49 (0)511 1220-403 | Fax +49 (0)511 1220-250
E-Mail hoersch@his.de <ma...@his.de>

Registergericht: Amtsgericht Hannover, HRB 6489
Geschäftsführer: Prof. Dr. Martin Leitner
Vorsitzender des Aufsichtsrats: Prof. Dr. Andreas Geiger