You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Kito D. Mann" <km...@virtua.com> on 2005/04/07 01:29:25 UTC

RE: Jscookmenu - ThemeOffice - Images not displaying?

FYI, a work around for this is to add your own <script> elements to your 
view, after the <head> element. They will override the ones generated by 
MyFaces. For example:

<f:view>
   <x:stylesheet path="/themes/ThemeOffice/theme.css"/>
   <script src="/webmodule/themes/ThemeOffice/theme.js" 
type="text/javascript"/>

   <x:jscookMenu layout="hbr" theme="ThemeOffice">
   <x:jscookMenu layout="hbr" theme="ThemeIE">
     <x:navigationMenuItems value="#{testBean.sample2}"/>
     <x:navigationMenuItem itemLabel="Tab 4" action="Tab4"/>
   </x:jscookMenu>
</f:view>

At 03:07 PM 3/31/2005, you wrote:
>Yes, I'm using 1.0.9, the latest from CVS.  It looks like 1.0.9 started 
>using the AddResource interface to have the javascripts & styles 
>automatically added.  If you look at the links they generate, they go to:
>
>/faces/myFacesExtensionResource/navmenu.NavigationMenuItem/1112283493000/jscookmenu/JSCookMenu.js
>
>Or a similar link, which I assume gets handled by the faces extension 
>resource filter.  However, the images (based on looking in 
>/src/components/org/apache/myfaces/custom/navmenu/resources/jscookmenu/ThemeOffice/theme.js) 
>are being looked for in a context-relative location:
>
>var cmThemeOfficeBase = 'jscookmenu/ThemeOffice/';
>...
>itemRight: '<img alt="" src="' + cmThemeOfficeBase + 'blank.gif">',
>...
>
>I don't see how these can be resolved without having 
>jscookmenu/ThemeOffice/*.gif in a relative location.
>
>Note that I'm even getting this with the 1.0.9 RC2 examples war 
>file.  Image not found place-holders in the nav menu.
>
>-----Original Message-----
>From: Aaron Bartell [mailto:aaronbartell@gmail.com]
>Sent: Thursday, March 31, 2005 1:46 PM
>To: MyFaces Discussion
>Subject: Re: Jscookmenu - ThemeOffice - Images not displaying?
>
>What version of MyFaces are you using?  I had the same problem when I went 
>to MyFaces 1.0.9.  When I went back to 1.0.7 and everything was back to 
>normal.
>
>Take a look at the <head>...</head> section of the page produced by 
>MyFaces that has a jsCookMenu on it - do you see a bunch of extra style 
>sheets and javascript links that you didn't specify in your JSP? (that is 
>what I saw in my pages after upgrading to 1.0.9)
>
>
>HTH
>Aaron Bartell
>
>Neal Haggard wrote:
>
> >I realized when I saw the subject come up that I really have two 
> questions.  The question I asked in my last note being a bit more 
> pressing.  The other question is I'm seeing the styles & the javascript 
> is rendering for the jscookMenu, however the internal images that the 
> javascript loads on the right hand side of the sub-child elements are not 
> rendering.  I get the image not found placeholder (the infamous red 
> 'X').  Is there something else I need to add to my Extensions Filter 
> configuration to let that work?
> >
> >-----Original Message-----
> >From: Neal Haggard [mailto:Neal.Haggard@sas.com]
> >Sent: Thursday, March 31, 2005 1:11 PM
> >To: MyFaces Discussion
> >Subject: Jscookmenu - ThemeOffice - Images not displaying?
> >
> >I'm attempting to use the jscookmenu as an actionmenu in a table, to 
> allow table actions per row.  When I click on the link in the second 
> column (to call #{selectContactBean.overview}, it properly chooses the 
> correct row from the dataTable, but when choosing the 
> #{selectContactBean.overview} action from the x:jscookMenu, it does 
> not.  Any ideas why this isn't working, and more importantly how I can 
> fix it so I can do this?
> >
> >Here's a snippet of my JSP:
> >
> ><h:dataTable value="#{selectContactBean.myContacts}"
> >   var="contact"
> >   binding="#{selectContactBean.contactTable}">
> >  <h:column>
> >    <x:jscookMenu layout="hbr" theme="ThemeOffice" >
> >      <x:navigationMenuItem id="showActions" 
> icon="#{resources['actions.showActions.image']}" itemLabel=" ">
> >        <x:navigationMenuItem id="overview" 
> icon="#{resources['actions.overview.image']}"
> >         itemLabel="#{resources['actions.overview.txt']}" 
> action="#{selectContactBean.overview}"/>
> >        <x:navigationMenuItem id="copy" 
> icon="#{resources['actions.copy.image']}"
> >         itemLabel="#{resources['actions.copy.txt']}" action="copy" />
> >        <x:navigationMenuItem id="delete" 
> icon="#{resources['actions.delete.image']}"
> >         itemLabel="#{resources['actions.delete.txt']}" action="delete" />
> >        <x:navigationMenuItem id="summary" split="true" 
> icon="#{resources['actions.summary.image']}"
> >         itemLabel="#{resources['actions.summary.txt']}" action="summary" />
> >      </x:navigationMenuItem>
> >    </x:jscookMenu>
> >  </h:column>
> >  <h:column>
> >    <f:facet name="header">
> >      <h:outputText value="#{resources['column.contacts.contact.txt']}" />
> >    </f:facet>
> >       <h:commandLink action="#{selectContactBean.overview}">
> >      <h:outputText value="#{contact.name}" />
> >       </h:commandLink>
> >  </h:column>
> ></h:dataTable>
> >
> >Here's a piece of my selectContactBean:
> >
> >/**
> > * Handle retrieving & selecting contacts from a user's contacts.
> > */
> >public class SelectContactBean extends AbstractBaseBean {
> >    /** UIData object so we can see what row was selected. */
> >    private UIData contactTable;
> >
> >    /**
> >     * Get the contact table
> >     *
> >     * @return Returns the contactTable.
> >     */
> >    public UIData getContactTable() {
> >        return contactTable;
> >    }
> >
> >    /**
> >     * Set the contact table.
> >     *
> >     * @param contactTable The contactTable to set.
> >     */
> >    public void setContactTable(UIData contactTable) {
> >        this.contactTable = contactTable;
> >    }
> >
> >    /**
> >     * Get a list of the user's contacts.
> >     *
> >     * @return A List holding all the contacts for the current user.
> >     */
> >    public List getMyContacts() {
> >        return getVisit().getUser().getContacts();
> >    }
> >
> >    /**
> >     * Get the contact that was selected and, if successful, navigate to the
> >     * overview page for that contact.
> >     *
> >     * @return Navigation outcome string
> >     */
> >    public String overview() {
> >        return getContact();
> >    }
> >
> >    /**
> >     * Use the contactTable UI component to get the selected contact. Verify
> >     * they are still in the datastore and set the contact as the current
> >     * contact.
> >     *
> >     * @return Navigation outcome string
> >     */
> >    public String getContact() {
> >        FacesContext facesContext = getFacesContext();
> >
> >        // Get the selected row as a Contact
> >        Contact contact = (Contact) contactTable.getRowData();
> >
> >        // Set the current contact on our visit
> >        getVisit().setCurrentContact(contact);
> >
> >        // Success
> >        return Constants.SUCCESS_OUTCOME;
> >    }
> >}
> >
> >
> >

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kito D. Mann (kmann@virtua.com)
Virtua, Inc. (phone: 203-323-1244  fax: 203-323-2363)
Author, JavaServer Faces in Action 
(<http://www.manning.com/mann/index.html>http://www.manning.com/mann/index.html)
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info

"Existence doesn't necessarily mean living..."