@Named(value="sellerController") @ConversationScoped public class SellerController extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
private UICommand |
addCommand
Command button used when user chooses to add a new product.
|
private ProductCatalog |
catalog
A reference to back-end business logic that can manage products.
|
private Conversation |
conversation
Can be used to manage the conversation
|
private ErrorController |
error
Gets injected and is place to stash errors to be displayed.
|
private UIForm |
form
Form used when adding a new product.
|
private static org.slf4j.Logger |
logger |
private Product |
product
This is the product the page is currently working with.
|
private List<Product> |
products
This is initially populated using a call to the back-end for persisted
items for sale and then updated as products are added for sale during the
conversation.
|
private UIForm |
tableForm
Form used when displaying the list of products
|
private CurrentUser |
user
Current user will be injected by CDI into this property using a @Produces
by one of our components.
|
| Constructor and Description |
|---|
SellerController() |
| Modifier and Type | Method and Description |
|---|---|
String |
add()
This action method is used to add the populated "Product" bean to the
conversation.
|
String |
addNew()
This action method will instantiate a new "Product" bean, disable
the form containing this action, enable the form that will work on the
new Product bean.
|
String |
delete() |
void |
destroy() |
UICommand |
getAddCommand()
The provider will supply a UICommand object for a form within the binding
sellerController.addCommand.
|
List<SelectItem> |
getCategories() |
UIForm |
getForm() |
Product |
getProduct()
Associated getter/setter is called for inputText.value elements.
|
List<Product> |
getProducts() |
Member |
getSeller() |
UIForm |
getTableForm() |
void |
init() |
String |
save() |
void |
setAddCommand(UICommand addCommand) |
void |
setForm(UIForm form) |
void |
setProduct(Product product) |
void |
setProducts(List<Product> products) |
void |
setTableForm(UIForm tableForm) |
private static final org.slf4j.Logger logger
@Inject private ErrorController error
@Inject private Conversation conversation
@Inject private ProductCatalog catalog
@Inject private CurrentUser user
private List<Product> products
private Product product
private UIForm form
private UIForm tableForm
private UICommand addCommand
@PostConstruct public void init()
@PreDestroy public void destroy()
public Member getSeller()
public Product getProduct()
public void setProduct(Product product)
public List<SelectItem> getCategories()
public UICommand getAddCommand()
The provider will access that property through setAddCommand() and getAddCommand().
This controller gets a chance to modify the UICommand properties but the object
itself is provided by the JSF provider.public void setAddCommand(UICommand addCommand)
public String addNew()
public UIForm getForm()
public void setForm(UIForm form)
public String add()
public UIForm getTableForm()
public void setTableForm(UIForm tableForm)
public String delete()
public String save()
Copyright © 2015 John's Hopkins University, Engineering Programs for Professionals. All rights reserved.