Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading and Updating scene customization #14

Closed
pablovilas opened this issue Jun 20, 2016 · 23 comments
Closed

Loading and Updating scene customization #14

pablovilas opened this issue Jun 20, 2016 · 23 comments

Comments

@pablovilas
Copy link

Hello Edvin,

I'm wondering if it's possible to customize the loading and updating scenes.
This is the default loading scene:

loading

and this is the updating scene:

updating

I think right now is possible to do some customization to the "updating" scene via app.xml. Would be awesome if we can provide both custom scenes or something like that.
Again, thanks.

@edvin
Copy link
Owner

edvin commented Jun 20, 2016

Absolutely. I'll add support for customizing it completely, but it will have to wait for some days, I need to finish another project first.

@edvin
Copy link
Owner

edvin commented Jun 20, 2016

In the mean time, you can customize some parts of the appearance in app.xml already:

<updateText>Updating...</updateText>
<updateLabelStyle>-fx-font-weight: bold;</updateLabelStyle>
<progressBarStyle>-fx-pref-width: 200;</progressBarStyle>
<wrapperStyle>-fx-spacing: 10; -fx-padding: 25;</wrapperStyle>

@pablovilas
Copy link
Author

Sure, no problem. Just let me know if you need some help with testing.

@edvin
Copy link
Owner

edvin commented Sep 9, 2016

Sorry for taking so long with this. My schedule is clearing up a bit, so I started looking at this now @pablovilas - do you think it would be adequate to let the user specify FXML-files to be used for the loading and updating-screens? I would then embed that FXML code inside the manifest. What do you think?

@pablovilas
Copy link
Author

Hello Edvin, no problem... I completely understand. It will be excelent if you let the user specify FXML or why not a Scene class also (If you have some dynamic controls creation inside).
Thanks!

@edvin
Copy link
Owner

edvin commented Sep 9, 2016

We could go for a complete scene graph, but that means embedding code inside the launcher as well. Might not be a big deal though, let me try it out and get back to you.

@edvin
Copy link
Owner

edvin commented Sep 9, 2016

It might be hard to determine which classes needs to go inside the launcher, in case of inner classes and such. I think that would have to be offloaded to the user, so you actually have to define the class, and also the path to any resources that should be embedded inside the launcher (in effect, all the classes needed)

@pablovilas
Copy link
Author

Maybe if we just add more customization options is enough. For example a custom splash background and more stylable options. What do you think?

@edvin
Copy link
Owner

edvin commented Sep 9, 2016

I have another idea: Create two interfaces that can be implemented for the two scenes and then you create a separate project where you include fxlaunchar.jar only as a compile time dependency. The result jar can be referenced from the createManifest step, where it is automatically embedded into the launcher. Should be pretty easy to use, and also easy to implement. Or is that too much?

@edvin
Copy link
Owner

edvin commented Sep 9, 2016

This actually means that we can clean up the default UI as well, by delivering it through this UIProvider interface:

public class DefaultUIProvider implements UIProvider {
    private ProgressBar progressBar;

    public Parent createLoader() {
        StackPane root = new StackPane(new ProgressIndicator());
        root.setPrefSize(200, 80);
        root.setPadding(new Insets(10));
        return root;
    }

    public Parent createUpdater(FXManifest manifest) {
        progressBar = new ProgressBar();
        progressBar.setStyle(manifest.progressBarStyle);

        Label label = new Label(manifest.updateText);
        label.setStyle(manifest.updateLabelStyle);

        VBox wrapper = new VBox(label, progressBar);
        wrapper.setStyle(manifest.wrapperStyle);

        return wrapper;
    }

    public void updateProgress(double progress) {
        progressBar.setProgress(progress);
    }
}

@edvin
Copy link
Owner

edvin commented Sep 9, 2016

This is the Interface as I imagine it:

public interface UIProvider {
    /**
     * Create the Node that will be displayed while the launcher is loading resources,
     * before the update process starts. The default implementation is an intdeterminate
     * progress indicator, but you can return any arbitrary scene graph.
     *
     * @return The launcher UI
     */
    Parent createLoader();

    /**
     * Create the Node that will be displayed while the launcher is updating resources.
     *
     * This Node should update it's display whenever the {@link #updateProgress(double)}
     * method is called.
     *
     * @see #updateProgress(double)
     * @return The updater Node
     */
    Parent createUpdater(FXManifest manifest);

    /**
     * Called when the update/download progress is changing. The progress is a value between
     * 0 and 1, indicating the completion rate of the update process.
     *
     * @param progress A number between 0 and 1
     */
    void updateProgress(double progress);
}

@pablovilas
Copy link
Author

I really like the idea of having interfaces but I'm not sure if creating another project it's a little too much. If we can only implement that interfaces inside the current project would be awesome but I think it's not possible because how fxlauncher works. Anyway it's an optional feauture so... you do that if you need to.

@edvin
Copy link
Owner

edvin commented Sep 9, 2016

Sure, it is absolutely possible to implement it inside the current project as well. Let me flesh this out and I'll show you :)

@pablovilas
Copy link
Author

Perfect!, please let me know if you need some help with testing

@edvin
Copy link
Owner

edvin commented Sep 9, 2016

I have it working, but it is cumbersome for the user to set it up. I want to think about this for a little while and try some other approaches first, OK? :)

@pablovilas
Copy link
Author

Sure, let me know if you need something.
Regards.

@edvin
Copy link
Owner

edvin commented Sep 9, 2016

Absolutely, thanks :)

@edvin
Copy link
Owner

edvin commented Sep 11, 2016

I landed on the UIProvider, almost like the one I pasted here:

https://www.youtube.com/watch?v=-6PlFVUgntU

I realise that it might be a bit cumbersome to inject the UI into the launcher, but it should just be a matter of copying the lines from the sample project into your build :)

@pablovilas
Copy link
Author

Great news!!, I'll try it tomorrow. Thanks!. 👏 👏

@edvin
Copy link
Owner

edvin commented Sep 11, 2016

Cool, let me know how it goes :)

@edvin edvin closed this as completed Sep 11, 2016
@pablovilas
Copy link
Author

I let you know! :). It's possible to create a new github release? so the maven release will match.
Again, Thanks.

@edvin
Copy link
Owner

edvin commented Sep 12, 2016

I totally forgot, thanks for reminding me. I drafted the release now.

@pablovilas
Copy link
Author

Thanks!!! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants