Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Antti Väyrynen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1a9af8bc
authored
Oct 26, 2012
by
Antti Tönkyrä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
foodwave stuff and fixes
1 parent
7e22d2bb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
79 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/FoodWaveBean.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/FoodWaveBeanLocal.java
code/LanBortalWeb/WebContent/foodadmin/createTemplate.xhtml
code/LanBortalWeb/WebContent/foodadmin/editTemplate.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/FoodWaveView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/FoodWaveBean.java
View file @
1a9af8b
...
...
@@ -74,7 +74,7 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
@Override
public
FoodWaveTemplate
saveTemplate
(
FoodWaveTemplate
waveTemplate
)
{
throw
new
UnsupportedOperationException
(
"would you mind to implement this method?"
);
return
fwtFacade
.
merge
(
waveTemplate
);
}
...
...
@@ -117,4 +117,14 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
return
template
;
}
@Override
public
FoodWaveTemplate
removeProductFromTemplate
(
Product
product
,
FoodWaveTemplate
template
)
{
template
=
fwtFacade
.
merge
(
template
);
product
=
productfacade
.
merge
(
product
);
template
.
getProducts
().
remove
(
product
);
product
.
getFoodWaveTemplates
().
remove
(
template
);
return
template
;
}
}
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/FoodWaveBeanLocal.java
View file @
1a9af8b
...
...
@@ -32,4 +32,6 @@ public interface FoodWaveBeanLocal {
public
void
createFoodWave
(
FoodWave
fw
);
FoodWaveTemplate
addProductToTemplate
(
FoodWaveTemplate
template
,
Product
currentProduct
);
FoodWaveTemplate
removeProductFromTemplate
(
Product
product
,
FoodWaveTemplate
template
);
}
code/LanBortalWeb/WebContent/foodadmin/createTemplate.xhtml
View file @
1a9af8b
...
...
@@ -38,84 +38,12 @@
requiredMessage=
"Description required"
/>
<h:message
for=
"description"
/>
</h:panelGrid>
<!-- </p:tab>
<p:tab id="selectproducts"
title="#{i18n['foodwavetemplate.selectproducts']}"> -->
<h:messages
/>
<h:panelGrid
columns=
"4"
>
<h:outputText
value=
"#{i18n['foodwavetemplate.productname']}"
/>
<h:outputText
value=
"#{i18n['foodwavetemplate.productdescription']}"
/>
<h:outputText
value=
"#{i18n['foodwavetemplate.price']}"
/>
<h:outputText
value=
" "
/>
<h:inputText
id=
"productname"
value=
"#{foodWaveView.currentProduct.name}"
/>
<h:inputText
id=
"productdescription"
value=
"#{foodWaveView.currentProduct.description}"
/>
<h:inputText
id=
"price"
value=
"#{foodWaveView.currentProduct.price}"
/>
<p:commandButton
value=
"#{i18n['foodwavetemplate.addproduct']}"
actionListener=
"#{foodWaveView.addProductToTemplate}"
update=
"productTable"
/>
</h:panelGrid>
<p:dataTable
name=
"productTable"
id=
"productTable"
value=
"#{foodWaveView.template.products}"
var=
"product"
editable=
"true"
>
<p:column
headerText=
"#{i18n['foodwavetemplate.productname']}"
>
<p:cellEditor>
<f:facet
name=
"output"
>
<h:outputText
value=
"#{product.name}"
/>
</f:facet>
<f:facet
name=
"input"
>
<p:inputText
value=
"#{product.name}"
style=
"width:100%"
required=
"true"
requiredMessage=
"Name required"
/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column
headerText=
"#{i18n['foodwavetemplate.productdescription']}"
>
<p:cellEditor>
<f:facet
name=
"output"
>
<h:outputText
value=
"#{product.description}"
/>
</f:facet>
<f:facet
name=
"input"
>
<p:inputText
value=
"#{product.description}"
style=
"width:100%"
required=
"true"
requiredMessage=
"Description required"
/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column
headerText=
"#{i18n['foodwavetemplate.price']}"
>
<p:cellEditor>
<f:facet
name=
"output"
>
<h:outputText
value=
"#{product.price}"
/>
</f:facet>
<f:facet
name=
"input"
>
<p:inputText
value=
"#{product.price}"
style=
"width:100%"
required=
"true"
requiredMessage=
"Price required"
/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column
headerText=
"#{i18n['foodwavetemplate.editRow']}"
style=
"width:20px"
>
<p:rowEditor
/>
</p:column>
<p:column
headerText=
"#{i18n['foodwavetemplate.actions']}"
style=
"width:20px;"
>
<p:commandButton
value=
"#{i18n['foodwavetemplate.removeFromList']}"
action=
"#{foodWaveView.removeProductFromList(product)}"
update=
"productTable"
/>
</p:column>
</p:dataTable>
<h:commandButton
action=
"#{foodWaveView.saveTemplate()}"
value=
"#{i18n['foodwavetemplate.savetemplate']}"
>
<f:param
value=
"#{foodWaveView.templateId}"
name=
"id"
/>
</h:commandButton>
>
</h:commandButton>
<!-- </p:tab> -->
<!-- </p:wizard> -->
...
...
code/LanBortalWeb/WebContent/foodadmin/editTemplate.xhtml
View file @
1a9af8b
...
...
@@ -49,7 +49,8 @@
<p:commandButton
value=
"#{i18n['foodwavetemplate.addproduct']}"
actionListener=
"#{foodWaveView.addProductToTemplate}"
update=
"productTable"
/>
<!-- <h:panelGrid columns="4">
<h:panelGrid
columns=
"4"
>
<h:outputText
value=
"#{i18n['foodwavetemplate.productname']}"
/>
<h:outputText
...
...
@@ -68,11 +69,14 @@
actionListener=
"#{foodWaveView.addProductToTemplate}"
update=
"productTable"
/>
</h:panelGrid>
-->
</h:panelGrid>
<p:dataTable
name=
"productTable"
id=
"productTable"
value=
"#{foodWaveView.template.products}"
var=
"product"
editable=
"true"
>
<p:ajax
event=
"rowEdit"
listener=
"#{foodWaveView.onEdit}"
/>
<p:column
headerText=
"#{i18n['foodwavetemplate.productname']}"
>
<p:cellEditor>
<f:facet
name=
"output"
>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/FoodWaveView.java
View file @
1a9af8b
...
...
@@ -56,6 +56,10 @@ public class FoodWaveView extends GenericCDIView {
public
List
<
Product
>
getProducts
()
{
return
productbeanlocal
.
getProducts
();
}
public
void
onEdit
()
{
this
.
foodWaveBean
.
saveTemplate
(
template
);
}
public
void
initTemplateList
()
{
super
.
requirePermissions
(
ShopPermission
.
SHOP_FOODWAVE
);
...
...
@@ -100,6 +104,8 @@ public class FoodWaveView extends GenericCDIView {
{
template
=
foodWaveBean
.
findTemplate
(
templateId
);
createNewProductSkeleton
();
// prepare to make new foodwaves
selectedFoodWave
=
new
FoodWave
();
selectedFoodWave
.
setTemplate
(
template
);
...
...
@@ -202,8 +208,7 @@ public class FoodWaveView extends GenericCDIView {
}
public
void
removeProductFromList
(
Product
product
)
{
template
.
getProducts
().
remove
(
product
);
template
=
foodWaveBean
.
removeProductFromTemplate
(
product
,
template
);
}
public
Date
getStartDate
()
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment