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]

Reply via email to