Re: [PROPOSAL] Keel look and feel (Attn: Pierre)

Raoul Pierre <[email protected]>
Newsgroups gmane.comp.java.keel.devel
Message-ID <[email protected]>
Shash,

Herewith the jsp file I use with the css menu. Some changes from the 
file I posted the 05/04/05. Mainly, nothing appends when you clik on the 
menu bar or on a menu without model or url.

Pierre


Shash Chatterjee a écrit :

> Pierre
>
>>
>> I tested this css with IE 6 and FireFox without problem.
>>
>> The CSS menu is not the "absolute" way. But as a first step it's 
>> simpler than the javascript code in app-navigate. And if a more 
>> powerfull tool is needed then there is MenuStruts, JsCookMenu...
>> It's also possible to keep the two and give a choice to the 
>> programmer. This is what I done in my project throughTiles definitions.
>>
> After much looking, I settled on the style.tigris.org methodology, as 
> Aleks suggested, and as I found out, Lou had already used in 
> app-scheduler.  One of the ideas there is to move everything to 
> CSS....which is what I am attempting to do.
>
> I integrated your CSS-based menu into app-personality.   Works fine in 
> Firefox.  Also works in IE-6, but to a point. Looks like the location 
> of the  .htc file  is relative to the  HTML/JSP file that links to the 
> CSS file.  So, if you have the .css, .htc and .jsp in the same 
> directory, everything works fine.  Otherwise, we are out of luck.
>
> Can you please see if you can make it work with the following structure:
>
> http:/localhost:8080/mywebcontext/
>    !--personality/style/css/style.css
>    |--personality/scripts/csshover.htc
>    |--dir1/test1.jsp
>    |--test2.jsp
>
> test1.jsp and test2.jsp both link to style.css. I can have style.css 
> define "body{behavior:url(../personalityscripts/csshover.htc);} to 
> make it work for test1.jsp.  Or, 
> "body{behavior:url(personality/scripts/csshover.htc);} to make it work 
> for test2.jsp.  But, can't get it defined to work for both.  It will 
> work OK if I define as 
> "body{behavior:url(/mywebcontext/personality/scripts/csshover.htc);}, 
> but that means hard-coding the context name, which will not work for 
> others.
>
> Any ideas?
>
> Shash
menubar.jsp (text/plain, 7.4 KB)
<jsp:directive.page language="java" />
<jsp:directive.include file="/common/taglibs.jspf" />

<%-- The output from this jsp can be included anywhere in the (X)HTML page.
     It uses the app-navigate parameter "menu" to make nested lists.
     
     No Javascript here, only CSS!
     
     Note: when the cursor goes out of any menu area, all the submenus vanish
           *immediatly*. To get some latence time, Javascript is needed.
           
     Note: 
       - no model or empty => try to use an url if any, otherwise nothing appends
       - empty url => nothing appends
     
     --%>


