Sample Source not found

Issue #779 new
Mo el
created an issue

when I open the FXsampler (controlsfx-sampes-8.40.12) I am able to see the sample however when I click on source I get prompted with "Sample Source not found"

Comments (13)

  1. noshio

    Just tryed the following in ControlsFXSamples.java:

        @Override public String getSampleSourceURL() {
            //return Utils.JAVADOC_BASE + "samples-src/" + getClass().getName().replace('.','/') + ".java";
                String a;
                a= "https://bitbucket.org/controlsfx/controlsfx/raw/aa053edb2d3bc03af6344dd576b74fac5e8ceb69/controlsfx-samples/src/main/java/"+ getClass().getName().replace('.','/') + ".java";
                System.out.println(a);
                return a;
        }
    

    and we can access the source code.

    As a temporary hack...it' apears to solve the problem, but it only goes to the default branch.

    we can return the String imediatly, without the 'a' thing..I was just testing it out. If we do not use the raw in the URL...we only get a bunch of HTML.

  2. John Schladenhauffen

    I actually rebuilt and reassembled the controlsfx-samples-8.40.14.jar and made 2 easy changes.

    1) In ControlsFXSamples.java change:

        @Override
        public String getSampleSourceURL() {
            //String sampleSourceURL = Utils.JAVADOC_BASE + "samples-src/" + getClass().getName().replace('.', '/') + ".java";
            //System.out.println("getSampleSourceURL() = " + sampleSourceURL);
            return "/" + getClass().getName().replace('.', '/') + ".java";
        }
    

    No need to go to the web for the sample source file as it already exists locally in the controlsfx-samples-8.40.14-sources.jar file.

    2) Modify the manifest file (MANIFEST.MF) in your rebuilt and reassembled the controlsfx-samples-8.40.14.jar to include this sources jar file in the path:

    Manifest-Version: 1.0
    Class-Path: controlsfx-8.40.14.jar fxsampler-1.0.10.jar controlsfx-sam
     ples-8.40.14-sources.jar
    Main-Class: org.controlsfx.ControlsFXSampler
    

    That should do it. The ControlsFX team should make this change in their build process to do this when they release the next update to ControlsFX.

    Personally I would like to thanks them for providing this awesome library free of charge and for all the work they do to keep us JavaFX programmers informed of what's going on in this area. Thanks you!

  3. John Schladenhauffen

    The other thing the ControlsFX team should do to the sample demo application is to modify the JavaDoc tab to load the JavaDoc from the local controlsfx-samples-8.40.14-javadoc.jar file vs. going to the web for it. Basically the sample demo application should work without an internet connection.

    To implement this functionality you would need to remove the getJavaDocURL() from each Hello sample application (there are many) and add the getJavaDocURL() method to the ControlsFXSamples class. The getJavaDocURL() method would resemble getSampleSourceURL() but return the reference to the local JavaDoc html file. You would need to make a similar modification to the manifest file (MANIFEST.MF) and add controlsfx-samples-8.40.14-javadoc.jar to the class path too.

    In my opinion making these changes would make the demo application easier to use.

    Cheers

  4. Abhinay Agarwal

    @John Schladenhauffen Your ideas are good and we need to find a way to achieve them in our build tool. There are potential problems that we need to overcome.

    Samples: We need to find a way to include controlsfx-sample-sources as a compile time dependency to the project. As far as I can tell, there is not straight forward way to do this since we are compiling the exact same project whose sources are required as dependency.

    A quick hack to copy all the java files from src/main/java into build resources directory. I did it in the processResources task and it seems to work.

    processResources {
        doLast {
            copy {
                from "src/main/java"
                into "$buildDir/resources/main"
            }
        }
    }
    

    Although, it has a side-effect - All java files will be added to the controlsfx-samples jar as well. I think we should be able to live with it if we copy all java files to an internal dedicated directory :)

    Javadoc: To achieve this requirement, we need to add controlsfx-javadoc as a compile time dependency and there seems to be no direct way (that I am aware of) to add a dependency to the "javadoc" jar.

    I am no expert at Gradle, but I see these as the potential hurdles to solving this issue.

  5. Log in to comment