Hi,
Anybody a great idea for changing item order in a sorted set using the
wicket viewer? I have a rank-property in the database but how to easily
manage the item order (move item(s) up/down single or multiple places)...
Thanks,
Erik
Erik de Hair 's gravatar image asked Mar 17 2015 at 08:43 in Isis-Users by Erik de Hair

10 Answers

Hi Erick.
Simply by implementing the Comparable interface.
HTH,
Oscar
GESCONSULTOR 's gravatar image answered Mar 17 2015 at 09:39 by GESCONSULTOR
And also, you can write a custom comparator and reference it
Dan Haywood 's gravatar image answered Mar 17 2015 at 09:48 by Dan Haywood
Hi Oscar, Dan,
I think my question wasn't really clear. The ordering in the table is
not the problem (I've already implemented the comparable interface based
I need to arbitrarily change the order of the items by moving an item up
or down in the list (this should change the rank values). I was
wondering if anybody had an idea or any experience with an elegant way
to implement the moving-actions to be executed by the user.
Thanks,
Erik
Erik de Hair 's gravatar image answered Mar 17 2015 at 10:17 by Erik de Hair
Hi,
Maybe you can use the Bulk support - select few items in the table, then
click Up/Down action and depending on the action increase/decrease the rank
of the selected items.
Martin Grigorov
Freelancer, available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov
Martin Grigorov 's gravatar image answered Mar 17 2015 at 13:16 by Martin Grigorov
Hi Martin,
I thought your idea would be a nice solution but there's one problem
when moving succeeding items down. Each pair of items will switch ranks
than but won't move down. This could be solved by moving items down
while beginning at the bottom of the sorted set, but I don't think I can
influence the order in which the bulk actions are called to the single
items, do I?
I can't expect users to only select 'solitary' items and I think it's
not possible to check for that condition.
Would it be possible to create a different view for a datatable which
displays the items (implementing some interface with methods like
'rankUp/Down()') with 2 buttons per row for moving a single item up or
down, by calling rankUp/Down of this item?
Erik
Erik de Hair 's gravatar image answered Mar 18 2015 at 01:46 by Erik de Hair
Hi,
Everything is possible!
The fastest and easiest way (for me!) would be to create a custom component
factory that creates a custom component for objects implementing this
special/custom interface and renders them as you wish. But this is me
thinking as a Wicket developer. Maybe Dan will have a better Isis solution
for the problem.
Martin Grigorov 's gravatar image answered Mar 18 2015 at 02:06 by Martin Grigorov
I've had two ideas on this.
~~~
The first is very generic... allow no-arg actions to be rendered as buttons
would update state to change its apparent ordering). The viewer would then
re-render the same collection in the same way it does currently for bulk
actions (by invoking the finder that returned the list).
~~~
The other idea is a little more specialized; introduce a new Movable
interface into the applib, eg:
public interface Movable {
void moveBetween(Object before, Object after);
}
Then, enhance the Wicket viewer so that "movable" objects could be dragged
up and down; on release the viewer would invoke the "moveBetween" method
passing the objects before and after the drop zone, and then (as above)
re-render the list.
~~~
If either of these appeals then raise a ticket (actually, I think there
might be one already for the first idea).
In terms of actually implementing these tickets, I have no plans myself but
Martin (as our resident Wicket expert) might either (a) oblige or (b)
provide some guidance.
Cheers
Dan
Dan Haywood 's gravatar image answered Mar 18 2015 at 03:43 by Dan Haywood
This would be very nice to have. This reduces the amount of clicks to be
performed by the user very much.
For updating ranks, I would prefer this solution.
I will raise a ticket for both solutions.
Erik de Hair 's gravatar image answered Mar 18 2015 at 07:17 by Erik de Hair
Hi Martin,
Although I think Dan's solutions would be better for the future I your
solution of the custom component would help me out for now.
After looking at the Excel and Gmap3 add ons I managed to get the
collection with items (implementing the RankEditable interface with
methods moveUp() and moveDown()) rendered. Now I need to add the actions
to the datatable but have no idea how to create an action that acts on
the underlying entity. I used Wicket's DataView-class to render the
table. Could you give me some hints how to do this?
Thanks,
Erik
Erik de Hair 's gravatar image answered Mar 18 2015 at 07:25 by Erik de Hair
Hi Dan,
That helped: I managed to put a button in each row. It's the first step,
some steps left to take :-)
Erik
Erik de Hair 's gravatar image answered Mar 25 2015 at 05:21 by Erik de Hair

