Thread Locked This thread is locked - replies are not allowed.



Permlink Replies: 29 - Pages: 2 [ 1 2 | Next ] - Last Post: 05-Jun-2020 15:33 Last Post By: davidekholm Threads: [ Previous | Next ]
davidekholm

Posts: 3,322
Registered: 18-Oct-2002
jAlbum 20.2 for testing
Posted: 28-May-2020 18:27
Hi,

Working on jAbum 20.2 here. One addition I assume will be appreciated is the addition of a user preference to remember the last selected item between sessions. No need to navigate down large folder trees to return to the location you were at last time.

The second change tries to once-and-for-all resolve a common problem users are facing when adding custom skin specific pages (Usually Turtle pages) to a project and then switching skins. This has the effect of feeding code made for one skin to another skin and it's bound to cause nasty error messages and leave users in a helpless state.

The best solution is naturally to not store skin specific template pages within the project. They should belong to the skin, just like "index.htt" and "slide.htt" does. It's however intuitive to be able to add "pages", for instance "About.htt" to a desired location within your project, just like you add other items. To resolve this I've created a new flavor of links that resolves dynamically towards different target files as you switch skins, so just go ahead and add pages like before. The only difference you'll notice is the small link icon next to the template page. Hovering on the "i" icon will reveal the current target, for instance
/Users/david/Library/JAlbum/skins/Tiger/templates/About.htt
Now switch skin to PhotoBlogger for instance, the target now switches automatically to
/Users/david/Library/JAlbum/skins/PhotoBlogger/templates/About.htt
. Nifty, isn't it? Looking under the hood, at .jalbum/albumfiles.txt you'll see the "dynamic path", these links have:
About.htt	$SKIN_TEMPLATES_DIR/About.htt	1590662705

(this is naturally nothing the ordinary user needs to know, but I figure you'd like to know how it works)

The beta can be tested by replacing lib/jalbum-core.jar with this one: http://jalbum.net/download/beta/jalbum-core.jar
What do you think?

Edited by: jGromit on 05-Jun-2020 09:32, to remove link to a train wreck.
RobM

Posts: 3,266
Registered: 4-Aug-2006
Re: jAlbum 20.2 for testing
Posted: 28-May-2020 18:44   in response to: davidekholm in response to: davidekholm
What about custom/renamed pages? Maybe they should be excluded and a warning message saying to try them individually to ensure they work.

Another option is to include a code checked version of my Update Project templates.
JeffTucker

Posts: 6,979
Registered: 31-Jan-2006
Re: jAlbum 20.2 for testing
Posted: 28-May-2020 18:50   in response to: davidekholm in response to: davidekholm
It seems fairly robust, and it does get rid of the dreaded crashes.

Switching to a skin that doesn't support template files leads to a "red X" object, which is probably the best it can do. I wouldn't want the core to delete the About.htt, for example - an accidental switch to the wrong skin shouldn't produce that kind of loss of content in the associated About.htt.info file. So, the user can manually delete the now-useless About.htt.

The only odd result occurs if you switch to a skin that does have its own About.htt (for example), but uses completely different variables within it. That yields an About page that might seem to be lacking its content. That's another one that I don't think can be avoided.

As long as switching between the bundled skins always yields a working page, with the same "stuff" on it (titles, text, images, etc.), that should take care of most cases. That does require, of course, that any changes to the templates for additional pages will have to be carefully coordinated across the bundled skins.
davidekholm

Posts: 3,322
Registered: 18-Oct-2002
Re: jAlbum 20.2 for testing
Posted: 28-May-2020 19:08   in response to: RobM in response to: RobM
RobM wrote:
What about custom/renamed pages? Maybe they should be excluded and a warning message saying to try them individually to ensure they work.

jAlbum doesn't get fooled by renaming pages. It keeps a property pointing to the original file.
davidekholm

Posts: 3,322
Registered: 18-Oct-2002
Re: jAlbum 20.2 for testing
Posted: 28-May-2020 19:09   in response to: JeffTucker in response to: JeffTucker
jGromit wrote:
It seems fairly robust, and it does get rid of the dreaded crashes.

:-)

