Hi !

I want to know what was the best practice with Wicket when I want to
manipulate a Panel which need a List of object.
Today i can do what i'm supposed to do but I think it's so easy to be lost
and apply anti-patterns with Wicket.

A concrete example: 
http://apache-wicket.1842946.n4.nabble.com/file/n4555471/OngletAdressePanel.java
OngletAdressePanel.java 

and this is how I create my Panel


IModel<List&lt;Adresse>> lesAdressesDeLaCommandeModel = new
AbstractReadOnlyModel<List&lt;Adresse>>() {
      private static final long serialVersionUID = 1L;

      @Override
      public List<Adresse> getObject() {
        return adresseService.getLesAdressesDeLaCommande();
      }
    };
    
    final boolean tabAdresseVisible =
!lesAdressesDeLaCommandeModel.getObject().isEmpty();
    
    Panel ongletAdressePanel = new
OngletAdressePanel("panelAdresse",lesAdressesDeLaCommandeModel,
TYPE_VISION.CONSEILLER);
    ongletAdressePanel.setVisible(tabAdresseVisible);
    
    blocClientAdresse.add(ongletAdressePanel);
    blocClientAdresse.add(new
WebMarkupContainer("tabAdresseClient").setVisible(tabAdresseVisible));


This code works, but I know it's pretty uggly. Do you have any ideas how
could I improve my code.

And another question do you know what should I do to manipulate the list
into my Panel. Doing something like get the size of the list and decide to
set visible or not a component ?
I ask this question because we can't cast a List :
List<Adress> adresses = (List<Adress>) getDefaultModelObject();
Is there a special model to use to manipulate a list into a Component
different than a Repeater?


Thank you for your help

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Manipulate-a-List-into-a-Panel-tp4555471p4555471.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

Reply via email to