Created
January 16, 2013 06:13
-
-
Save senthilmuthiah/4545051 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package demo; | |
import java.util.List; | |
import org.zkoss.zk.ui.Component; | |
import org.zkoss.zk.ui.select.SelectorComposer; | |
import org.zkoss.zk.ui.select.annotation.*; | |
import org.zkoss.zul.*; | |
public class SearchController extends SelectorComposer<Component> { | |
private static final long serialVersionUID = 1L; | |
@Wire | |
private Textbox keywordBox; | |
@Wire | |
private Listbox carListbox; | |
@Wire | |
private Label modelLabel; | |
@Wire | |
private Label makeLabel; | |
@Wire | |
private Label priceLabel; | |
@Wire | |
private Label descriptionLabel; | |
@Wire | |
private Image previewImage; | |
private CarService carService = new CarServiceImpl(); | |
@Listen("onClick = #searchButton") | |
public void search(){ | |
String keyword = keywordBox.getValue(); | |
List<Car> result = carService.search(keyword); | |
carListbox.setModel(new ListModelList<Car>(result)); | |
} | |
@Listen("onSelect = #carListbox") | |
public void showDetail(){ | |
Car selected = carListbox.getSelectedItem().getValue(); | |
previewImage.setSrc(selected.getPreview()); | |
modelLabel.setValue(selected.getModel()); | |
makeLabel.setValue(selected.getMake()); | |
priceLabel.setValue(selected.getPrice().toString()); | |
descriptionLabel.setValue(selected.getDescription()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment