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 90b66102
authored
May 08, 2012
by
Juho
Committed by
Juho
May 08, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compojuttuja, createsivun UI about kunnossa
1 parent
49d04b5e
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
381 additions
and
24 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/VotingBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/CompoFacade.java
code/LanBortalWeb/WebContent/voting/compolist.xhtml
code/LanBortalWeb/WebContent/voting/create.xhtml
code/LanBortalWeb/WebContent/voting/details.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingCompoListView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingCreateView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingDateValidator.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingDetailsView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/VotingBean.java
View file @
90b6610
package
fi
.
insomnia
.
bortal
.
beans
;
import
javax.ejb.EJB
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
fi.insomnia.bortal.facade.CompoFacade
;
import
fi.insomnia.bortal.model.Compo
;
/**
* Session Bean implementation class VotingBean
*/
...
...
@@ -10,11 +14,20 @@ import javax.ejb.Stateless;
@LocalBean
public
class
VotingBean
implements
VotingBeanLocal
{
@EJB
private
CompoFacade
compoFacade
;
/**
* Default constructor.
*/
public
VotingBean
()
{
// TODO Auto-generated constructor stub
}
public
void
createCompo
(
Compo
c
)
{
compoFacade
.
create
(
c
);
}
}
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/CompoFacade.java
View file @
90b6610
package
fi
.
insomnia
.
bortal
.
facade
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
import
fi.insomnia.bortal.model.Compo
;
@Stateless
@LocalBean
public
class
CompoFacade
extends
EventChildGenericFacade
<
Compo
>
{
@PersistenceContext
private
EntityManager
em
;
public
CompoFacade
()
{
super
(
Compo
.
class
);
}
protected
EntityManager
getEm
()
{
return
em
;
}
}
package
fi
.
insomnia
.
bortal
.
facade
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
import
fi.insomnia.bortal.model.Compo
;
@Stateless
@LocalBean
public
class
CompoFacade
extends
EventChildGenericFacade
<
Compo
>
{
@PersistenceContext
private
EntityManager
em
;
public
CompoFacade
()
{
super
(
Compo
.
class
);
}
protected
EntityManager
getEm
()
{
return
em
;
}
}
code/LanBortalWeb/WebContent/voting/compolist.xhtml
0 → 100644
View file @
90b6610
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:tools=
"http://java.sun.com/jsf/composite/cditools"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:p=
"http://primefaces.org/ui"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<!-- f:event type="preRenderView" listener="#{newsListView.initView}" /-->
</f:metadata>
<ui:define
name=
"content"
>
<!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> -->
<h1>
#{i18n['voting.allcompos.header']}
</h1>
<p>
#{i18n['voting.allcompos.description']}
</p>
<div
class=
"clearfix"
></div>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/LanBortalWeb/WebContent/voting/create.xhtml
0 → 100644
View file @
90b6610
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:tools=
"http://java.sun.com/jsf/composite/cditools"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:p=
"http://primefaces.org/ui"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<!-- f:event type="preRenderView" listener="#{newsListView.initView}" /-->
</f:metadata>
<ui:define
name=
"content"
>
<!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> -->
<h1>
#{i18n['voting.create.header']}
</h1>
<p>
#{i18n['voting.create.description']}
</p>
<div>
<h:form>
<h:panelGrid
columns=
"3"
>
<h:outputLabel
value=
"Name"
for=
"name"
/>
<h:inputText
value=
"#{votingCreateView.name}"
id=
"name"
/>
<h:message
for=
"name"
/>
<h:outputLabel
value=
"Kuvaus:"
for=
"desc"
/>
<h:inputText
value=
"#{votingCreateView.description}"
id=
"desc"
/>
<h:message
for=
"desc"
/>
<h:outputLabel
value=
"Max osallistujat:"
for=
"maxPar"
/>
<h:inputText
value=
"#{votingCreateView.maxParticipants}"
id=
"maxPar"
/>
<h:message
for=
"maxPar"
/>
<h:outputLabel
value=
"Compo start"
for=
"cStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveCStart}"
value=
"#{votingCreateView.compoStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"cStart"
/>
<h:message
for=
"cStart"
/>
<h:outputLabel
value=
"Compo end"
for=
"cEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateCompo}"
value=
"#{votingCreateView.compoEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"cEnd"
/>
<h:message
for=
"cEnd"
/>
<h:outputLabel
value=
"Vote start"
for=
"vStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveVStart}"
value=
"#{votingCreateView.voteStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"vStart"
/>
<h:message
for=
"vStart"
/>
<h:outputLabel
value=
"Vote end"
for=
"vEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateVote}"
value=
"#{votingCreateView.voteEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"vEnd"
/>
<h:message
for=
"vEnd"
/>
<h:outputLabel
value=
"Submit start"
for=
"sStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveSStart}"
value=
"#{votingCreateView.submitStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"sStart"
/>
<h:message
for=
"sStart"
/>
<h:outputLabel
value=
"Submit end"
for=
"sEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateSubmit}"
value=
"#{votingCreateView.submitEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"sEnd"
/>
<h:message
for=
"sEnd"
/>
<h:commandButton
value=
"Luo"
/>
</h:panelGrid>
</h:form>
</div>
<div
class=
"clearfix"
></div>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/LanBortalWeb/WebContent/voting/details.xhtml
0 → 100644
View file @
90b6610
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:tools=
"http://java.sun.com/jsf/composite/cditools"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:p=
"http://primefaces.org/ui"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<!-- f:event type="preRenderView" listener="#{newsListView.initView}" /-->
</f:metadata>
<ui:define
name=
"content"
>
<!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> -->
<h1>
#{i18n['voting.details.header']} (KOMPON NIMI)
</h1>
<p>
Compo#{i18n['voting.details.description']}
</p>
<div
class=
"clearfix"
></div>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
View file @
90b6610
...
...
@@ -797,4 +797,13 @@ actionlog.crew=Crew
actionlog.message
=
Tapahtuma
actionlog.state
=
Tila
voting.allcompos.header
=
Kaikki compot
voting.allcompos.description
=
Tss kaikki tapahtuman compot
voting.details.header
=
Compo
voting.details.description
=
:n tiedot
voting.create.header
=
Compon luonti
voting.create.description
=
Tll sivulla luot uuden compon
>>>>>>>
0c03330e786bda2bb906720f174db192b180fced
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingCompoListView.java
0 → 100644
View file @
90b6610
package
fi
.
insomnia
.
bortal
.
web
.
cdiview
.
voting
;
import
javax.faces.bean.RequestScoped
;
import
javax.inject.Named
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
@Named
@RequestScoped
public
class
VotingCompoListView
extends
GenericCDIView
{
/**
*
*/
private
static
final
long
serialVersionUID
=
4166316634472472472L
;
}
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingCreateView.java
0 → 100644
View file @
90b6610
package
fi
.
insomnia
.
bortal
.
web
.
cdiview
.
voting
;
import
java.util.Date
;
import
javax.ejb.EJB
;
import
javax.faces.bean.ManagedBean
;
import
javax.faces.bean.RequestScoped
;
import
javax.inject.Named
;
import
javax.validation.constraints.Min
;
import
fi.insomnia.bortal.beans.VotingBeanLocal
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
@ManagedBean
@Named
@RequestScoped
public
class
VotingCreateView
extends
GenericCDIView
{
/**
*
*/
private
static
final
long
serialVersionUID
=
4677679766671547462L
;
@EJB
private
VotingBeanLocal
votbean
;
@Min
(
value
=
4
,
message
=
"Nimen pitää olla pidempi kuin 4 merkkiä."
)
private
String
name
;
private
String
description
;
@Min
(
value
=
1
,
message
=
"Min osallistujia 1."
)
private
Integer
maxParticipants
;
private
Date
compoStart
;
private
Date
compoEnd
;
private
Date
voteStart
;
private
Date
voteEnd
;
private
Date
submitStart
;
private
Date
submitEnd
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
Integer
getMaxParticipants
()
{
return
maxParticipants
;
}
public
void
setMaxParticipants
(
Integer
maxParticipants
)
{
this
.
maxParticipants
=
maxParticipants
;
}
public
Date
getCompoStart
()
{
return
compoStart
;
}
public
void
setCompoStart
(
Date
compoStart
)
{
this
.
compoStart
=
compoStart
;
}
public
Date
getCompoEnd
()
{
return
compoEnd
;
}
public
void
setCompoEnd
(
Date
compoEnd
)
{
this
.
compoEnd
=
compoEnd
;
}
public
Date
getVoteStart
()
{
return
voteStart
;
}
public
void
setVoteStart
(
Date
voteStart
)
{
this
.
voteStart
=
voteStart
;
}
public
Date
getVoteEnd
()
{
return
voteEnd
;
}
public
void
setVoteEnd
(
Date
voteEnd
)
{
this
.
voteEnd
=
voteEnd
;
}
public
Date
getSubmitStart
()
{
return
submitStart
;
}
public
void
setSubmitStart
(
Date
submitStart
)
{
this
.
submitStart
=
submitStart
;
}
public
Date
getSubmitEnd
()
{
return
submitEnd
;
}
public
void
setSubmitEnd
(
Date
submitEnd
)
{
this
.
submitEnd
=
submitEnd
;
}
}
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingDateValidator.java
0 → 100644
View file @
90b6610
package
fi
.
insomnia
.
bortal
.
web
.
cdiview
.
voting
;
import
java.io.Serializable
;
import
java.util.Date
;
import
javax.enterprise.context.RequestScoped
;
import
javax.faces.application.FacesMessage
;
import
javax.faces.component.UIComponent
;
import
javax.faces.context.FacesContext
;
import
javax.faces.validator.ValidatorException
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
org.eclipse.persistence.exceptions.ValidationException
;
import
org.hibernate.validator.util.LoggerFactory
;
import
org.slf4j.Logger
;
@Named
@RequestScoped
public
class
VotingDateValidator
implements
Serializable
{
@Inject
private
VotingCreateView
view
;
private
static
final
Logger
logger
=
org
.
slf4j
.
LoggerFactory
.
getLogger
(
VotingDateValidator
.
class
);
private
Date
cStart
;
private
Date
vStart
;
private
Date
sStart
;
public
void
validateCompo
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
//logger.info("adsda {} self {}", cStart, this);
Date
endDate
=
(
Date
)
object
;
//UIComponent foo = ui.findComponent("cStart");
//logger.info("uielement {} ", foo);
if
(
endDate
.
before
(
cStart
))
{
message
(
new
FacesMessage
(
"Loppumispvm ennen alkua. KORJAA SE."
));
}
}
public
void
saveCStart
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
//logger.info("Message: {} self {}", object, this);
cStart
=
(
Date
)
object
;
}
public
void
validateVote
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
Date
endDate
=
(
Date
)
object
;
if
(
endDate
.
before
(
vStart
))
{
message
(
new
FacesMessage
(
"Loppumispvm ennen alkua. NOT VALID."
));
}
}
public
void
saveVStart
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
vStart
=
(
Date
)
object
;
}
public
void
validateSubmit
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
Date
endDate
=
(
Date
)
object
;
if
(
endDate
.
before
(
sStart
))
{
message
(
new
FacesMessage
(
"Loppumispvm ennen aloitusta. IS AN ERROR."
));
}
}
public
void
saveSStart
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
sStart
=
(
Date
)
object
;
}
private
void
message
(
FacesMessage
msg
)
{
throw
new
ValidatorException
(
msg
);
}
public
VotingCreateView
getView
()
{
return
view
;
}
public
void
setView
(
VotingCreateView
view
)
{
this
.
view
=
view
;
}
}
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingDetailsView.java
0 → 100644
View file @
90b6610
package
fi
.
insomnia
.
bortal
.
web
.
cdiview
.
voting
;
import
javax.faces.bean.RequestScoped
;
import
javax.inject.Named
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
@Named
@RequestScoped
public
class
VotingDetailsView
extends
GenericCDIView
{
/**
*
*/
private
static
final
long
serialVersionUID
=
-
8373473936336396427L
;
}
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