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


Permlink Replies: 24 - Pages: 2 [ 1 2 | Next ] - Last Post: 06-Sep-2017 15:49 Last Post By: jGromit Threads: [ Previous | Next ]
jGromit

Posts: 33,194
Registered: 31-Jan-2006
Repeatable item in JDraggableList()
Posted: 03-Sep-2017 14:22
 
  Click to reply to this thread Reply
I've started to tinker with using JDraggableList() in my skin UI's. One thing that I'm not sure how to handle is what I'll call "spacers." For some of my caption stuff, my skins let the user put some space between, for example, an image counter and the title/comment. I don't do it with a simple HTML break, because that's usually too much space. I do it with a little spacer div in the CSS, maybe just 10px tall, or with some strategically-placed margins.

In JDraggableList(), it would be nice to be able to include a spacer in the "available" list. But as it now stands, you can use it only once - it then moves from "available" to "used." It would be helpful if JDraggableList() had the option to include a repeatable item, something that appears only once in the "available" list, but can be added multiple times to the "used" list.

A lot of toolbar customization routines in other applications allow for this, particularly when it comes to things like spacers and separators, so you can group your toolbar icons. So, this mechanism would be familiar to most users, I think.
jGromit

Posts: 33,194
Registered: 31-Jan-2006
Re: Repeatable item in JDraggableList()
Posted: 03-Sep-2017 22:15   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
Attachment ss003205.png (70,0 KB)
Just to clarify what I'm talking about, in terms of the result, here's a screenshot from Matrix. Show the title, show the comment, show an image counter, but leave some breathing space above the counter. This is where a user could select a spacer from the JDraggableList "available" column. But he might want also to use a spacer between the title and comment, hence the need to be able to select it multiple times.
jGromit

Posts: 33,194
Registered: 31-Jan-2006
Re: Repeatable item in JDraggableList()
Posted: 03-Sep-2017 22:25   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
Attachment ss003207.png (3,3 KB)
And here's what the UI might look like to produce that. Note that [Spacer] is still available for additional use (this is dummied up, of course).
jGromit

Posts: 33,194
Registered: 31-Jan-2006
Re: Repeatable item in JDraggableList()
Posted: 03-Sep-2017 22:33   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
The question has arisen - should this be available item-by-item, or for the entire list? I would vote for item-by-item. Normally, you wouldn't want things like title and comment to be infinitely reusable. Again, I refer back to a lot of the toolbar customization in other apps. You can drag the "delete" icon in an email client to the toolbar, but only once - it then disappears from the "available" list. However, you can drag a spacer or separator to that toolbar as many times as you like.

The code might look something like this, with a simple boolean indicating whether the item is reusable:
JDraggableList thumbnailItems = new JDraggableList(new Object[] {
	new Item("fileTitle", "Title", 0),
	new Item("comment", "Comment", 0),
	new Item("counter", "Counter", 0),
	new Item("label", "Base name", 0),
	new Item("fileName", "File name", 0),
	new Item("spacer", "[Spacer]", 1)			
}, new String[] { "fileName" } );
RobM

Posts: 4,383
Registered: 4-Aug-2006
Re: Repeatable item in JDraggableList()
Posted: 04-Sep-2017 00:58   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
A repeatable item would be a nice addition, making it functionally better.
Maybe a 'reset' option would be of use too, letting users quickly return the selected list back to the default setting.
davidekholm

Posts: 21,475
Registered: 18-Oct-2002
Re: Repeatable item in JDraggableList()
Posted: 04-Sep-2017 12:03   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
Attachment Minimal.jaskin (77,5 KB)
I've updated the JDraggableList to allow multiple items if you specify a last "allowDuplicates" parameter to true. Its "backing"/secondary list is then fixed/static, i.e. you can only drag items from it, and once dragged, the original stays in place.

I am aware that this list-wide allowance of duplicates means that you can have multiples of any item, but the usage is very straight forward and implementing it on a per-item basis would require adjusting several other API classes (the JDraggableList not only allows Item objects, but also plain strings, Integers and even Swing components).

Do a core update to 14.1.11 in order to get hold of this new functionality. The attached Minimal skin is adjusted to use this list type.
jGromit

Posts: 33,194
Registered: 31-Jan-2006
Re: Repeatable item in JDraggableList()
Posted: 04-Sep-2017 13:52   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
A pity that it can't be done on a per-item basis, but this is certainly workable. I'll do some more tinkering....
jGromit

Posts: 33,194
Registered: 31-Jan-2006
Re: Repeatable item in JDraggableList()
Posted: 04-Sep-2017 15:21   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
On my Mac, I can't load the new Minimal. I've done the core update to 14.1.11, and installed the new Minimal from the post above, but I'm getting this dump when trying to select the skin:
Stack trace for jAlbum 14.1.11 using skin Minimal 7.1.2:
 
se.datadosen.util.ScriptException: bsh.EvalError: Sourced file: inline evaluation of: ``/*   * This script is run when a skin is selected.   * The script produces the u . . . '' : Typed variable declaration : Error constructing inner class instance: java.lang.reflect.InvocationTargetException : at Line: 20 : in file: inline evaluation of: ``/*   * This script is run when a skin is selected.   * The script produces the u . . . '' : new ControlPanel ( ) { 
 in onload.bsh at line number 20
	at se.datadosen.util.ScriptException.of(ScriptException.java:58)
	at se.datadosen.jalbum.AlbumBean.processScript(AlbumBean.java:2356)
	at se.datadosen.jalbum.JAlbumFrame.executeScript(JAlbumFrame.java:1234)
	at se.datadosen.jalbum.JMainSettingsPanel$5$1.run(JMainSettingsPanel.java:297)
Edit: I've narrowed it down. It happens both in Windows and macOS, but only with the Nimbus look-and-feel. All of the others seem to be OK.

Edited by: jGromit on 04-Sep-2017 09:39
davidekholm

Posts: 21,475
Registered: 18-Oct-2002
Re: Repeatable item in JDraggableList()
Posted: 04-Sep-2017 17:19   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
Now fixed. Please do a core update again.
jGromit

Posts: 33,194
Registered: 31-Jan-2006
Re: Repeatable item in JDraggableList()
Posted: 04-Sep-2017 17:29   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
Now fixed. Please do a core update again.

Yes, that's more like it. :)

Could have been quite a while before anyone stumbled on that one. I default to Nimbus on my Mac because the default L&F makes such a mess of the settings tabs. Nimbus does a better job of it than the others. Darcula also does a good job with the tabs. The others, not so much.
davidekholm

Posts: 21,475
Registered: 18-Oct-2002
Re: Repeatable item in JDraggableList()
Posted: 04-Sep-2017 17:43   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
I wondered how you discovered it. I very rarely use Nimbus these days.

BeanShell's error reporting really sucks, that is when errors happen in Java code called from BeanShell. It wasn't that bad earlier, but since we switched to using the script language neutral javax.script API one loses the original error :-(

Oracle, please make a true scripted Java!
RobM

Posts: 4,383
Registered: 4-Aug-2006
Re: Repeatable item in JDraggableList()
Posted: 04-Sep-2017 22:40   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
Attachment onload.bsh (7,3 KB)
RobM wrote:
Maybe a 'reset' option would be of use too, letting users quickly return the selected list back to the default setting.
Couldn't resist having a go. The attached onload.bsh is modified from the Minimal skin posted above. It offers a reset list, clear all from list and add all to the list.
jGromit

Posts: 33,194
Registered: 31-Jan-2006
Re: Repeatable item in JDraggableList()
Posted: 04-Sep-2017 23:59   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
The attached Minimal skin....

I note with approval the change in the default thumbnail captioning. No one wants to see DSC_0437.JPG as a caption. The Title is a much more sensible choice. ;)
davidekholm

Posts: 21,475
Registered: 18-Oct-2002
Re: Repeatable item in JDraggableList()
Posted: 05-Sep-2017 11:26   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
RobM wrote:
Maybe a 'reset' option would be of use too, letting users quickly return the selected list back to the default setting.
Couldn't resist having a go. The attached onload.bsh is modified from the Minimal skin posted above. It offers a reset list, clear all from list and add all to the list.

Nice :-). I have the feeling we'll be seeing some usage of this component in your skins soon. Also check out the updated .small() method that gets you a visually smaller version of these lists. Just add .small() to the constructor call to try it out.
davidekholm

Posts: 21,475
Registered: 18-Oct-2002
Re: Repeatable item in JDraggableList()
Posted: 05-Sep-2017 11:32   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
jGromit wrote:
davidekholm wrote:
The attached Minimal skin....

I note with approval the change in the default thumbnail captioning. No one wants to see DSC_0437.JPG as a caption. The Title is a much more sensible choice. ;)


This change was naturally only done to a test fork of Minimal ;-D. Anyway, I see the point in not having filenames as default so I'll change the default for the next version too.
Legend
Forum admins
Helpful Answer
Correct Answer

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