daily minutia on Twitter

  • Ironically per my last tweet, here is said photo from Seinfeld on thisisphotobomb.com http://bit.ly/dkAbC8 20 hrs ago
  • @robjohnson Congrats! You are now officially invited to visit my new office. ;-) in reply to robjohnson 20 hrs ago
  • Watching a rerun of Seinfeld with George dealing with photobomb of him the beach with his boss. Was this the original photobomb 20 hrs ago
  • Oh look my old boss http://bit.ly/dcecvK at Albums on the Hill. I used to work there in college, upstairs in the electronica section. 1 day ago
  • Remember in the 90's when they promised a flat screen to those who had a short acceptance speech? Wonder what the prize is these days... 2 days ago
  • More updates...

I'm Ingrid Alongi, a developer in Boulder, Colorado. I'm currently a software engineer at Gnip. My world is now all about API integration and social media data. Previously, at OneRiot, I wrote web applications using Java/Wicket/CSS. I've also got a side project where I use CodeIgniter for PHP and absolutely love it. Diving into JQuery too.

I've been in the web development/interactive agency world for almost 10 years, with most of my experience in building database-driven web applications (PHP, ColdFusion) for consumer facing clients (e-commerce, email marketing, advertising, cms, etc.). Lots of strategy, lots of driving traffic back the web site types of stuff. Oh, and managing an amazing team of developers.

I'm an electronic music snob, ex national level cyclist, I play violin and cello, and have an MA in Women's Studies. You can contact me at ialongi at yahoo . com.

Using ListView in Wicket

October 26, 2008, 10:31am by electromute

I’ve been spending a lot of time on Wicket lately for some exciting things that will be coming soon from Me.dium.  One cool trick I started using the ListView. If you’ve come from PHP or any other web language, you know the drill– display query data from the database on a web page.

Here’s a simple implementation of the ListView to help you get started. I’m going to take a list of employees and output them to the screen. This tutorial assumes you know the basics of how Wicket works. This is the portion where we’re adding components to the display piece.

EmployeesPage.java

(…)
List employees = new ArrayList();
//Now I’ll grab the output of the query and populate the ArrayList
try {
  employees = service.getAllEmployees();
}
catch (ServiceException e) {
  //write your handler here
}

//Now I’ll populate the ListView with the query results
add(new ListView(“employeesRptr”, employees) {
  private static final long serialVersionUID = 1L;

  @Override
  protected void populateItem(ListItem item) {
   User employee = (User) item.getModelObject();

   // image display
   item.add(new StaticImage(“profilePic”, new Model(employee.getPicture())));

   // name display
   StringBuilder name = new StringBuilder();
   name.append(employee.getFirstName());
   name.append(” “);
   name.append(employee.getLastName());
   item.add(new Label(“profileName”, name.toString()));

   // location display
   item.add(new Label(“profileLocation”, employee.getLocation()));
  }
});

Now for the display:

EmployeesPage.html

<span wicket:id=”employeesRptr”>

<img wicket:id=”profilePic” border=”0″ />
<p class=”name” wicket:id=”profileName”>Joe Schmo</p>
<p class=”location” wicket:id=”profileLocation”>location</p>

</span>

Enjoy!

Tags: , , ,



«      »