I'll try to look at tomorrow eve. Cheers, Dan Sent from my iPhone
On 11 Jul 2011, at 17:09, "Kevin Meyer - KMZ" <[email protected]> wrote: > Phew! > > A bit of a slog, trying to understand Wicket and the Wicket Viewer, but > I finally seem to have something that works. > > I had to change ConverterForObjectAdapterMemento#convertToString > to work with value-type objects. > > Otherwise, the Wicket viewer now seems to support choicesXXX for > properties for value types. > > I have not tested this for parameters. > > One annoying thing I have not completed is getting the layout sorted > out. The choices dropdown list appears outside the property "label" > range, and renders a bit vertically displaced. > > Dan, if you get a chance, could you look at ValueCollections.java/html > and see what is missing? > > I've tested this for Date and String, and it works. > > Ah - nearly forgot - I also don't (yet) know how to correctly initialise the > drop-down list with the existing property value. It always starts off with > "Choose One", instead of the existing value. > > Regards, > Kevin > > > On 9 Jul 2011 at 16:47, Kevin Meyer - KMZ wrote: > >> Hi Dan, >> >> I got quite far, to the extend that I was able to render the choices in a >> drop-down list, but I *still* had the original input field as a free-form >> entry box. >> >> While trying to address this, I got stuck again. >> >> Anyway! >> >> If ComponentFactoryScalarAbstract#createComponent, I have some >> code (currently commented out) that looks like this: >> >> public final Component createComponent(final String id, final IModel<?> >> model) { >> final ScalarModel scalarModel = (ScalarModel) model; >> >> // TODO: This is where the ValueCollection panel gets created. >> final List<ObjectAdapter> choices = scalarModel.getChoices(); >> if (choices.size() > 0) { >> return new ValueCollection(id, scalarModel); >> } else { >> return createComponent(id, scalarModel); >> } >> } >> >> The point is that if a property of any of the regular scalarModel types is >> found to have some choices, then instead of creating the normal >> component (e.g. StringPanel), the factory creates a ValueCollection >> (ok, the name can be changed). >> >> As I see it, this value collection simply needs to render a the value type >> as a dropdown list... >> >> But I'm getting stuck trying to synchronise the HTML and the wicket >> viewer code in ValueCollection. >> >> I'm going to stop here for a while, but would appreciate it if you could >> uncomment the block in ComponentFactoryScalarAbstract, above, >> and have a look at my ValueCollection.java & html. >> >> I deleted what turned out to be unneeded changes to the >> ComponentFactoryListDefault.java, ComponentType.java, etc, and >> deleted the unneeded ValueCollectionFactory.java. >> >> Regards, >> Kevin >> >
