This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 8 - Pages: 1 - Last Post: 01-Feb-2008 20:51 Last Post By: Laza
gero

Posts: 24
Registered: 10/07/07
7.4: Cannot access variable in .jad file anymore from index.htt/slide.htt
Posted: 29-Jan-2008 21:00
 
  Click to reply to this thread Reply
Hi,

As described in an earlier post (http://jalbum.net/forum/thread.jspa?messageID=148716) I tweaked the Chameleon skin a bit such that it includes a map on the same page as the photo's (instead of a separate popup window). As part of this I added a couple of variables to the albums jad file like this:
skin.webroot=/webalbums/tycho
skin.map.iframe=http://gerodt.homeip.net/webalbums/googlemap.html

In the slide.htt I was able to access the last variable using:
String iFrameUrl = current.get("map.iframe");

And in the index.htt I accessed the webroot using:
String webRoot = fileVariables.get(files[0]).get("webroot");

Since version 7.4 of JAlbum this does not work anymore. Any clues on how I can access these variables from within the htt files? I already checked if they are included in the meta, application and album maps, but they are not.

Any suggestions are appreciated.

Thanks,
Gero
davidekholm

Posts: 21,253
Registered: 10/18/02
Re: 7.4: Cannot access variable in .jad file anymore from index.htt/slide.h
Posted: 30-Jan-2008 11:44   in response to: gero in response to: gero
 
  Click to reply to this thread Reply
Hi. I've moved this to the Chameleon section so you can get help from the Chameleon author.
gero

Posts: 24
Registered: 10/07/07
Re: 7.4: Cannot access variable in .jad file anymore from index.htt/slide.h
Posted: 30-Jan-2008 11:55   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Ok, but I wonder if it is a Chameleon problem. The way you access JAlbum variables in the htt files is the same for all skins isn't it?

Thanks,
Gero
Laza

Posts: 9,377
Registered: 09/06/05
Re: 7.4: Cannot access variable in .jad file anymore from index.htt/slide.h
Posted: 30-Jan-2008 17:58   in response to: gero in response to: gero
 
  Click to reply to this thread Reply
I'm not sure this helps, but Chameleon gets Objects the following way:

	public Object getVarAsObject(String name) {
		Object result;
		
		if ((result = get(name)) == null) {
			if (engine.getSkinVariables().containsKey(name))
				result = engine.getSkinVariables().get(name);
			else
				result = engine.getUserVariables().get(name);
		}
			
		return result;
	}


It tries to retrieve the variable first from the current namespace then from Skin variables and finally from User variables. Try to use this function, and tell me if that helps.

String iFrameUrl = chameleon.getVarAsString("map.iframe");
gero

Posts: 24
Registered: 10/07/07
Re: 7.4: Cannot access variable in .jad file anymore from index.htt/slide.h
Posted: 01-Feb-2008 13:45   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
Thanks, I tried the suggestion but could not get to to work.

In the slide.htt file I dumped engine.getSkinVariables() and engine.getUserVariables() to the generated HTML page and although I does dump a lot of variables, these do not include the variables that I manually added to the JAD file.
There was however one part of the suggestion that I failed to use. In the first if you do a "if ((result = get(name)) == null) ", the get() in on the current object, but what is this object? Maybe I can retrieve this object from the 'engine' and then invoke the get() on it.

Otherwise it looks like the change from 7.3 -> 7.4 of JAlbum changes something in the way the JAD file properties are read in differently and only 'known' properties are included in the collections.... So I hope that I can invoke the 'get' method directly and get the property...

Regards,
Gero
gero

Posts: 24
Registered: 10/07/07
Re: 7.4: Cannot access variable in .jad file anymore from index.htt/slide.h
Posted: 01-Feb-2008 19:42   in response to: gero in response to: gero
 
  Click to reply to this thread Reply
By the way, I also tried chameleon.getVarAsString("map.iframe") and a couple of variations on this but in all cases it returns an empty string as result. (getVarAsObject returns null).

Gero
gero

Posts: 24
Registered: 10/07/07
Re: 7.4: Cannot access variable in .jad file anymore from index.htt/slide.h
Posted: 01-Feb-2008 20:24   in response to: gero in response to: gero
 
  Click to reply to this thread Reply
Found the solution ;-)

In the JAD file I prefixed my ow variables with 'user' instead of 'skin' (for example user.map.iframe) and now I can access them using the chameleon.getVarAsString("map.iframe").

Gero
Laza

Posts: 9,377
Registered: 09/06/05
Re: 7.4: Cannot access variable in .jad file anymore from index.htt/slide.h
Posted: 01-Feb-2008 20:50   in response to: gero in response to: gero
 
  Click to reply to this thread Reply
It seems that JAlbum doesn't has that variable.

The code I inserted is working in the Chameleon class. When get is used without an implicit object I guess it applies to the current class and the classes it extends.
Laza

Posts: 9,377
Registered: 09/06/05
Re: 7.4: Cannot access variable in .jad file anymore from index.htt/slide.h
Posted: 01-Feb-2008 20:51   in response to: gero in response to: gero
 
  Click to reply to this thread Reply
Great!
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums