Widgetset does not contain implementation for com.invient.vaadin.charts.Inv

Hi everybody,

I’m developing a chart project. I downloaded the invient chart source codes and compiled the widget sets with GWT compiler.

My project is a maven project. I don’t have WebContent directory. Where will I put compiled widgetsets to my project? Please help meeeee…

Thankss…

I have mine in src/main/webapp/VAADIN.

Hi,
regarding the error message stated in the topic title - I would advise you to double check that you have added the

<inherits name="com.invient.vaadin.charts.widgetset.InvientChartsWidgetset"/> in your widgetset descriptor.

HTH
Aleksandr

Thanks to everybody.

I solved this issue finally :slight_smile: Please let me explain how did I do.

  • Download the source code from this link: https://vaadin.com/directory#addon/invient-charts and then export files to any folder.

  • Download GWT compiler files “gwt-2.5.0.zip” (Just search from google) and export it any folder.

  • Install these plugins to eclipse: GWT Designer Core, GWT Designer Editor, GWT Designer GPE

  • Create a new project from this way: File - New Project - Google - Web Application Project (My project name is MyInvientCharts)

  • Import this folder “InvientCharts-master/src/com/invient/vaadin/charts” to project’s “src” folder.

  • Now create a folder “gwt” and then import gwt-2.5.0/*.jar files

  • Right click to MyInvientCharts project - Properties - Java Build Path - Add Class Folder - Choose gwt folder in your project. Click OK.

  • SELECT this file: MyInvientCharts/src/com/invient/vaadin/charts/widgetset/InvientChartsWidgetset.gwt.xml

  • Be sure this file contains this line:

  • Now click to “Compile Vaadin widgets (Ctrl + 6)” button from toolbar. And then wait a minute while eclipse compiles the widgetset.

  • (KEY OPERATION) Compiled widgetset files are placed to WebContent/VAADIN/widgetsets/com.invient.vaadin.charts.widgetset.InvientChartsWidgetset and copy this to your real project’s src/main/webapp/VAADIN/widgetsets/ folder.

  • Create a class which extends NavigableApplicationServlet and put these methods:


/////////////////////////////////////////////////////////// CODE

    private String getApplicationOrSystemProperty( String parameterName, String defaultValue ){

        String val = null;

        // Try application properties
        val = getApplicationProperty( parameterName );
        if( val != null ){ return val; }

        // Try system properties
        val = getSystemProperty( parameterName );
        if( val != null ){ return val; }

        return defaultValue;
    }

    private String getWebApplicationsStaticFileLocation( HttpServletRequest request ){
        String staticFileLocation;
        // if property is defined in configurations, use that
        staticFileLocation = getApplicationOrSystemProperty( PARAMETER_VAADIN_RESOURCES, null );
        if( staticFileLocation != null ){ return staticFileLocation; }

        // the last (but most common) option is to generate default location
        // from request

        // if context is specified add it to widgetsetUrl
        String ctxPath = request.getContextPath();

        // FIXME: ctxPath.length() == 0 condition is probably unnecessary and
        // might even be wrong.

        if( ctxPath.length() == 0 && request.getAttribute( "javax.servlet.include.context_path" ) != null ){
            // include request (e.g portlet), get context path from
            // attribute
            ctxPath = ( String )request.getAttribute( "javax.servlet.include.context_path" );
        }

        // Remove heading and trailing slashes from the context path
        ctxPath = removeHeadingOrTrailing( ctxPath, "/" );

        if( ctxPath.equals( "" ) ){
            return "";
        }
        else{
            return "/" + ctxPath;
        }
    }

    private static String removeHeadingOrTrailing( String string, String what ){
        while( string.startsWith( what ) ){
            string = string.substring( 1 );
        }

        while( string.endsWith( what ) ){
            string = string.substring( 0, string.length() - 1 );
        }

        return string;
    }

    @Override
    protected void writeAjaxPageHtmlVaadinScripts( Window window, String themeName, Application application, BufferedWriter page, String appUrl, String themeUri, String appId,
            HttpServletRequest request ) throws ServletException, IOException{

        String applicationUrl = application.getURL().toString();
        String applicationTheme = application.getTheme();

        System.out.println( "applicationUrl: " + applicationUrl + ", applicationTheme: " + applicationTheme + ", REQUEST_WIDGETSET: " + REQUEST_WIDGETSET );

        // why this isn't last version of jQuery? because charts add-on is working best in jquery 1.6.1
        page.write( "<script language=\"javascript\" src=\"" + applicationUrl + "VAADIN/themes/" + applicationTheme + "/js/jquery-1.6.1.min.js\"></script>\n" );
        page.write( "<script language=\"javascript\" src=\"" + applicationUrl + "VAADIN/themes/" + applicationTheme + "/js/highcharts.js\"></script>\n" );
        page.write( "<script language=\"javascript\" src=\"" + applicationUrl + "VAADIN/themes/" + applicationTheme + "/js/modules/exporting.js\"></script>\n" );

        // request widgetset takes precedence (e.g portlet include)
        String requestWidgetset = ( String )request.getAttribute( REQUEST_WIDGETSET );
        String sharedWidgetset = ( String )request.getAttribute( REQUEST_SHARED_WIDGETSET );
        if( requestWidgetset == null && sharedWidgetset == null ){
            // Use the value from configuration or DEFAULT_WIDGETSET.
            // If no shared widgetset is specified, the default widgetset is
            // assumed to be in the servlet/portlet itself.
            requestWidgetset = getApplicationOrSystemProperty( PARAMETER_WIDGETSET, DEFAULT_WIDGETSET );
        }

        String widgetset;
        String widgetsetBasePath;
        if( requestWidgetset != null ){
            widgetset = requestWidgetset;
            widgetsetBasePath = getWebApplicationsStaticFileLocation( request );
        }
        else{
            widgetset = sharedWidgetset;
            widgetsetBasePath = getStaticFilesLocation( request );
        }

        widgetset = stripSpecialChars( widgetset );

        // final String widgetsetFilePath = widgetsetBasePath + "/" + WIDGETSET_DIRECTORY_PATH + widgetset + "/" + widgetset + ".nocache.js" + createPreventCachingQueryString();
        final String widgetsetFilePath = "VAADIN/widgetsets/com.invient.vaadin.charts.widgetset.InvientChartsWidgetset/com.invient.vaadin.charts.widgetset.InvientChartsWidgetset.nocache.js"
                + createPreventCachingQueryString();

        // Get system messages
        Application.SystemMessages systemMessages = null;
        try{
            systemMessages = getSystemMessages();
        }
        catch( SystemMessageException e ){
            // failing to get the system messages is always a problem
            throw new ServletException( "CommunicationError!", e );
        }

        page.write( "<script type=\"text/javascript\">\n" );
        page.write( "//<![CDATA[\n" );
        page.write( "if(!vaadin || !vaadin.vaadinConfigurations) {\n " + "if(!vaadin) { var vaadin = {}} \n" + "vaadin.vaadinConfigurations = {};\n"
                + "if (!vaadin.themesLoaded) { vaadin.themesLoaded = {}; }\n" );
        if( !isProductionMode() ){
            page.write( "vaadin.debug = true;\n" );
        }
        page.write( "}\n" );

        page.write( "vaadin.vaadinConfigurations[\"" + appId + "\"]
 = {" );
        page.write( "appUri:'" + appUrl + "', " );

        if( window != application.getMainWindow() ){
            page.write( "windowName: \"" + JsonPaintTarget.escapeJSON( window.getName() ) + "\", " );
        }
        if( isStandalone() ){
            page.write( "standalone: true, " );
        }
        page.write( "themeUri:" );
        page.write( themeUri != null ? "\"" + themeUri + "\"" : "null" );
        page.write( ", versionInfo : {vaadinVersion:\"" );
        page.write( VERSION );
        page.write( "\",applicationVersion:\"" );
        page.write( JsonPaintTarget.escapeJSON( application.getVersion() ) );
        page.write( "\"}" );
        if( systemMessages != null ){
            // Write the CommunicationError -message to client
            String caption = systemMessages.getCommunicationErrorCaption();
            if( caption != null ){
                caption = "\"" + JsonPaintTarget.escapeJSON( caption ) + "\"";
            }
            String message = systemMessages.getCommunicationErrorMessage();
            if( message != null ){
                message = "\"" + JsonPaintTarget.escapeJSON( message ) + "\"";
            }
            String url = systemMessages.getCommunicationErrorURL();
            if( url != null ){
                url = "\"" + JsonPaintTarget.escapeJSON( url ) + "\"";
            }

            page.write( ",\"comErrMsg\": {" + "\"caption\":" + caption + "," + "\"message\" : " + message + "," + "\"url\" : " + url + "}" );

            // Write the AuthenticationError -message to client
            caption = systemMessages.getAuthenticationErrorCaption();
            if( caption != null ){
                caption = "\"" + JsonPaintTarget.escapeJSON( caption ) + "\"";
            }
            message = systemMessages.getAuthenticationErrorMessage();
            if( message != null ){
                message = "\"" + JsonPaintTarget.escapeJSON( message ) + "\"";
            }
            url = systemMessages.getAuthenticationErrorURL();
            if( url != null ){
                url = "\"" + JsonPaintTarget.escapeJSON( url ) + "\"";
            }

            page.write( ",\"authErrMsg\": {" + "\"caption\":" + caption + "," + "\"message\" : " + message + "," + "\"url\" : " + url + "}" );
        }
        page.write( "};\n//]]>\n</script>\n" );

        page.write( "<iframe tabIndex='-1' id='__gwt_historyFrame' " + "style='position:absolute;width:0;height:0;border:0;overflow:"
                + "hidden;' src='javascript:false'></iframe>\n" );
        page.write( "<script language='javascript' src='" + widgetsetFilePath + "'></script>\n" );

        if( themeName != null ){
            // Custom theme's stylesheet, load only once, in different
            // script
            // tag to be dominate styles injected by widget
            // set
            page.write( "<script type=\"text/javascript\">\n" );
            page.write( "//<![CDATA[\n" );
            page.write( "if(!vaadin.themesLoaded['" + themeName + "']
) {\n" );
            page.write( "var stylesheet = document.createElement('link');\n" );
            page.write( "stylesheet.setAttribute('rel', 'stylesheet');\n" );
            page.write( "stylesheet.setAttribute('type', 'text/css');\n" );
            page.write( "stylesheet.setAttribute('href', '" + themeUri + "/styles.css');\n" );
            page.write( "document.getElementsByTagName('head')[0]
.appendChild(stylesheet);\n" );
            page.write( "vaadin.themesLoaded['" + themeName + "']
 = true;\n}\n" );
            page.write( "//]]>\n</script>\n" );
        }

        // Warn if the widgetset has not been loaded after 15 seconds on
        // inactivity
        // page.write( "<script type=\"text/javascript\">\n" );
        // page.write( "//<![CDATA[\n" );
        // page.write( "setTimeout('if (typeof " + widgetset.replace( '.', '_' ) + " == \"undefined\") {alert(\"Failed to load the widgetset: " + widgetsetFilePath
        // + "\")};',15000);\n" + "//]]>\n</script>\n" );

        // REQUEST_WIDGETSET = "com.invient.vaadin.charts.widgetset.InvientChartsWidgetset";
        // page.write( "<script language=\"javascript\" src=\"" + applicationUrl
        // + "VAADIN/widgetsets/com.invient.vaadin.charts.widgetset.InvientChartsWidgetset/com.invient.vaadin.charts.widgetset.InvientChartsWidgetset.nocache.js?"
        // + ( new Date() ).hashCode() + "\"></script>\n" );
        //
        // page.write( "<script type=\"text/javascript\">\n" );
        // page.write( "//<![CDATA[\n" );
        //
        // page.write( "//]]>\n</script>\n" );

        // super.writeAjaxPageHtmlVaadinScripts( window, themeName, application, page, appUrl, themeUri, appId, request );
    }
/////////////////////////////////////////////////////////// CODE
  • Edit web.xml file:

<!-- <servlet-class>org.vaadin.navigator7.NavigableApplicationServlet</servlet-class> -->
<servlet-class>your.real.project.package.name.RealProjectAppServlet</servlet-class>
  • Put your javascipt files to src/main/webapp/VAADIN/themes/myRealProjectTheme/js/

  • now you can run your project with this command:


mvn clean package jetty:run

I hope explain my solution :slight_smile: If you have a question about this issue please add comment. I try to help you…

Gr,
Emir

I wrote a blog for this issue. May be someone needs to this post.

http://kodmanyagha.org/blog/compile-and-use-vaadin-6-addons-1/