As long as switching between the bundled skins always yields a working page, with the same "stuff" on it (titles, text, images, etc.), that should take care of most cases. That does require, of course, that any changes to the templates for additional pages will have to be carefully coordinated across the bundled skins.

Correct
davidekholm

Posts: 3,322
Registered: 18-Oct-2002
Re: jAlbum 20.2 for testing
Posted: 28-May-2020 19:16   in response to: davidekholm in response to: davidekholm
You can try v20.2b3 now. This version also addresses old template page copies (usually from Turtle) by copying the corresponding new template page to the project instead. This is done during album making. This should remove errors when moving from Turtle to Tiger or other modern skins made by Laza. In case users have made edits to these skin specific template pages, a ".bak" backup file is stored next to the updated file (hidden and ignored within jAlbum, but can be retrieved via the file system).

With this, I hope we can put an end to one on the top-3 errors people encounter when moving from old to new skins.

I also attach an updated "Sample Portfolio" project that uses these new dynamic link references for the "About.htt" and "Contact.htt" pages. I enjoy making albums using various page-supporting skins, like Tiger, PhotoBlogger and Story and seeing the page design of "About" and "Contact" update accordingly - and no errors. :-)
davidekholm

Posts: 3,322
Registered: 18-Oct-2002
Re: jAlbum 20.2 for testing
Posted: 28-May-2020 19:24   in response to: RobM in response to: RobM
RobM wrote:

Another option is to include a code checked version of my Update Project templates.

Good tool. I missed that one, but so will 99% of users affected by this problem do too. I therefore think that the built-in auto-update code of jAlbum 20.2 will be more useful.
RobM

Posts: 3,266
Registered: 4-Aug-2006
Re: jAlbum 20.2 for testing
Posted: 28-May-2020 22:12   in response to: davidekholm in response to: davidekholm
It might be best to inhibit the repair link contextual menu option as it can lead to a crash and no red X over the thumbnail on subsequent skin changes or restarting of jAlbum. Granted this is doing something most would not think sensible, but that is what some do do.

Open Polyglot skin and add the 'recent-items' template.
Make the album then switch to Tiger.
Hover over the broken link and click more, now select 'Repair link'.
Navigate to PolyGlot skin>Templates>recent-items.htt and click open.
The red cross has gone, but double clicking the thumbnail does not open the UI for it.
Warning triangle appears with error
Exception in thread "AWT-EventQueue-0" bsh.InterpreterError: Error in class initialization: bsh.TargetError: Typed variable declaration : Method Invocation texts.getString : at Line: 3 : in file: inline evaluation of: `` 	class NewItemsUI extends JWebPageUI { 		JCheckBox showPages = new JCheckBox(te . . . '' : texts .getString ( "ui.newItemsShowPages" ) 
 
Target exception: java.util.MissingResourceException: Can't find resource for bundle se.datadosen.util.SmartResourceBundle, key ui.newItemsShowPages
 
	at bsh.ClassGeneratorUtil.initInstance(ClassGeneratorUtil.java:968)
	at NewItemsUI.<init>(BeanShell Generated via ASM (www.objectweb.org))
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source)
	at java.base/java.lang.reflect.ReflectAccess.newInstance(Unknown Source)
	at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(Unknown Source)
	at java.base/java.lang.Class.newInstance(Unknown Source)
	at se.datadosen.explorer.JEditPanel.updateImage(JEditPanel.java:920)
	at se.datadosen.explorer.JEditPanel.refreshUI(JEditPanel.java:731)
	at se.datadosen.explorer.JEditPanel.setAO(JEditPanel.java:343)
	at se.datadosen.explorer.JAlbumExplorer.lambda$setEditView$29(JAlbumExplorer.java:3946)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
Caused by: bsh.TargetError: Typed variable declaration : Method Invocation texts.getString : at Line: 3 : in file: inline evaluation of: `` 	class NewItemsUI extends JWebPageUI { 		JCheckBox showPages = new JCheckBox(te . . . '' : texts .getString ( "ui.newItemsShowPages" ) 
 
Target exception: java.util.MissingResourceException: Can't find resource for bundle se.datadosen.util.SmartResourceBundle, key ui.newItemsShowPages
 
	at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:97)
	at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:102)
	at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:47)
	at bsh.BSHArguments.getArguments(BSHArguments.java:65)
	at bsh.BSHAllocationExpression.objectAllocation(BSHAllocationExpression.java:81)
	at bsh.BSHAllocationExpression.eval(BSHAllocationExpression.java:62)
	at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:102)
	at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:47)
	at bsh.BSHVariableDeclarator.eval(BSHVariableDeclarator.java:86)
	at bsh.BSHTypedVariableDeclaration.eval(BSHTypedVariableDeclaration.java:84)
	at bsh.BSHBlock.evalBlock(BSHBlock.java:130)
	at bsh.ClassGeneratorUtil.initInstance(ClassGeneratorUtil.java:966)
	... 25 more