Related Discussions

  • How To Persist A List Of Items In A Domain Service in Isis-users

  • Good afternoon. I am trying to create a domain service with a method to finish a purchase. So, I have to set in the purchase a list of items, and I don't know how I do this. I imagine the interface with a field to find items and a table or a list showing the selected items by the user. Any tips? Thank you. Gabriel Malimpensa. Sao Carlos, Sao Paulo, Brazil....

  • How Do I Add A For For Adding Items To A Collection in Isis-users

  • Hi I see there are two 'views' for collection properties: the actual list and a blank page which i assume should contain the controls for adding new items. I would like to know how to specify this form, since I cannot find an example in the sample application of the documentation, Thanks Martin to do is to be. dobedobedo...

  • Working With A Tree Structured List Of Items in Isis-users

  • Hi guys, I'm having to tackle a problem at work that involves working with a list of objects in a tree structure. The list is a flat list of "configuration records" (needed to configure a scientific plant system prior to operation) and "configuration constraints" (which express mathematical relationships with and between configuration records). The flat list of configuration records is...

  • Drop-down Actions in Isis-users

  • Hi I have got a requirement to dynamically update the action of one drop-down A and list the relevant items on drop-down B. So drop-down A has Animals, Fruits, etc Is this possible in ISIS and how to implement this behaviour? Thanks in advance. Dharmesh...

  • CssClass Not Working On Object Forms? in Isis-users

  • Hi, Does the cssClass()-method only apply for items in tables? I don't see the class names in the object forms. If so, is it possible to add this also to object forms? Erik...

  • Changing Sort Order Of Items. in Mysql-general

  • I'm trying to create the most efficient way to allow a user to change the display order of a group of rows in a table. Lets say the basic table is: id group_id name sort_order The query to display it would be "SELECT id, name FROM mytable WHERE group_id = $x ORDER BY sort_order" Now when I display it they currenlty all have the same sort_order value so they come in the order ...

  • Changing Order Of Items in Php-general

  • this one bugs me for a while. how to change order. I have a list of tasks. by status, task could be 1 (todo) or 0 (done) - status value stored in mysql. I can list tasks per status or all. order number is stored in mysql too. the easiest way to change order is to have form for each task where you will enter manually number and then submit (one submit button for whole form). but, if you change...

  • Collation Order Of Items in Hbase-user

  • Is there any way to control introduce a different ordering scheme from the base comparable bytes? My use case is that I am using UTF-8 data for my keys, and I would like to have scans use UTF-8 collation. Could this be done by providing an alternate implementation of WritableComparable? Thanks in advance! --Tom...

  • Changing Names Of Items In A List in Python

  • hi i am trying to rename extension of files in a directory..as an initial step i made a method in class ConvertFiles: def __init__(self,infldr,outfldr): self.infldr=infldr self.outfldr=outfldr self.origlist=os.listdir(infldr) .... def renamefiles(self,extn): for x in self.origlist: x=x+"."+extn ... later when i print...

  • Changing List Items in Python

  • hi say i have a list alist = ['a','b','c','e','d','f'] I wanted to change the elements , say alist[2:4] . If i do alist[2:4] = "t" , it gives ['a', 'b', 't', 'd', 'f'] which is not what i want. I wanted alist = ['a','b','t','t','d','f'] My list may have more elements, and i may need to replace elements from different positions, eg alist[10:15] , alist[30:40] etc.. thanks....

  • Changing Menu Items in Ubuntu-users

  • Hello, I downloaded the latest firefox from mozilla, and it rocks! I want to change my internet/firefox menu item to point to the latest firefox not the one installed by default with ubuntu. I tried going to system -> preferences -> main menu, and adding a new item, but after specifying the launcher information and clicking ok, it didn't appear in the menu items list. So is there a trick to getting...

  • Changing/adding Menu Items in Kubuntu-users

  • I recently added kubuntu-desktop to my breezy computer as I prefer KDE over Gnome. I do seem to have an irritating problem however: I have tried to add menu items. In particular Abiword for an example. I have tried several times to add things to the menu, but although preferences and system settings lets me ADD the item, it doesn't take and the item never actually gets added to the menu. I can'...

  • Sort Order Of "missing" Items in Lucene-solr-user

  • When items are sorted, are all the docs with the sort field missing considered "tied" in terms of their sort order, or are they "indeterminate", or do they have some arbitrary order imposed on them (e.g. _docid_)? For example, would "b" be considered as part of the sort in the following query, or would all the missing 'a' fields be in some kind of order already, thus making the sort algorithm never...

  • Order Of Items In Cachedump in Memcached

  • I know cachedump may be going away soon, but for now it's still a somewhat useful diagnostic tool. To that end, what determines the order of the keys returned by cachedump? Is it based on the LRU or just completely random? Thanks! You received this message because you are subscribed to the Google Groups "memcached" group. To unsubscribe from this group and stop receiving emails from...

  • Multiple Collections Of Items in Lucene-solr-user

  • Hello, I'm yet another new solr user and I'll confess that I haven't read the documentation in great depth but hope someone can at least point me in the right direction. I have an application that manages documents in real-time into collections where a given document can live in more than one collection and multiple users can create collections on the fly. I get from reading that it's better...

  • NgRepeat: Access Collection Items As Instances Of A Class? in Angularjs

  • In the examples I've come across, an item may be acted on by passing it as an argument to a method. For example, isActive(user). How might I access the items as an instances of a class...more like user.isActive()? Here's a fiddle...http://jsfiddle.net/uberspeck/tnJzq/ Obviously the fiddle example is a bit contrived and there are easier ways to solve that specific problem...i just wanted to keep it...

  • Collection Of Items And Drilling Down To A Single Item in Angularjs

  • Forgive me if the terminology is wrong. I just started using AngularJS. Totally awesome and it is loads easier than the jQuery spaghetti mess I was creating. I have a controller that retrieves a list of contacts from the server. Here is the HTML: Contacts Number Name Title Phone Cell...

  • Order Of Items In A WHERE...IN Clause in Mysql-general

  • Hello, Is it permissible to order a clause such that the search term is the first item (in the clause)? standard: field1 IN (123, 654, 789) in question: 123 IN (field1, field2, field3) I am interested to know if the optimizer treats this any differently if anybody can shed any light on it (except for the obvious difference in the above queries!) Thanks, Andy...

  • Index Of Items In A List In Sorted Order in Python

  • I am posting a code to get index of sorted list for future reference. if you can make this code faster, i'll appreciate your input nizar ########################################################3 #!/usr/bin/python def ind_of_sorted(L): ''' return index of items in sorted order ''' k = len(L) d = {} # take care of repeated values [ d.setdefault(L[i],[]).append(i) for i in range(k)] auxL...

  • Any Limits On Number Of Items In A Collection Column Type in Cassandra-user

  • Hi, I have a column daycount list. The column is storing a count. Every few secs a new count is appended. The total count for the day is the sum of all items in the list. My application logs indicate I wrote about 110000 items to the column for a particular row. Assume row key is day_timestamp. But when I do a read on the column I get back a list with only 43000 items. Checked with...

  • Changing Case in Php-general

  • I have a form that allows for an item to be entered, the other pieces have been fixed so far that were bogging me down, but now I am looking for a way to convert any entry in the form to be UPPER case so that when the quote is listed, they are alphabetical. The problem is if someone enters aa-1234 and the other items in the quote are FF-2345 and QQ-3456 then the aa-1234 is UNDER them, instead...

  • Math Question in Php-general

  • I'm working on a little shopping cart script and when I get to the checkout portion I show what is in the cart and for each item I show the quanity, price per unit then I show the total cost for that item. So basically it looks like $total = $qty * $price My question is how do I add the value of $total to give the over total of the order? Since there may be one or more different items in...

  • Subset Of Fields Of Items In An Array in Mongodb-user

  • Hi, I have a collection of documents and each collection has an array. Array contains documents with a field "name". I am trying to do the following: db.mycollection.find( { "items.name" : "test"}, { "items. $.someItemField" : 1 } )  ... that doesn't work... What i want is a list of values in some field that belonds to items where name=test Anyone has an idea how to do this? Thanks Gino...

  • Remove Performance in Mongodb-user

  • I'm seeing quite different performance of removes vs. upserts and it would be good to get some feedback / suggestions. Here is the context: Replication: Master + multiple slaves Total records in collection: 150 million Upsert speed: 3000 per second Remove speed: 300 per second Mongo version: 1.6.2 The query to find the items to remove is not being done off an index but _id is indexed. I ...

  • Querying Question in Mongodb-user

  • Hi, Wanted to check if the following scenario is possible: I've the following a collection with set of objects from this type: { _id:1, myMap: { u1 : { name : "aaaa" }, u2 : { name : "bb" }, u3 : { name : "cc" } } } { _id:2, myMap: { u3 : { name : "aaaa" }, u2 : { name : "bb" }, u5 : { name : "cc" } } } { _id:3, myMap: { u6 : { name : "aaaa" }, u7 : { name : "bb" } } } of-curse myMap has different...