daily minutia on Twitter

  • via @BikeCrave: A tribute to cycling legend Laurent Fignon who lost his battle with cancer. http://bit.ly/apec9n. What a legend. 2 days ago
  • Classy. I just hand-poured washer fluid on my car with the wipers going because shit is broke. 2 days ago
  • RT @jvaleski: New Blog Post: "Exits; You're Doing it Right" - http://bit.ly/dmaSvK (Nice post, & I could not agree more with your examples.) 2 days ago
  • @CaroDonahue Happy Birthday! As a convenient gift, you should keep my Spiritual Gangster T-shirt. You are a much better wearer of it than I. 2 days ago
  • Could not have had a better morning. Why, you ask? Because @jmalan dropped off some lemon blueberry scones. Thanks love! They were great. 2 days ago
  • More updates...

I'm Ingrid Alongi, a developer in Boulder, Colorado. I'm a co-founder at Quick Left, a Web Engineering company. I used to be a software engineer at Gnip where API integration and social media data were my world. Prior to that, at OneRiot, I wrote web applications using Java/Wicket/CSS. I've got experience with CodeIgniter for PHP, but mostly use Zend with Doctrine when it comes to PHP. Got some 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. Or, mosey on over to the Quick Left blog to see what I'm up to.

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: , , ,



«      »