Permlink Replies: 10 - Pages: 1 - Last Post: 2 Nov 25, 21:32 Last Post By: davidekholm Threads: [ Previous | Next ]
davidekholm

Posts: 3,706
Registered: 18-Oct-2002
jAlbum 38.0.2 available as core update
Posted: 1 Nov 25, 16:40
  Click to reply to this thread Reply
jAlbum 38.0.2 is now available as a core update.

Changes:
  • Object counting through JAlbumUtilities.countCategories() now doesn't count objects under views
  • Fixed various issue with internal links. Now comments, keywords, and titles show through internal links. Editing any aspect of an internal link now edits the target
  • Implemented caching of the representing image for views in order to speed up the Explorer UI

Let me know if this behaves (does for me)
JeffTucker

Posts: 8,096
Registered: 31-Jan-2006
Re: jAlbum 38.0.2 available as core update
Posted: 1 Nov 25, 20:39   in response to: davidekholm in response to: davidekholm
  Click to reply to this thread Reply
davidekholm wrote:
  • Object counting through JAlbumUtilities.countCategories() now doesn't count objects under views

This causes horrendous problems in virtually all of my skins!

CSS is damaged, because I create the CSS conditionally. In other words, if there are no folders, I don't write out the CSS attributes for the folder classes. But a view creates folders. If the skin counts folders and gets "zero" as the response, common.css doesn't have the id's and classes needed to format those pages.

The same is true of navigation icons. For example, I don't create up.svg if there are no folders in the project. Again, a view creates folders, but now, the skin doesn't know they're present. So, a page in the view has no "up" icon. Broken album.
davidekholm

Posts: 3,706
Registered: 18-Oct-2002
Re: jAlbum 38.0.2 available as core update
Posted: 1 Nov 25, 20:59   in response to: JeffTucker in response to: JeffTucker
  Click to reply to this thread Reply
... perhaps the right approach is to count the folders within views but not double-count images that are just internal links?
JeffTucker

Posts: 8,096
Registered: 31-Jan-2006
Re: jAlbum 38.0.2 available as core update
Posted: 1 Nov 25, 21:08   in response to: davidekholm in response to: davidekholm
  Click to reply to this thread Reply
davidekholm wrote:
... perhaps the right approach is to count the folders within views but not double-count images that are just internal links?

That should do the trick. When I'm "counting" categories, I don't actually need to know how many of each type of object there are. I just need to know whether there are any. So, I'm checking to see if there are any videos in the project, any PDF's in the project, any webLocs in the project, etc. Internally linked objects aren't a problem, since their original objects satisfy the "are there any" tests.

But folders are different. A view is creating folders when there might not be any folders in the basic project.
JeffTucker

Posts: 8,096
Registered: 31-Jan-2006
Re: jAlbum 38.0.2 available as core update
Posted: 1 Nov 25, 21:22   in response to: davidekholm in response to: davidekholm
  Click to reply to this thread Reply
davidekholm wrote:
  • Fixed various issue with internal links. Now comments, keywords, and titles show through internal links. Editing any aspect of an internal link now edits the target

I can't test this, because I can no longer create internally-linked objects. If I add some JPG's to a new, empty project, create a folder called "Linked objects," then try to SHIFT-CTRL-drag an object into it, I get a weird result, and a console dump:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Null target for internal link /Linked objects/1896 Ford Quadricycle.jpg
	at se.datadosen.jalbum.InternalLinkAlbumObject.t(InternalLinkAlbumObject.java:41)
	at se.datadosen.jalbum.InternalLinkAlbumObject.getWhenAdded(InternalLinkAlbumObject.java:63)
	at se.datadosen.jalbum.FileAlbumObject.lambda$setChildren$0(FileAlbumObject.java:156)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
	at se.datadosen.jalbum.FileAlbumObject.setChildren(FileAlbumObject.java:156)
	at se.datadosen.jalbum.AlbumObjectImpl.add(AlbumObjectImpl.java:2177)
	at se.datadosen.jalbum.AlbumObjectImpl.add(AlbumObjectImpl.java:2076)
	at se.datadosen.explorer.JExplorerPanel.handleFileAdd(JExplorerPanel.java:1177)
	at se.datadosen.explorer.JExplorerPanel.handleJAlbumObjectDrop(JExplorerPanel.java:927)
	at se.datadosen.explorer.JExplorerPanel.drop(JExplorerPanel.java:812)
	at java.desktop/java.awt.dnd.DropTarget.drop(Unknown Source)
	at java.desktop/sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(Unknown Source)
	at java.desktop/sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEvent(Unknown Source)
	at java.desktop/sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(Unknown Source)
	at java.desktop/sun.awt.dnd.SunDropTargetEvent.dispatch(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.processDropTargetEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(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.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.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)
I'm also having trouble dragging multiple objects into a folder like that. If I mark five objects, then try to SHIFT-CTRL-drag all of them, I'm getting only one of the objects. I was seeing this before this beta core update, too.
davidekholm

Posts: 3,706
Registered: 18-Oct-2002
Re: jAlbum 38.0.2 available as core update
Posted: 1 Nov 25, 22:06   in response to: JeffTucker in response to: JeffTucker
  Click to reply to this thread Reply
Try 38.0.3. I was a bit too optimistic in a rewrite. Now, a more classic approach.
As for object counting, a view now also counts as a folder.
JeffTucker

Posts: 8,096
Registered: 31-Jan-2006
Re: jAlbum 38.0.2 available as core update
Posted: 1 Nov 25, 22:42   in response to: davidekholm in response to: davidekholm
  Click to reply to this thread Reply
davidekholm wrote:
Try 38.0.3. I was a bit too optimistic in a rewrite.

An experienced developer always has a ready supply of euphemisms. How to say, "I f*cked up," without actually admitting it. ;)

