Commit c2c785f2 by Antti Tönkyrä

foodwave creation..

1 parent 26b73604
...@@ -27,7 +27,7 @@ import org.eclipse.persistence.annotations.OptimisticLockingType; ...@@ -27,7 +27,7 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
@Table(name = "food_wave_templates") @Table(name = "food_wave_templates")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS) @OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class FoodWaveTemplate extends GenericEntity { public class FoodWaveTemplate extends GenericEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final String EVENT_ID = "event_id"; private static final String EVENT_ID = "event_id";
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<p:commandButton value="#{i18n['foodwavetemplate.addproduct']}" actionListener="#{foodWaveView.addProductToTemplate}" update="productTable" /> <p:commandButton value="#{i18n['foodwavetemplate.addproduct']}" actionListener="#{foodWaveView.addProductToTemplate}" update="productTable" />
</h:panelGrid> </h:panelGrid>
<p:dataTable name="productTable" id="productTable" value="#{foodWaveView.template.products}" var="product"> <p:dataTable name="productTable" id="productTable" value="#{foodWaveView.template.products}" var="product" editable="true">
<p:column headerText="#{i18n['foodwavetemplate.productname']}"> <p:column headerText="#{i18n['foodwavetemplate.productname']}">
<p:cellEditor> <p:cellEditor>
<f:facet name="output"> <f:facet name="output">
...@@ -74,8 +74,13 @@ ...@@ -74,8 +74,13 @@
</f:facet> </f:facet>
</p:cellEditor> </p:cellEditor>
</p:column> </p:column>
<p:column headerText="#{i18n['foodwavetemplate.actions']}" style="width:20px;">
<p:rowEditor />
<p:commandButton value="#{i18n['foodwavetemplate.removeFromList']}" action="#{foodWaveView.removeProductFromList(product)}" update="productTable" />
</p:column>
</p:dataTable> </p:dataTable>
</p:tab> </p:tab>
</p:wizard> </p:wizard>
</h:form> </h:form>
......
...@@ -176,4 +176,8 @@ public class FoodWaveView extends GenericCDIView { ...@@ -176,4 +176,8 @@ public class FoodWaveView extends GenericCDIView {
this.templateId = templateId; this.templateId = templateId;
} }
public void removeProductFromList(Product product) {
template.getProducts().remove(product);
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!