Caused by: java.util.MissingResourceException: Can't find resource for bundle se.datadosen.util.SmartResourceBundle, key ui.newItemsShowPages
	at se.datadosen.util.SmartResourceBundle.getObject(SmartResourceBundle.java:105)
	at se.datadosen.util.SmartResourceBundle.getString(SmartResourceBundle.java:62)
	at jdk.internal.reflect.GeneratedMethodAccessor78.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at bsh.Reflect.invokeMethod(Reflect.java:146)
	at bsh.Reflect.invokeObjectMethod(Reflect.java:79)
	at bsh.Name.invokeMethod(Name.java:859)
	at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:75)
	... 36 more

Click Make album and you get this error
An unexpected error occurred. Please see detailed description below:
 
java.lang.RuntimeException: Error processing /Users/robert/My Albums/Sample Portfolio for templates/recent-Items.htt -> /Users/robert/Library/JAlbum/skins/PolyGlot/templates/recent-Items.htt
	at se.datadosen.jalbum.AlbumBean.registerVariables(AlbumBean.java:2447)
	at se.datadosen.jalbum.AlbumBean$RegisteringTask.call(AlbumBean.java:5749)
	at se.datadosen.jalbum.AlbumBean$RegisteringTask.call(AlbumBean.java:5730)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: bsh.InterpreterError: Error in class initialization: bsh.TargetError: Typed variable declaration : Method Invocation texts.getString : at Line: 3 : in file: inline evaluation of: `` 	class NewItemsUI extends JWebPageUI { 		JCheckBox showPages = new JCheckBox(te . . . '' : texts .getString ( "ui.newItemsShowPages" ) 
 
Target exception: java.util.MissingResourceException: Can't find resource for bundle se.datadosen.util.SmartResourceBundle, key ui.newItemsShowPages
 
	at bsh.ClassGeneratorUtil.initInstance(ClassGeneratorUtil.java:968)
	at NewItemsUI.<init>(BeanShell Generated via ASM (www.objectweb.org))
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source)
	at java.base/java.lang.reflect.ReflectAccess.newInstance(Unknown Source)
	at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(Unknown Source)
	at java.base/java.lang.Class.newInstance(Unknown Source)
	at se.datadosen.jalbum.AlbumBean.registerVariables(AlbumBean.java:2371)
	... 6 more
Caused by: bsh.TargetError: Typed variable declaration : Method Invocation texts.getString : at Line: 3 : in file: inline evaluation of: `` 	class NewItemsUI extends JWebPageUI { 		JCheckBox showPages = new JCheckBox(te . . . '' : texts .getString ( "ui.newItemsShowPages" ) 
 
Target exception: java.util.MissingResourceException: Can't find resource for bundle se.datadosen.util.SmartResourceBundle, key ui.newItemsShowPages
 
	at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:97)
	at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:102)
	at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:47)
	at bsh.BSHArguments.getArguments(BSHArguments.java:65)
	at bsh.BSHAllocationExpression.objectAllocation(BSHAllocationExpression.java:81)
	at bsh.BSHAllocationExpression.eval(BSHAllocationExpression.java:62)
	at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:102)
	at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:47)
	at bsh.BSHVariableDeclarator.eval(BSHVariableDeclarator.java:86)
	at bsh.BSHTypedVariableDeclaration.eval(BSHTypedVariableDeclaration.java:84)
	at bsh.BSHBlock.evalBlock(BSHBlock.java:130)
	at bsh.ClassGeneratorUtil.initInstance(ClassGeneratorUtil.java:966)
	... 15 more
