the propertymodel will call the getter function.

-igor

On Fri, Aug 7, 2009 at 10:44 AM, sky.walker<es.most...@gmail.com> wrote:
>
> I actually tried that, however my publication object looks like this. (I
> trimmed it to the relevant parts). as you can see there's no authorsInOrder
> Property only the authors property which can't be displayed to the user. I
> have to call getAuthorsInOrder() to retrieve the the list of author objects.
> Right now i can't change this pojo implementation but i can try to convince
> the domain model guy. What are my options if it can be changed and if it
> can't?
>
> package main.java.domain.publication;
>
> import java.util.*;
>
> import main.java.domain.user.IUser;
>
> /**
>  * An abstract publication POJO implementation for the IPublication
> interface.
>  *
>  * @see main.java.domain.publication.IPublication
>  * @author Karim El-Sayed
>  */
> public abstract class Publication implements IPublication {
>        /**
>         * The unique id of this publication.
>         */
>        private Long id;
>
>        /**
>         * The names of the authors of this publication in the same ordered 
> that
>         * have been entered by the user as a <code>String</code> separated by
>         * commas. The authors within the organization has their id entered 
> while
>         * external authors directly have their name.
>         */
>        private String authors;
>
>        private Set<IUser> internalAuthors = new HashSet<IUser>();
>
>        /**
>         * Default constructor.
>         */
>        public Publication() {
>        }
>
>       �...@override
>        public Long getId() {
>                return id;
>        }
>
>       �...@override
>        public void setId(Long id) {
>                this.id = id;
>        }
>
>       �...@override
>        public String getAuthors() {
>                return authors;
>        }
>
>       �...@override
>        public void setAuthors(String authors) {
>                this.authors = authors;
>        }
>
>       �...@override
>        public List getAuthorsInOrder() {
>                List authorsInOrder = new ArrayList();
>                String[] order = authors.split("#");
>                for (String author : order) {
>                        long authorId = isNumber(author);
>                        if (authorId == -1) {
>                                authorsInOrder.add(author);
>                        } else {
>                                Iterator<IUser> iterator = 
> internalAuthors.iterator();
>                                while (iterator.hasNext()) {
>                                        IUser user = iterator.next();
>                                        if (user.getId() == authorId) {
>                                                authorsInOrder.add(user);
>                                                break;
>                                        }
>                                }
>                        }
>                }
>                return authorsInOrder;
>        }
> }
>
>
> igor.vaynberg wrote:
>>
>> instead of
>>
>>  IModel authorsModel = new LoadableDetachableModel() {
>>                   �...@override
>>                    protected Object load() {
>>                        return publication.getAuthorsInOrder();
>>                    }
>>                };
>>
>> do
>>
>> authorsModel=new PropertyModel(item.getModel(), "authorsInOrder");
>>
>
> --
> View this message in context: 
> http://www.nabble.com/LoadableDetachableModel-Serialization-Problem-tp24868498p24869176.html
> Sent from the Wicket - User 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
>
>

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

Reply via email to