Re: Hybrid palette with DropDownChoice and ListView

2014-02-19 Thread ChambreNoire
Great, I'm still getting NonUniqueObjectExceptions when I save. Back to the
drawing board. *sigh*

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Hybrid-palette-with-DropDownChoice-and-ListView-tp4664445p4664562.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Hybrid palette with DropDownChoice and ListView

2014-02-14 Thread ChambreNoire
  }

unselectedChoices = new ArrayList(Math.max(1, choices.size()
- ids.length));

for (T choice : choices) {

final String choiceId =
getChoiceRenderer().getIdValue(choice, 0);

boolean selected = false;

for (String id : ids) {

if (id.equals(choiceId)) {
selected = true;
break;
}
}
if (!selected) {
unselectedChoices.add(choice);
}
}
}
return unselectedChoices;
}

private void flushSelectedChoices() {
selectedChoices = null;
}

private void initIds() {

IChoiceRenderer renderer = getChoiceRenderer();

Iterator selection = getModelCollection().iterator();

ids = new String[getModelCollection().size()];

int i = 0;
while (selection.hasNext()) {

ids[i] = renderer.getIdValue(selection.next(), i++);
}
}

@SuppressWarnings("unchecked")
public Collection getChoices() {
return (Collection) choicesModel.getObject();
}

@SuppressWarnings("unchecked")
public Collection getModelCollection() {
return (Collection) getModelObject();
}

public IChoiceRenderer getChoiceRenderer() {
return this.choiceRenderer;
}

@Override
protected void onDetach() {

selectedChoices = null;
unselectedChoices = null;

    super.onDetach();
}
}

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Hybrid-palette-with-DropDownChoice-and-ListView-tp4664445p4664450.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Hybrid palette with DropDownChoice and ListView

2014-02-13 Thread ChambreNoire
Thanks for the suggestions. Regrettably the spec requires a vertical list of
labels and specifically not a multi choice list as used in the extensions
Palette component otherwise yes it would be trivial to make the right hand
side a one row drop down as you mention...

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Hybrid-palette-with-DropDownChoice-and-ListView-tp4664445p4664448.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Hybrid palette with DropDownChoice and ListView

2014-02-13 Thread Paul Bors
Btw, Select2 demos are at:
http://ivaynberg.github.io/select2/

Its Wicket integration at:
https://github.com/ivaynberg/select2

That's Igor's baby (you might have seen Igor's name in Wicket's API
JavaDocs :)


On Thu, Feb 13, 2014 at 11:34 AM, Paul Bors  wrote:

> I don't think you need to go nuts and worry much about a ListView. Use a
> Select2 instead of the drop-down and have a custom panel instead of the
> plain old option. You can place an Add button or something or better yet,
> check boxes and then you won't need the second list.
>
> Suppose you do stick to old HTML components like a DropDown and a
> ListView. First off, get off the list view and use a multiple Select.
> Take a look at how the wicket pallet is done at:
>
> http://www.wicket-library.com/wicket-examples/compref/wicket/bookmarkable/org.apache.wicket.examples.compref.PalettePage
>
> All you would have to do is change the left available multi select with
> your drop down.
>
>
> Now, I would recommend using jQuery UI's widgets since they are easier to
> use and more fun to work with (both for the developer and the application
> user):
> http://jqueryui.com/demos/
>
> Have fun!
>
> On Thu, Feb 13, 2014 at 11:05 AM, ChambreNoire  wrote:
>
>> Hello,
>>
>> I'd like to create a hybrid 'palette'. First there's a DropDownChoice with
>> an 'Add' link and next to this a vertical list of selected items, each
>> with
>> a 'remove' link. Of course, adding an item removes it from the
>> DropDownChoice and adds it to the list and vice-versa for item 'removal'.
>>
>> I have already started but I fear that this is probably going to be fairly
>> complicated as it involves using ListViews in a form and DropDownChoice
>> customisation so any pointers to get me going would be most appreciated.
>> I'll post some code once I have something vaguely functional!
>>
>> Thanks,
>>
>> Chambre
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/Hybrid-palette-with-DropDownChoice-and-ListView-tp4664445.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>


Re: Hybrid palette with DropDownChoice and ListView

2014-02-13 Thread Paul Bors
I don't think you need to go nuts and worry much about a ListView. Use a
Select2 instead of the drop-down and have a custom panel instead of the
plain old option. You can place an Add button or something or better yet,
check boxes and then you won't need the second list.

Suppose you do stick to old HTML components like a DropDown and a ListView.
First off, get off the list view and use a multiple Select.
Take a look at how the wicket pallet is done at:
http://www.wicket-library.com/wicket-examples/compref/wicket/bookmarkable/org.apache.wicket.examples.compref.PalettePage

All you would have to do is change the left available multi select with
your drop down.


Now, I would recommend using jQuery UI's widgets since they are easier to
use and more fun to work with (both for the developer and the application
user):
http://jqueryui.com/demos/

Have fun!

On Thu, Feb 13, 2014 at 11:05 AM, ChambreNoire  wrote:

> Hello,
>
> I'd like to create a hybrid 'palette'. First there's a DropDownChoice with
> an 'Add' link and next to this a vertical list of selected items, each with
> a 'remove' link. Of course, adding an item removes it from the
> DropDownChoice and adds it to the list and vice-versa for item 'removal'.
>
> I have already started but I fear that this is probably going to be fairly
> complicated as it involves using ListViews in a form and DropDownChoice
> customisation so any pointers to get me going would be most appreciated.
> I'll post some code once I have something vaguely functional!
>
> Thanks,
>
> Chambre
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Hybrid-palette-with-DropDownChoice-and-ListView-tp4664445.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Hybrid palette with DropDownChoice and ListView

2014-02-13 Thread ChambreNoire
Hello,

I'd like to create a hybrid 'palette'. First there's a DropDownChoice with
an 'Add' link and next to this a vertical list of selected items, each with
a 'remove' link. Of course, adding an item removes it from the
DropDownChoice and adds it to the list and vice-versa for item 'removal'. 

I have already started but I fear that this is probably going to be fairly
complicated as it involves using ListViews in a form and DropDownChoice
customisation so any pointers to get me going would be most appreciated.
I'll post some code once I have something vaguely functional!

Thanks,

Chambre

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Hybrid-palette-with-DropDownChoice-and-ListView-tp4664445.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org