I am attempting to
- Create a new button on a browser view (done)
- Have that button invoke a new action, to keep it simple, let’s say it’s nothing but a list of Product records, I have the entities and browse screen for it, I will retrieve all of the product records and filter them in the controller and want to display the results.
Right now the Create Button shows up but there is no response, not even an entry in catalina.out
How do populate a Table of Product and display them from the create action?
package com.pds.pdssr.web.etlsaleunknownitem;
import com.haulmont.cuba.gui.WindowManager;
import com.haulmont.cuba.gui.components.AbstractLookup;
import com.haulmont.cuba.gui.components.Button;
import javax.inject.Inject;
import java.util.Map;
import com.haulmont.cuba.gui.components.actions.CreateAction;
import com.pds.pdssr.entity.EtlSaleUnknownItem;
import com.haulmont.cuba.gui.components.Table;
/* When the create button is selected the highlighted
* EtlSaleUnknownItem record should be passed to a controller
* that would present it and a list of candidate products
* If one is not appropriate a new product could be created
* in ProductEdit
*
* I am working off an example from a cuba platform sample
* ./modules/web/src/akkount/web/operation/OperationBrowse.java
*/
public class EtlSaleUnknownItemBrowse extends AbstractLookup {
@Inject
private Button createProductBtn;
@Inject
protected Table<EtlSaleUnknownItem> etlSaleUnknownItemsTable;
@Override
public void init(Map<String, Object> params) {
ProductCreateAction createProductAction = new ProductCreateAction();
createProductBtn.setAction(createProductAction);
}
protected class ProductCreateAction extends CreateAction {
public ProductCreateAction() {
/**
* I don't know what this would display etlSaleUnknownItemsTable
* web/src/com/pds/pdssr/web/etlsaleunknownitem/etl-sale-unknown-item-browse.xml
*
* I would really like to pass the selected row to another
* screen
*
* This row would be displayed
*
* A list of candidate products would be displayed and the
* user could choose one, in which case I do some DML and
* insert it as a distributor name for the chosen product
*
* Else a new product could be created and then assigned.
*
* Right now I would be happy to get a controller
* to display some static text from another view
*/
super(etlSaleUnknownItemsTable, WindowManager.OpenType.NEW_TAB, "Can you hear me now?");
// setInitialValues(Collections.<String, Object>singletonMap("opType", opType));
setCaption("Caption on Something");
// setShortcut("Ctrl-Shift-Key" + String.valueOf(opType.ordinal() + 1));
}
}
}