ListView and Serialization

 

First i like to say it was the framework that I was waiting for years.
Great job guys!

 

I did buy the wicket in action book which I did find very helpful but it
didn't help me solve this problem.  I have problems with the ListView
and Serialization.  I'm using the ListView to render charts on panels.
It was easy to get it on the panels as cells in the list view but the
problem I'm having is with the serialization.  I have a complex heavy
object I don't want to serialize.  I'd like to put the object in the
session and use the model to get the data from there.

 

 

// data class - I don't want this data serialized

public class ObjectDisplay  {

      Point point = null;

      int policyID;

      ReconcileComputer reconcile = null;

      GroupScore root ;

      public ObjectDisplay() {}

}

 

// Page with serialization problem

public class DashBoardPage extends AuthenticatedWebPage {

 

 

public DashBoardPage(final PageParameters parameters) {

      super(parameters);

      ArrayList<ObjectDisplay []> display = aquireDispays();

 

      add(new ObjectView("object-list",display));

 

}

 

    class ObjectView extends ListView {

      

            

 

      private static final long serialVersionUID = 1L;

 

        public ObjectView(String arg0, List arg1) {

            super(arg0, arg1);

 

        }

 

        public Panel createObject(String id, ObjectDisplay od) {

            if (od.root == null) {

                  ContentPanel p = new ContentPanel(id,
od.point.getTitle());

                  p.add(new Label("object","No data found."));

                  return p;

            }

            

            Panel panel = null;

            switch (od.point.getObjectType()) {             

            case RootPieChart :

                  panel = new RootPieChart(id,od,false);

                  break;

            case RootHorizontalBarChart :

                  panel = new HorizontalRootGroupChart(id,od);

                  break;

            case ChildVerticalBarChart :

                  panel = new VerticalChildChart(id,od,gs);

                  break;

            case RootDrillDown :

                  panel = new RootPieChart(id,od,true);

                  break;

            case RootRiskSummary:

                  panel = new RiskPanel(id,od);

                  break;      

            case RootTreeView :

                  panel = new ScoreCardPanel(id,od);

                  break;

            }

                  

            return panel;

            

        }

        

        public void populateItem(final ListItem listItem) {

            final ObjectDisplay []value = (ObjectDisplay [])
listItem.getModelObject();

           

            Panel panel = null;

            

            WebMarkupContainer colspanner = new
WebMarkupContainer("colspanner");

            if (value[1] == null) {

                  String cs = "1";

                  if (isWideLoad(value[0].point.getObjectType())) {

                        cs = "2";

                        colspanner.add(new
SimpleAttributeModifier("style","width: 100%; padding: 5px;"));

                        

                  } 

                  colspanner.add(new SimpleAttributeModifier("colspan",
cs));                   

                  listItem.add(colspanner);

                  panel = createObject("object1",value[0]);

                  colspanner.add(panel);

                  listItem.add(new Label("object2",""));

            } else {

                  colspanner.add(new SimpleAttributeModifier("colspan",
"1"));

                  listItem.add(colspanner);

panel = createObject("object1",value[0]);
colspanner.add(panel);

                  panel = createObject("object1",value[1]);

                  listItem.add(panel);

            }

           

 

        }

    }

 

 

}

 

Reply via email to