MyFaces Tomahawk
  1. MyFaces Tomahawk
  2. TOMAHAWK-1341

JS Cook Menu stylelocation no longer working on 1.1.7

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.7
    • Fix Version/s: 1.1.8
    • Component/s: JS Cook Menu
    • Labels:
      None
    • Environment:
      window Jboss Java 5 and tomahawk 1.1.7 for 1.2 jsf

      Description

      The stylelocation in 1.16 allow me to set custom color to the menu this is no longer and instead showing the default color
      <t:jscookMenu layout="hbr" theme="ThemeOffice" styleLocation="/css/jscookmenu" >
      .....
      </t:jscookMenu>
      Looking at the html source you can see how the href is being created note Trade is the application name
      version 1.1.6 (Link is correct)
      link rel="stylesheet" href="/Trade/css/jscookmenu/ThemeOffice/theme.css" type="text/css" />
      version .1.17
      <link rel="stylesheet" href="/Trade/faces/extensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/12222884/navmenu.jscookmenu.HtmlJSCookMenuRenderer/ThemeOffice/theme.css" type="text/css" />

        Issue Links

          Activity

          Hide
          Joseph ONeil added a comment -

          I found what I think is the problem this component underwent a lot of changes originally in 1.1.6 without going into details
          The setproperties method in HtmlJSCookMenuTag does not set the JSFAttr.STYLE_LOCATION attribute as is done in This was orignally handle in the
          UIComponentTagBase in 1.1.6 which is no longer use in 1.1.7 This problem looks like it may extend to some of the other attributes that also are not handled in the HtmlJSCookMenuTag
          I change the protected void setProperties(UIComponent component) method as follows

          if (_styleLocation != null)

          { comp.setValueExpression("styleLocation", _styleLocation); //<----Begin new code-----> if (_styleLocation != null) setStringProperty(component, JSFAttr.STYLE_LOCATION, _styleLocation); //<---End new Code---> }

          I also added a new method
          protected void setStringProperty(UIComponent component, String propName, ValueExpression value)

          { UIComponentELTagUtils.setStringProperty( component, propName, value); }

          I will attach the comple file also

          Show
          Joseph ONeil added a comment - I found what I think is the problem this component underwent a lot of changes originally in 1.1.6 without going into details The setproperties method in HtmlJSCookMenuTag does not set the JSFAttr.STYLE_LOCATION attribute as is done in This was orignally handle in the UIComponentTagBase in 1.1.6 which is no longer use in 1.1.7 This problem looks like it may extend to some of the other attributes that also are not handled in the HtmlJSCookMenuTag I change the protected void setProperties(UIComponent component) method as follows if (_styleLocation != null) { comp.setValueExpression("styleLocation", _styleLocation); //<----Begin new code-----> if (_styleLocation != null) setStringProperty(component, JSFAttr.STYLE_LOCATION, _styleLocation); //<---End new Code---> } I also added a new method protected void setStringProperty(UIComponent component, String propName, ValueExpression value) { UIComponentELTagUtils.setStringProperty( component, propName, value); } I will attach the comple file also
          Hide
          Joseph ONeil added a comment -

          This fix will correct the custom styleLocation while there I also notice that the imageLocation,javascriptLocation do not set the JSFAttr.JAVASCRIPT_LOCATION and JSFAttr.IMAGE_LOCATION

          Show
          Joseph ONeil added a comment - This fix will correct the custom styleLocation while there I also notice that the imageLocation,javascriptLocation do not set the JSFAttr.JAVASCRIPT_LOCATION and JSFAttr.IMAGE_LOCATION
          Hide
          Joseph ONeil added a comment -

          For cleaner code
          if (_styleLocation != null) setStringProperty(component, JSFAttr.STYLE_LOCATION, _styleLocation);

          can be change to
          setStringProperty(component, JSFAttr.STYLE_LOCATION, _styleLocation);

          since null is already checked

          Show
          Joseph ONeil added a comment - For cleaner code if (_styleLocation != null) setStringProperty(component, JSFAttr.STYLE_LOCATION, _styleLocation); can be change to setStringProperty(component, JSFAttr.STYLE_LOCATION, _styleLocation); since null is already checked
          Hide
          Leonardo Uribe added a comment -

          Since the file HtmlJSCookMenuTag.java is generated, it is not good practice to modify it

          The problem comes from org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr:

          // Alternate locations (instead of using AddResource)
          String JAVASCRIPT_LOCATION = "org.apache.myfaces.JAVASCRIPT_LOCATION";
          String IMAGE_LOCATION = "org.apache.myfaces.IMAGE_LOCATION";
          String STYLE_LOCATION = "org.apache.myfaces.STYLE_LOCATION";

          Since in 1.1.7, all tag hierarchy is generated, this should look like this:

          // Alternate locations (instead of using AddResource)
          String JAVASCRIPT_LOCATION = "javascriptLocation";
          String IMAGE_LOCATION = "imageLocation";
          String STYLE_LOCATION = "styleLocation";

          The components affected are t:inputCalendar and t:jscookMenu (and a lot of sandbox components), but this should solve the problem for all related components.

          Show
          Leonardo Uribe added a comment - Since the file HtmlJSCookMenuTag.java is generated, it is not good practice to modify it The problem comes from org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr: // Alternate locations (instead of using AddResource) String JAVASCRIPT_LOCATION = "org.apache.myfaces.JAVASCRIPT_LOCATION"; String IMAGE_LOCATION = "org.apache.myfaces.IMAGE_LOCATION"; String STYLE_LOCATION = "org.apache.myfaces.STYLE_LOCATION"; Since in 1.1.7, all tag hierarchy is generated, this should look like this: // Alternate locations (instead of using AddResource) String JAVASCRIPT_LOCATION = "javascriptLocation"; String IMAGE_LOCATION = "imageLocation"; String STYLE_LOCATION = "styleLocation"; The components affected are t:inputCalendar and t:jscookMenu (and a lot of sandbox components), but this should solve the problem for all related components.
          Hide
          Leonardo Uribe added a comment -

          Thank to Joseph ONeil for help us to find this bug

          Show
          Leonardo Uribe added a comment - Thank to Joseph ONeil for help us to find this bug

            People

            • Assignee:
              Leonardo Uribe
              Reporter:
              Joseph ONeil
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development