Caused by: java.util.MissingResourceException: Can't find resource for bundle se.datadosen.util.SmartResourceBundle, key ui.newItemsShowPages
	at se.datadosen.util.SmartResourceBundle.getObject(SmartResourceBundle.java:105)
	at se.datadosen.util.SmartResourceBundle.getString(SmartResourceBundle.java:62)
	at jdk.internal.reflect.GeneratedMethodAccessor78.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at bsh.Reflect.invokeMethod(Reflect.java:146)
	at bsh.Reflect.invokeObjectMethod(Reflect.java:79)
	at bsh.Name.invokeMethod(Name.java:859)
	at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:75)
	... 26 more


Change projects and/or quit jAlbum then reopen the project - no red x on the link but you will get a crash again on make album.
davidekholm

Posts: 3,322
Registered: 18-Oct-2002
Re: jAlbum 20.2 for testing
Posted: 28-May-2020 22:30   in response to: RobM in response to: RobM
Hi Rob,
I could possibly detect that a template page is made for another skin than the current one and simply ignore it in such cases. This said, I think we reduce this problem from a common one to a very rare one with the changes already implemented. I think there is a point in allowing users to convert links to real files in case they wish to make minor modifications to the page. By doing so, they are expected to know more about the side effects, for instance that that page might not work with all skins. 99% of our users won't naturally even convert these links to real files.
JeffTucker

Posts: 6,979
Registered: 31-Jan-2006
Re: jAlbum 20.2 for testing
Posted: 28-May-2020 22:35   in response to: RobM in response to: RobM
Even just double-clicking on the "red X" template file puts you in a strange place, starting navigation with This PC, the root of the hard drive.

David, it's not a question of converting a link to a copy - it's just that the normal response to a "red X" object is to double-click it, and navigate to its current location. That's how you fix broken links. So, this probably needs to be handled as a special case. A "red X" template file should respond with something like "There is no such template in the currently-selected skin."
RobM

Posts: 3,266
Registered: 4-Aug-2006
Re: jAlbum 20.2 for testing
Posted: 28-May-2020 22:48   in response to: davidekholm in response to: davidekholm
Another little oddity, clicking on the ā€˜Iā€™ info icon of template link does nothing.
RobM

Posts: 3,266
Registered: 4-Aug-2006
Re: jAlbum 20.2 for testing
Posted: 29-May-2020 00:00   in response to: RobM in response to: RobM
With this change, the advice on editing page templates needs to change, as now any edits to linked templates are edits to the skin files, not copies. So editing templates should be discouraged, presumably?

Also, empty pages are added as actual files, not links as they need to be unique files. But then user created pages could cause crashes when changing skin as they may contain skin specific variables.

JeffTucker

Posts: 6,979
Registered: 31-Jan-2006
Re: jAlbum 20.2 for testing
Posted: 29-May-2020 00:44   in response to: RobM in response to: RobM
RobM wrote:
So editing templates should be discouraged, presumably?

As is true when it comes to editing any skin template files, the advice should steer users towards making their own copies of things, and fiddling with the copies. Don't like the skin's About page? No problem - make a copy and treat it like a custom page.
RobM

Posts: 3,266
Registered: 4-Aug-2006
Re: jAlbum 20.2 for testing
Posted: 29-May-2020 00:51   in response to: JeffTucker in response to: JeffTucker
jGromit wrote:
RobM wrote:
So editing templates should be discouraged, presumably?

As is true when it comes to editing any skin template files, the advice should steer users towards making their own copies of things, and fiddling with the copies. Don't like the skin's About page? No problem - make a copy and treat it like a custom page.

That was easy before, now you either have to copy the file from the skin folder or (not tried yet) convert the link to a copy - Either way it is defeating the point of making templates links.
JeffTucker

Posts: 6,979
Registered: 31-Jan-2006
Re: jAlbum 20.2 for testing
Posted: 29-May-2020 00:55   in response to: RobM in response to: RobM
Unfortunately, copying the object results in a copy that's also pointing to the original page template in the skin directory.

Glad I don't have to sort out any of this. My skins don't support page templates, and almost certainly never will.
Legend
Forum admins
Helpful Answer
Correct Answer

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