Automatic GWT ClientBundles based on files on disk

I am currently using GWT ClientBundles in my application. It works fine, but I have a lot of resources, and it becomes tedious to manually create Java interfaces for each file:

@ClientBundle.Source("world_war_ii.txt")
public ExternalTextResource worldWarII();

@ClientBundle.Source("spain.txt")
public ExternalTextResource spain();

@ClientBundle.Source("france.txt")
public ExternalTextResource france();

I would like to be able (possibly at compile time) to dynamically list each * .txt file in a given directory and then have access to them at runtime, perhaps as an array ExternalTextResource[], and not have to explicitly list them in my code. There may be hundreds of such resources and listing them manually, as the code will be very painful and too heavy.

The documentation ClientBundleclearly says that “providing an abstraction of the file system” is inappropriate, so unfortunately this seems to prohibit what I'm trying to do.

What is the best way to handle the large amount of external resources that should be available at runtime? Would a generator help?

+3
source share
2 answers

I ended up with this tip : perform file operations on the server, and then return the list of files (meta) via an RPC call.

, ( ) , Tree; TreeItem, .

0

CssResource - , ?

+1

Source: https://habr.com/ru/post/1768733/


All Articles