<div id="navbar">
<c:if test="${! empty menu}">
  <ul class="level1">
  <logic:iterate id="topelement" name="menu" property="nested">
    <bean:define id="topelement_title" name="topelement" property="attributes.title" type="java.lang.String"/>
    <li class="submenu">
      <a name="${topelement_title}">${topelement_title}</a>
      <ul class="level2">
      <logic:iterate id="secondelement" name="topelement" property="nested"> <%-- iterator over all second level elements --%>
        <bean:define id="secondelement_title" name="secondelement" property="attributes.title"/>

        <c:set var="secondelement_type" value="href"/>
        <logic:present name="secondelement" property="attributes.model">
          <logic:notEmpty name="secondelement" property="attributes.model">
            <bean:define id="secondelement_model" name="secondelement" property="attributes.model"/>
            <c:url var="secondelement_path" value="/model.do?model=${secondelement_model}"/>
            <logic:present name="secondelement" property="attributes.parameters">
              <bean:define id="secondelement_parameters" name="secondelement" property="attributes.parameters"/>
            </logic:present> <%-- secondelement parameters attribute --%>
            <logic:notPresent name="secondelement" property="attributes.parameters">
              <c:set var="secondelement_parameters" value=""/>
            </logic:notPresent> <%-- no secondelement parameters attribute --%>
           </logic:notEmpty>
          <logic:empty name="secondelement" property="attributes.model">
            <logic:present name="secondelement" property="attributes.url">
              <bean:define id="secondelement_url" name="secondelement" property="attributes.url"/>
              <c:url var="secondelement_path" value="${secondelement_url}"/>
            </logic:present> <%-- if there is a secondelement url attribute --%>
            <logic:notPresent name="secondelement" property="attributes.url">
              <c:set var="secondelement_path" value="{secondelement_title}"/>
              <c:set var="secondelement_type" value="name"/>
            </logic:notPresent> <%-- no secondelement url attribute --%>
            <c:set var="secondelement_parameters" value=""/>
          </logic:empty>        
        </logic:present> <%-- secondelement model attribute --%>
        <logic:notPresent name="secondelement" property="attributes.model">
          <logic:present name="secondelement" property="attributes.url">
            <bean:define id="secondelement_url" name="secondelement" property="attributes.url"/>
            <c:url var="secondelement_path" value="${secondelement_url}"/>
          </logic:present> <%-- if there is a secondelement url attribute --%>
          <logic:notPresent name="secondelement" property="attributes.url">
            <c:set var="secondelement_path" value="{secondelement_title}"/>
            <c:set var="secondelement_type" value="name"/>
          </logic:notPresent> <%-- no secondelement url attribute --%>
          <c:set var="secondelement_parameters" value=""/>
        </logic:notPresent> <%-- no secondelement model attribute --%>
        
        <li class="submenu">
          <a ${secondelement_type}="${secondelement_path}${secondelement_parameters}">${secondelement_title}
          <logic:notPresent name="secondelement" property="nested">
            </a>
          </logic:notPresent>          
          <logic:present name="secondelement" property="nested">
            <logic:empty name="secondelement" property="nested">
              </a>
            </logic:empty>
            <logic:notEmpty name="secondelement" property="nested">
              <span>&gt;</span></a><%-- TODO: use an image ? --%>
              <ul class="level3">
              <logic:iterate id="thirdelement" name="secondelement" property="nested">
                <bean:define id="thirdelement_title" name="thirdelement" property="attributes.title"/>
                <c:set var="thirdelement_type" value="href"/>
                <logic:present name="thirdelement" property="attributes.model">
                  <logic:notEmpty name="thirdelement" property="attributes.model">
                    <bean:define id="thirdelement_model" name="thirdelement" property="attributes.model"/>
                    <c:url var="thirdelement_path" value="/model.do?model=${thirdelement_model}"/>
                    <logic:present name="thirdelement" property="attributes.parameters">
                      <bean:define id="thirdelement_parameters" name="thirdelement" property="attributes.parameters"/>
                    </logic:present> <%-- thirdelement parameters attribute --%>
                    <logic:notPresent name="thirdelement" property="attributes.parameters">
                      <c:set var="thirdelement_parameters" value=""/>
                    </logic:notPresent> <%-- no thirdelement parameters attribute --%>
                  </logic:notEmpty>
                  <logic:empty name="thirdelement" property="attributes.model">
                    <logic:present name="thirdelement" property="attributes.url">
                      <bean:define id="thirdelement_url" name="thirdelement" property="attributes.url"/>
                      <c:url var="thirdelement_path" value="${thirdelement_url}"/>
                    </logic:present>
                    <logic:notPresent name="thirdelement" property="attributes.url">
                      <c:set var="thirdelement_path" value="{thirdelement_title}"/>
                      <c:set var="thirdelement_type" value="name"/>
                    </logic:notPresent>
                    <c:set var="thirdelement_parameters" value=""/>
                  </logic:empty>
                </logic:present>
                <logic:notPresent name="thirdelement" property="attributes.model">
                  <logic:present name="thirdelement" property="attributes.url">
                    <bean:define id="thirdelement_url" name="thirdelement" property="attributes.url"/>
                    <c:url var="thirdelement_path" value="${thirdelement_url}"/>
                  </logic:present>
                  <logic:notPresent name="thirdelement" property="attributes.url">
                    <c:set var="thirdelement_path" value="{thirdelement_title}"/>
                    <c:set var="thirdelement_type" value="name"/>
                  </logic:notPresent>
                  <c:set var="thirdelement_parameters" value=""/>
                </logic:notPresent>
                <li><a ${thirdelement_type}="${thirdelement_path}${thirdelement_parameters}">${thirdelement_title}</a></li>
              </logic:iterate> <%-- third element --%>
              </ul>
            </logic:notEmpty>
          </logic:present> <%-- second element --%>
        </li>
      </logic:iterate> <%-- all second-level elements --%>
      </ul>
    </li>
  </logic:iterate> <%-- top level elements --%>
  </ul>
</c:if> <%-- menu --%>
</div>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.