I couldn't understand the part about the icon, but what I know is that 
'getObject()' will *never* be called until you set the Square object into 
itself as the model:

public Square() {
   setModel(this);
}

Regards,
Bruno

-----Mensagem original-----
De: Leucht, Axel [mailto:[EMAIL PROTECTED]
Enviada em: quarta-feira, 19 de novembro de 2008 09:28
Para: [EMAIL PROTECTED] Apache. Org (E-Mail)
Assunto: Model never called


Hi,

I do have a link class which should render different icons when clicked. 

So I decided to implement IModel and return different icons depending on the 
state of the object. But to my surprise getObject() never get called!

Does anyone give me a clue where to look next or give me a hint as to how to 
render the object with a different icon?

The object is used in a 10x10 board game where a player can "shoot" at 
different squares which are rendered as links in the output. The board is 
constructed as:
                ListView listview = new ListView("rows", list) {
                        private static final long serialVersionUID = 1L;

                        protected void populateItem(ListItem item) {
                                Row row = (Row) item.getModelObject();
                                final Square[] squares = new Square[10];
                                for (int col=0; col<10; col++) {
                                        squares[col] = row.getCells(col);
                                }
                                Square square = row.getCells(0);
                                item.add(new Label("row",new 
Model(square.getRow())));
                                for (int col=0; col<10; col++) {
                                        final Square aSquare = 
row.getCells(col);
                                        item.add(aSquare);
                                }
                        }
                };
And the Square-Object is:
        public class Square extends Link implements IModel {
                @Override
                public void onClick() {
                        System.out.println("Click:" + ident);
                }

                @Override
                public Object getObject() {
                        System.out.println("GetObject");
                        if (someState)
                                return icon1;
                        return icon2;

                }
        }

/Axel

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

***************************************************************************************************
"Atenção: Esta mensagem foi enviada para uso exclusivo do(s) destinatários(s) 
acima identificado(s),
podendo conter informações e/ou documentos confidencias/privilegiados e seu 
sigilo é protegido por 
lei. Caso você tenha recebido por engano, por favor, informe o remetente e 
apague-a de seu sistema.
Notificamos que é proibido por lei a sua retenção, disseminação, distribuição, 
cópia ou uso sem 
expressa autorização do remetente. Opiniões pessoais do remetente não refletem, 
necessariamente, 
o ponto de vista da CETIP, o qual é divulgado somente por pessoas autorizadas."


"Warning: This message was sent for exclusive use of the addressees above 
identified, possibly 
containing information and or privileged/confidential documents whose content 
is protected by law. 
In case you have mistakenly received it, please notify the sender and delete it 
from your system. 
Be noticed that the law forbids the retention, dissemination, distribution, 
copy or use without 
express authorization from the sender. Personal opinions of the sender do not 
necessarily reflect 
CETIP's point of view, which is only divulged by authorized personnel."
***************************************************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to