8 Replies Latest reply on Sep 22, 2009 2:56 PM by ramcis

    CDK create custom component

      Hi all,

      I create a custom component, but it doesn't display images.
      Let's say, bg.jpeg was defined as background image in the css file. the component load the css file correctly but it doesn't load the attached image ?

      I know it is possible to do this using xcss, but I'm asking if there is a way to do it using only css file.

      Thanks,
      Ramzi

        • 1. Re: CDK create custom component
          nbelaevski

          Hi Ramzi,

          If image resource is located in classpath (common location for component resources), then you'll have to provide some URI for which this resource can be served. Support for XCSS files includes creation of URIs for such resources using RichFaces resource framework. There's no renderer for CSS files that allows to insert classpath resource URIs in RF.

          • 2. Re: CDK create custom component

             

            "nbelaevski" wrote:
            Hi Ramzi,

            If image resource is located in classpath (common location for component resources), then you'll have to provide some URI for which this resource can be served. Support for XCSS files includes creation of URIs for such resources using RichFaces resource framework. There's no renderer for CSS files that allows to insert classpath resource URIs in RF.


            Thank you for your response.

            I resolved my problem, I'm not sure that is the proper way.
            I just added an entry to the image in the page where is called by css.



            • 3. Re: CDK create custom component
              nbelaevski

              Yes, it's a possible variant, but not convenient for redistributable components.

              • 4. Re: CDK create custom component

                 

                "nbelaevski" wrote:
                Yes, it's a possible variant, but not convenient for redistributable components.


                I'm looking for the convenient way.

                My ressources folder has the following structure:

                renderkit
                |--html
                ----|--images
                ----|---js
                ----|---css
                In my css file I refer to some images located in /images folder.
                These images are not loaded until I add an entry in the template to call them.
                Here is a look on some css entry

                .shortest .boxBottom {
                background: url(../images/box_03_bottom.png) left top no-repeat;
                }

                Now my question, what's the proper way to load box_03_bottom.png directly from css files ?
                Ramzi

                • 5. Re: CDK create custom component
                  nbelaevski

                  Is resources folder in classpath or in web application?

                  • 6. Re: CDK create custom component

                     

                    "nbelaevski" wrote:
                    Is resources folder in classpath or in web application?


                    All files of the component are packaged into a jar file that's used in a web application.

                    I just followed the cdk tutorial.

                    • 7. Re: CDK create custom component
                      nbelaevski

                      You need to use .XCSS to use such files.

                      • 8. Re: CDK create custom component

                         

                        "nbelaevski" wrote:
                        You need to use .XCSS to use such files.


                        Thanks
                        Ramzi