use of com.liferay.faces.demos.dto.Customer in project liferay-faces-bridge-impl by liferay.
the class BookingsModelBean method setSelectedCustomerId.
/**
* This method will be called automatically by the bridge if the user selects a different customer from the list,
* because the public render parameter model-el expression #{bookingsPortlet:bookingsModelBean.selectedCustomerId}
* exists in the WEB-INF/faces-config.xml descriptor.
*
* @param selectedCustomerId
*/
public void setSelectedCustomerId(String selectedCustomerId) {
logger.debug("Retrieving bookings for new selectedCustomerId=[{0}]", selectedCustomerId);
this.selectedCustomerId = selectedCustomerId;
if (selectedCustomerId != null) {
long customerId = Long.parseLong(selectedCustomerId);
Customer selectedCustomer = customerService.getCustomer(customerId);
setCustomer(selectedCustomer);
}
}
use of com.liferay.faces.demos.dto.Customer in project liferay-faces-bridge-impl by liferay.
the class CustomersBackingBean method selectionListener.
/**
* This method is a JSF action listener that is called when the user clicks on a customer. By calling {@link
* CustomersModelBean#setSelectedCustomerId(String)} it may seem that we are simply recording the selected
* customerId in the model. However, there is more than meets the eye. I the WEB-INF/faces-config.xml descriptor
* there is an EL expression of #{customersPortlet:customersModelBean.selectedCustomerId} which means that the
* bridge will be monitoring the status of that model bean property. If the value changes in the model bean, then
* the bridge will automatically call {@link BookingsModelBean#setSelectedCustomerId(String)} because of the other
* model-el Expression #{bookingsPortlet:bookingsModelBean.selectedCustomerId} found in the WEB-INF/faces-config.xml
* descriptor.
*/
public void selectionListener(ActionEvent actionEvent) {
UICommand uiCommand = (UICommand) actionEvent.getComponent();
Customer customer = (Customer) uiCommand.getValue();
logger.debug("User click! selectedCustomerId=[{0}]", customer.getCustomerId());
customersModelBean.setSelectedCustomerId(Long.toString(customer.getCustomerId()));
}
Aggregations