OW2 Consortium telosys

Rev

Blame | Last modification | View Log | RSS feed

package org.objectweb.telosys.uil.taglib.widget.html;

import org.objectweb.telosys.uil.taglib.TagCommons;
import org.objectweb.telosys.uil.taglib.widget.GenericTag;
import org.objectweb.telosys.uil.taglib.widget.data.MenuItem;

/**
 * Commons for menu HTML generation 
 * 
 * @author Laurent GUERIN
 *  
 */
public class MenuCommonsHTML 
{
    //----------------------------------------------------------------
    static protected String getOnclick( GenericTag tag, MenuItem item) 
    {
        if ( ! item.isSubMenu() ) // Is not a submenu ( do not point to a MenuBox )
        {            
                if ( item.getOnclick() != null ) // JavaScript action
                {
                        String s = item.getOnclick().trim() ;
                    if ( s.length() > 0 )
                    {
                        return s + ";fwkAfterMenuItemClick(event)" ;
                    }
                }
                if ( item.getHref() != null ) // External HREF link
                {
                        String s = item.getHref().trim() ;
                    if ( s.length() > 0 )
                    {
                        return "fwkMenuLink('" + s + "');" ;
                    }
                }
                if ( item.getCres() != null ) // Context Resource link
                {
                        String s = item.getCres().trim() ;
                    if ( s.length() > 0 )
                    {
                        return "fwkMenuLink('" + tag.getResourceURL(s)  + "');" ;
                    }
                }
                if ( item.getScreen() != null ) // ScreenMap link
                {
                        String sScreenName = item.getScreen().trim() ;
                    if ( sScreenName.length() > 0 )
                    {
                        String s = TagCommons.getScreenMapURL(tag.getPageContext());
                        s = s + "?name=" + sScreenName ;
                        return "fwkMenuLink('" + s + "');" ;
                    }
                }
        }
        return "fwkCancelEvent(event)" ;
    }
}

Generated by GNU enscript 1.6.4.