Now, a more classic approach.

Seems tight. Things like titles and comments are now reflected in newly-linked objects of all types, and changes to either original or linked copy are reflected in both. Still some refresh issues when doing weird stuff, like doing an "invert" image edit to an object - it straightens itself out after an F5, or leaving and re-entering the folder. So, that's a minor issue.

I just started messing with linking an entire folder, but there doesn't seem to be a direct way to create an internally-linked folder. Example: the top layer contains JPG's and a folder of More stuff. I create a new folder called Linked objects and drag internal links to the JPG's, But if I try to drag the More stuff folder into the Linked objects folder, I just get a regular link. So the output slide images include images in Linked objects/More stuff/slides, rather than pointers to a single set in root/slides. I probably just need more Scotch.

As for object counting, a view now also counts as a folder.

That has fixed the problems in my skins. Once again, TotalValidator to the rescue, which pointed me to the missing resource - didn't take me long to understand what was happening once I saw what was missing!

For the future, it would be handy to have some new API's for this kind of thing: anyImages(AlbumObject folder, boolean recursive), anyVideos(), anyFolders(), and so on. The counters are fine, but are really more than what's usually required.
davidekholm

Posts: 3,706
Registered: 18-Oct-2002
Re: jAlbum 38.0.2 available as core update
Posted: 2 Nov 25, 20:42   in response to: JeffTucker in response to: JeffTucker
  Click to reply to this thread Reply
As for APIs such as anyImages(AlbumObject folder, boolean recursive) and anyVideos(), I recommend using Java's streams API (not IO streams, but java.util.Stream), with that one you can write stuff like this:

Using AlbumObject's getChildren API:
boolean hasImages = !rootFolder.getChildren(Category.image).isEmpty()

Or, in a more generic way using the Stream API:

Checking for images in the root folder only:
boolean hasImages = rootFolder.children.stream().filter(ao -> ao.category == Category.image).findFirst().isPresent()

Checking for images under the current folder, and descendants:
boolean hasImages = currentFolder.descendants.stream().filter(ao -> ao.category == Category.image).findFirst().isPresent()


The stream API is lazy so it won't traverse the full folder tree. It will abort as soon as the findFirst() finds any match (nodes further down the stream triggers nodes upstream to deliver data).
davidekholm

Posts: 3,706
Registered: 18-Oct-2002
Re: jAlbum 38.0.2 available as core update
Posted: 2 Nov 25, 20:49   in response to: davidekholm in response to: davidekholm
  Click to reply to this thread Reply
v38.0.4 now available as a core update. This one sorts places alphabetically.
JeffTucker

Posts: 8,096
Registered: 31-Jan-2006
Re: jAlbum 38.0.2 available as core update
Posted: 2 Nov 25, 20:49   in response to: davidekholm in response to: davidekholm
  Click to reply to this thread Reply
I'm already using something like that to find out if there are any PDF's, since those don't have a category of their own:
anyPDF = rootFolder.descendants.stream().anyMatch(f -> f.name.toLowerCase().endsWith(".pdf"));
You fed me that code a while back. :)
davidekholm

Posts: 3,706
Registered: 18-Oct-2002
Re: jAlbum 38.0.2 available as core update
Posted: 2 Nov 25, 21:32   in response to: JeffTucker in response to: JeffTucker
  Click to reply to this thread Reply
Good. Even shorter :-)
Legend
Forum admins
Helpful Answer
Correct Answer

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