Re: Chrome loader question
Ross Wetmore <[email protected]> Wed, 24 Sep 2003 13:29:55 -0400
| Newsgroups | gmane.comp.java.luxor-xul.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Denis
I can't remember if I made any significant tweak to any of the standard
Loader's in b8, but the code would be in the full example sent to the
mailing list in Feb. There was a caramel bugfix to fix jar access.
Snippets below show various ways I was able to make things work, with a
ChromeAnchor.java and all *.xul files buried in my standard tree/jarfile.
Cheers,
RossW
=====
run.sh:
[...]
# find out where your app is installed
APP_NAME=${APP_NAME:-"org.freeciv.client.ui.luxor.Civclient"}
APP_CHROME=${APP_CHROME:-"org.freeciv.client.ui.chrome.ChromeAnchor"}
APP_HOME="`dirname $0`"
APP_HOME="`cd $APP_HOME; pwd`"
$ECHO "TRACE : APP_HOME = $APP_HOME"
# run the app - several possible flavours for locating the chrome
# default, classpath anchor, specific directory, specific jar
#
# $JAVA -classpath "$classpath" \
# -DCHROME_ANCHOR="$APP_CHROME" \
# "$APP_NAME"
# $JAVA -classpath "$classpath" \
# -DCHROME_FILE="$APP_HOME/obj/classes/org/freeciv/client/ui/chrome" \
# "$APP_NAME"
# $JAVA -classpath "$classpath" \
# -DCHROME_JAR="$APP_HOME/dist/lib/clientGUI-1.0.jar" \
# "$APP_NAME"
$JAVA -classpath "$classpath" "$APP_NAME"
static main() application code:
[...]
// Suck up any XUL documents from designated places
XulManager xul = null;
try {
ChromeResourceLoader xrl = null;
Properties sysprops = System.getProperties();
String chrome;
if (null != (chrome = sysprops.getProperty("CHROME_FILE"))) {
File rootPath = new File(chrome);
xrl = new ChromeFileResourceLoader(rootPath);
} else
if (null != (chrome = sysprops.getProperty("CHROME_JAR"))) {
File rootPath = new File(chrome);
xrl = new ChromeJarResourceLoader(rootPath);
} else
if (null != (chrome = sysprops.getProperty("CHROME_ANCHOR", CHROME))) {
Class chromeAnchor = Class.forName(chrome);
xrl = new ChromeClassResourceLoader(chromeAnchor);
}
xul = XulManager.getXulManager();
xul.setResourceLoader(xrl);
xul.load();
} catch(Throwable t) {
System.out.println(NL+"*** Error: "+t.toString());
System.out.println(USAGE);
System.exit(1);
}
[...]
Gerald Bauer wrote:
> Hi Denis,
>
>
>>If I want to package my chrome files in the same
>>tree
>>as my java files, is there a Chrome Loader that is
>>fit
>>for the job? (that is to say the tree may be a plain
>>directory during develpement time, and will be a
>>signed jar for deployement).
>
>
> As far as I can tell you need to either switch a
> property to make it work or add a little check in your
> code before you setup the chrome loader.
>
> You might also wonna look into creating your own
> chrome loader or extentending the "standard" chrome
> loader. For a "custom" chrome loader in the wild you
> might wonna check out the SimpleChromeLoader source
> shipping with Luxilla.
>
>
>>Currently I always put my chromes in a separate jar,
>>even during developpement time, and always use the
>>ChromeJarResourceLoader. Ant make the process
>>straight
>>forward, but I think it could be easier, especially
>>for newbies. Any hint?
>
>
> Well, as far as I can tell you can use
> ChromeJarResourceLoader even if you pack up your xul
> files (chrome) in a single jar along with all your
> java classes.
>
> But you might wonna look into creating your own that
> uses a different directory structure and file filter
> and may configure itself using probing, for example.
>
> - Gerald
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> luxor-xul-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luxor-xul-user
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf