|
Replies:
24
-
Pages:
2
[
1
2
| Next
]
-
Last Post:
6 Sep 17, 15:49
Last Post By: JeffTucker
|
|
|
Posts:
8,213
Registered:
31-Jan-2006
|
|
|
Repeatable item in JDraggableList()
Posted:
3 Sep 17, 14:22
|
|
|
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.
|
|
|
Posts:
8,213
Registered:
31-Jan-2006
|
|
|
Re: Repeatable item in JDraggableList()
Posted:
3 Sep 17, 22:15
in response to: JeffTucker
|
|
|
|
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.
|
|
|
Posts:
8,213
Registered:
31-Jan-2006
|
|
|
Re: Repeatable item in JDraggableList()
Posted:
3 Sep 17, 22:25
in response to: JeffTucker
|
|
|
|
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).
|
|
|
Posts:
8,213
Registered:
31-Jan-2006
|
|
|
Re: Repeatable item in JDraggableList()
Posted:
3 Sep 17, 22:33
in response to: JeffTucker
|
|
|
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" } );
|
|
|
Posts:
3,818
Registered:
4-Aug-2006
|
|
|
Re: Repeatable item in JDraggableList()
Posted:
4 Sep 17, 00:58
in response to: JeffTucker
|
|
|
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.
|
|
|
Posts:
3,473
Registered:
18-Oct-2002
|
|
|
Re: Repeatable item in JDraggableList()
Posted:
4 Sep 17, 12:03
in response to: RobM
|
|
|
|
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.
|
|
|
Posts:
8,213
Registered:
31-Jan-2006
|
|
|
Re: Repeatable item in JDraggableList()
Posted:
4 Sep 17, 13:52
in response to: davidekholm
|
|
|
A pity that it can't be done on a per-item basis, but this is certainly workable. I'll do some more tinkering....
|
|
|
Posts:
8,213
Registered:
31-Jan-2006
|
|
|
Re: Repeatable item in JDraggableList()
Posted:
4 Sep 17, 15:21
in response to: JeffTucker
|
|
|
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
|
|
|
Posts:
3,473
Registered:
18-Oct-2002
|
|
|
Re: Repeatable item in JDraggableList()
Posted:
4 Sep 17, 17:19
in response to: JeffTucker
|
|
|
Now fixed. Please do a core update again.
|
|
|
Posts:
8,213
Registered:
31-Jan-2006
|
|
|
Re: Repeatable item in JDraggableList()
Posted:
4 Sep 17, 17:29
in response to: davidekholm
|
|
|
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.
|
|
|
Posts:
3,473
Registered:
18-Oct-2002
|
|
|
Re: Repeatable item in JDraggableList()
Posted:
4 Sep 17, 17:43
in response to: JeffTucker
|
|
|
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!
|
|
|
Posts:
3,818
Registered:
4-Aug-2006
|
|
|
Re: Repeatable item in JDraggableList()
Posted:
4 Sep 17, 22:40
in response to: RobM
|
|
|
|
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.
|
|
|
Posts:
8,213
Registered:
31-Jan-2006
|
|
|
Re: Repeatable item in JDraggableList()
Posted:
4 Sep 17, 23:59
in response to: davidekholm
|
|
|
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.
|
|
|
Posts:
3,473
Registered:
18-Oct-2002
|
|
|
Re: Repeatable item in JDraggableList()
Posted:
5 Sep 17, 11:26
in response to: RobM
|
|
|
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.
|
|
|
Posts:
3,473
Registered:
18-Oct-2002
|
|
|
Re: Repeatable item in JDraggableList()
Posted:
5 Sep 17, 11:32
in response to: JeffTucker
|
|
|
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
|
|