Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Riina Antikainen
/
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 d6fa9ae9
authored
Aug 31, 2013
by
Antti Tonkyra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tournamentjuttuja
1 parent
8f92fad3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
137 additions
and
35 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/TournamentBean.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/TournamentBeanLocal.java
code/MoyaDatabase/src/fi/codecrew/moya/model/TournamentGame.java
code/MoyaWeb/WebContent/tournaments/admin/createwizard.xhtml
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentCreateView.java
code/MoyaWeb/src/fi/codecrew/moya/web/converter/TournamentGameConverter.java
code/MoyaWeb/src/fi/codecrew/moya/web/converter/TournamentRuleConverter.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/TournamentBean.java
View file @
d6fa9ae
...
@@ -38,5 +38,24 @@ public class TournamentBean implements TournamentBeanLocal {
...
@@ -38,5 +38,24 @@ public class TournamentBean implements TournamentBeanLocal {
public
List
<
TournamentGame
>
getGames
()
{
public
List
<
TournamentGame
>
getGames
()
{
return
tournamentGameFacade
.
getGames
();
return
tournamentGameFacade
.
getGames
();
}
}
@Override
public
void
createGame
(
TournamentGame
tg
)
{
tournamentGameFacade
.
create
(
tg
);
}
@Override
public
void
createRule
(
TournamentRule
tr
)
{
tournamentRuleFacade
.
create
(
tr
);
}
@Override
public
TournamentGame
findGame
(
Integer
id
)
{
return
tournamentGameFacade
.
find
(
id
);
}
@Override
public
TournamentRule
findRule
(
Integer
id
)
{
return
tournamentRuleFacade
.
find
(
id
);
}
}
}
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/TournamentBeanLocal.java
View file @
d6fa9ae
...
@@ -12,5 +12,9 @@ public interface TournamentBeanLocal {
...
@@ -12,5 +12,9 @@ public interface TournamentBeanLocal {
List
<
TournamentGame
>
getGames
();
List
<
TournamentGame
>
getGames
();
List
<
TournamentRule
>
getRulesByGame
(
TournamentGame
tg
);
List
<
TournamentRule
>
getRulesByGame
(
TournamentGame
tg
);
void
createGame
(
TournamentGame
tg
);
void
createRule
(
TournamentRule
tr
);
TournamentGame
findGame
(
Integer
id
);
TournamentRule
findRule
(
Integer
id
);
}
}
code/MoyaDatabase/src/fi/codecrew/moya/model/TournamentGame.java
View file @
d6fa9ae
...
@@ -59,4 +59,20 @@ public class TournamentGame extends GenericEntity implements Serializable {
...
@@ -59,4 +59,20 @@ public class TournamentGame extends GenericEntity implements Serializable {
public
void
setAvailableRules
(
List
<
TournamentRule
>
availableRules
)
{
public
void
setAvailableRules
(
List
<
TournamentRule
>
availableRules
)
{
this
.
availableRules
=
availableRules
;
this
.
availableRules
=
availableRules
;
}
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
LanEvent
getLanEvent
()
{
return
lanEvent
;
}
public
void
setLanEvent
(
LanEvent
lanEvent
)
{
this
.
lanEvent
=
lanEvent
;
}
}
}
code/MoyaWeb/WebContent/tournaments/admin/createwizard.xhtml
View file @
d6fa9ae
...
@@ -9,80 +9,78 @@
...
@@ -9,80 +9,78 @@
</f:metadata>
</f:metadata>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<h1>
#{i18n['
actionlog.
tournaments.admin.create_tournament']}
</h1>
<h1>
#{i18n['tournaments.admin.create_tournament']}
</h1>
<h:form>
<h:form>
<p:wizard
widgetVar=
"wiz"
flowListener=
"#{tournamentCreateView.onFlowProcess}"
>
<p:wizard
widgetVar=
"wiz"
flowListener=
"#{tournamentCreateView.onFlowProcess}"
>
<p:tab
id=
"selectGame"
title=
"#{i18n['
actionlog.
tournaments.admin.select_a_game']}"
>
<p:tab
id=
"selectGame"
title=
"#{i18n['tournaments.admin.select_a_game']}"
>
<p:panel>
<p:panel>
<h:messages
errorClass=
"error"
/>
<h:messages
errorClass=
"error"
/>
<h:panelGroup
rendered=
"#{tournamentCreateView.tournamentGames.isEmpty() eq false}"
>
<h:panelGroup
rendered=
"#{tournamentCreateView.tournamentGames.isEmpty() eq false}"
>
<h2>
#{i18n['
actionlog.
tournaments.admin.select_a_game']}
</h2>
<h2>
#{i18n['tournaments.admin.select_a_game']}
</h2>
<
p:selectOneMenu
>
<
h:selectOneMenu
value=
"#{tournamentCreateView.game}"
converter=
"#{tournamentGameConverter}"
>
<f:selectItems
va
lue=
"#{tournamentCreateView.tournamentGames}"
></f:selectItems
>
<f:selectItems
va
r=
"game"
itemLabel=
"#{game.name}"
value=
"#{tournamentCreateView.tournamentGames}"
itemValue=
"#{game.id}"
/
>
</
p
:selectOneMenu>
</
h
:selectOneMenu>
</h:panelGroup>
</h:panelGroup>
<h2>
#{i18n['
actionlog.
tournaments.admin.create_a_game']}
</h2>
<h2>
#{i18n['tournaments.admin.create_a_game']}
</h2>
<h:panelGrid
columns=
"2"
>
<h:panelGrid
columns=
"2"
>
<h:outputText
value=
"#{i18n['
actionlog.
tournaments.admin.game_name']}"
/>
<h:outputText
value=
"#{i18n['tournaments.admin.game_name']}"
/>
<h:outputText
value=
"#{i18n['
actionlog.
tournaments.admin.game_description']}"
/>
<h:outputText
value=
"#{i18n['tournaments.admin.game_description']}"
/>
<p:inputText
/>
<p:inputText
value=
"#{tournamentCreateView.tournamentGameName}"
/>
<p:inputText
/>
<p:inputText
value=
"#{tournamentCreateView.tournamentGameDescription}"
/>
<h:outputText
value=
"#{i18n['actionlog.tournaments.admin.upload_game_image']}"
/>
<h:outputText
value=
""
/>
<p:fileUpload
mode=
"simple"
/>
</h:panelGrid>
</h:panelGrid>
</p:panel>
</p:panel>
</p:tab>
</p:tab>
<p:tab
id=
"selectRuleset"
title=
"#{i18n['
actionlog.
tournaments.admin.rules']}"
>
<p:tab
id=
"selectRuleset"
title=
"#{i18n['tournaments.admin.rules']}"
>
<p:panel>
<p:panel>
<h:messages
errorClass=
"error"
/>
<h:messages
errorClass=
"error"
/>
<h2>
#{i18n['actionlog.tournaments.admin.select_a_ruleset']}
</h2>
<p:selectOneMenu>
<h:panelGroup
rendered=
"#{tournamentCreateView.tournamentRules.isEmpty() eq false}"
>
<f:selectItems
value=
"#{tournamentCreateView.tournamentRules}"
></f:selectItems>
<h2>
#{i18n['tournaments.admin.select_a_ruleset']}
</h2>
</p:selectOneMenu>
<h:selectOneMenu
value=
"#{tournamentCreateView.rules}"
converter=
"#{tournamentRuleConverter}"
>
<f:selectItems
var=
"rule"
itemLabel=
"#{rule.name}"
value=
"#{tournamentCreateView.tournamentRules}"
itemValue=
"#{rule.id}"
/>
</h:selectOneMenu>
</h:panelGroup>
<br
/>
<br
/>
<h2>
#{i18n['
actionlog.
tournaments.admin.create_new_ruleset']}
</h2>
<h2>
#{i18n['tournaments.admin.create_new_ruleset']}
</h2>
<h:outputText
value=
"#{i18n['
actionlog.
tournaments.ruleset_name']}"
/>
<h:outputText
value=
"#{i18n['tournaments.ruleset_name']}"
/>
<br
/>
<br
/>
<p:inputText
/>
<p:inputText
value=
"#{tournamentCreateView.rulesetName}"
/>
<br
/>
<br
/>
<h:outputText
value=
"#{i18n['
actionlog.
tournaments.ruleset_description']}"
/>
<h:outputText
value=
"#{i18n['tournaments.ruleset_description']}"
/>
<br
/>
<br
/>
<p:inputTextarea
/>
<p:inputTextarea
value=
"#{tournamentCreateView.rulesetDescription}"
/>
</p:panel>
</p:panel>
</p:tab>
</p:tab>
<p:tab
id=
"selectRegTimes"
title=
"#{i18n['
actionlog.
tournaments.admin.set_time_constraints']}"
>
<p:tab
id=
"selectRegTimes"
title=
"#{i18n['tournaments.admin.set_time_constraints']}"
>
<p:panel>
<p:panel>
<h:messages
errorClass=
"error"
/>
<h:messages
errorClass=
"error"
/>
<h2>
#{i18n['
actionlog.
tournaments.admin.registration_time_constraints']}
</h2>
<h2>
#{i18n['tournaments.admin.registration_time_constraints']}
</h2>
<h:panelGrid
columns=
"2"
>
<h:panelGrid
columns=
"2"
>
<h:outputText
value=
"#{i18n['
actionlog.
tournaments.registration_opens']}"
/>
<h:outputText
value=
"#{i18n['tournaments.registration_opens']}"
/>
<h:outputText
value=
"#{i18n['
actionlog.
tournaments.registration_closes']}"
/>
<h:outputText
value=
"#{i18n['tournaments.registration_closes']}"
/>
<p:calendar
stepHour=
"1"
stepMinute=
"10"
pattern=
"dd.MM.yyyy hh:mm"
/>
<p:calendar
stepHour=
"1"
stepMinute=
"10"
pattern=
"dd.MM.yyyy hh:mm"
/>
<p:calendar
stepHour=
"1"
stepMinute=
"10"
pattern=
"dd.MM.yyyy hh:mm"
/>
<p:calendar
stepHour=
"1"
stepMinute=
"10"
pattern=
"dd.MM.yyyy hh:mm"
/>
</h:panelGrid>
</h:panelGrid>
<h2>
#{i18n['
actionlog.
tournaments.admin.begin_time_constraints']}
</h2>
<h2>
#{i18n['tournaments.admin.begin_time_constraints']}
</h2>
<h:panelGrid>
<h:panelGrid>
<h:outputText
value=
"Start time"
/>
<h:outputText
value=
"Start time"
/>
<p:calendar
stepHour=
"1"
stepMinute=
"10"
pattern=
"dd.MM.yyyy hh:mm"
/>
<p:calendar
stepHour=
"1"
stepMinute=
"10"
pattern=
"dd.MM.yyyy hh:mm"
/>
</h:panelGrid>
</h:panelGrid>
</p:panel>
</p:panel>
<div
style=
"float: right;"
>
<div
style=
"float: right;"
>
<p:commandButton
icon=
"apply"
value=
"#{i18n['
actionlog.
tournaments.admin.create_tournament']}"
/>
<p:commandButton
icon=
"apply"
value=
"#{i18n['tournaments.admin.create_tournament']}"
/>
</div>
</div>
</p:tab>
</p:tab>
</p:wizard>
</p:wizard>
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentCreateView.java
View file @
d6fa9ae
...
@@ -3,6 +3,7 @@ package fi.codecrew.moya.web.cdiview.tournaments;
...
@@ -3,6 +3,7 @@ package fi.codecrew.moya.web.cdiview.tournaments;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.List
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.beans.TournamentBeanLocal
;
import
fi.codecrew.moya.beans.TournamentBeanLocal
;
import
fi.codecrew.moya.model.Role
;
import
fi.codecrew.moya.model.Role
;
import
fi.codecrew.moya.model.Tournament
;
import
fi.codecrew.moya.model.Tournament
;
...
@@ -36,6 +37,7 @@ public class TournamentCreateView extends GenericCDIView {
...
@@ -36,6 +37,7 @@ public class TournamentCreateView extends GenericCDIView {
private
String
rulesetDescription
;
private
String
rulesetDescription
;
@EJB
TournamentBeanLocal
tournamentBean
;
@EJB
TournamentBeanLocal
tournamentBean
;
@EJB
EventBeanLocal
eventBean
;
public
void
initView
()
{
public
void
initView
()
{
if
(
tournament
==
null
)
{
if
(
tournament
==
null
)
{
...
@@ -57,19 +59,33 @@ public class TournamentCreateView extends GenericCDIView {
...
@@ -57,19 +59,33 @@ public class TournamentCreateView extends GenericCDIView {
public
List
<
TournamentRule
>
getTournamentRules
()
{
public
List
<
TournamentRule
>
getTournamentRules
()
{
return
tournamentRules
;
return
tournamentRules
;
}
}
public
void
uploadListener
(
org
.
primefaces
.
event
.
FileUploadEvent
event
)
{
System
.
out
.
println
(
"ZZ"
);
}
public
String
onFlowProcess
(
FlowEvent
event
)
{
public
String
onFlowProcess
(
FlowEvent
event
)
{
switch
(
event
.
getOldStep
())
{
switch
(
event
.
getOldStep
())
{
case
"selectGame"
:
case
"selectGame"
:
if
(
tournamentGameName
.
length
()
>
0
)
{
if
(
tournamentGameName
.
length
()
>
0
)
{
// logic-create-new
// oh lurd, we want to create a new gamy now
TournamentGame
tg
=
new
TournamentGame
();
tg
.
setName
(
tournamentGameName
);
tg
.
setDescription
(
tournamentGameDescription
);
tg
.
setLanEvent
(
eventBean
.
getCurrentEvent
());
tournamentBean
.
createGame
(
tg
);
}
}
tournamentRules
=
tournamentBean
.
getRulesByGame
(
this
.
getGame
());
tournamentRules
=
tournamentBean
.
getRulesByGame
(
this
.
getGame
());
break
;
break
;
case
"selectRuleset"
:
case
"selectRuleset"
:
if
(
rulesetName
.
length
()
>
0
)
{
if
(
rulesetName
!=
null
&&
rulesetName
.
length
()
>
0
)
{
// logic-create-new
TournamentRule
tr
=
new
TournamentRule
();
tr
.
setName
(
rulesetName
);
tr
.
setDescription
(
rulesetDescription
);
tournamentBean
.
createRule
(
tr
);
}
}
break
;
break
;
}
}
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/converter/TournamentGameConverter.java
0 → 100644
View file @
d6fa9ae
package
fi
.
codecrew
.
moya
.
web
.
converter
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.RequestScoped
;
import
javax.inject.Named
;
import
fi.codecrew.moya.beans.TournamentBeanLocal
;
import
fi.codecrew.moya.beans.UserBeanLocal
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.TournamentGame
;
import
fi.codecrew.moya.utilities.jsf.GenericIntegerEntityConverter
;
@Named
@RequestScoped
public
class
TournamentGameConverter
extends
GenericIntegerEntityConverter
<
TournamentGame
>
{
@EJB
private
TournamentBeanLocal
tournamentBean
;
@Override
protected
TournamentGame
find
(
Integer
id
)
{
return
tournamentBean
.
findGame
(
id
);
}
}
code/MoyaWeb/src/fi/codecrew/moya/web/converter/TournamentRuleConverter.java
0 → 100644
View file @
d6fa9ae
package
fi
.
codecrew
.
moya
.
web
.
converter
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.RequestScoped
;
import
javax.inject.Named
;
import
fi.codecrew.moya.beans.TournamentBeanLocal
;
import
fi.codecrew.moya.beans.UserBeanLocal
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.TournamentGame
;
import
fi.codecrew.moya.model.TournamentRule
;
import
fi.codecrew.moya.utilities.jsf.GenericIntegerEntityConverter
;
@Named
@RequestScoped
public
class
TournamentRuleConverter
extends
GenericIntegerEntityConverter
<
TournamentRule
>
{
@EJB
private
TournamentBeanLocal
tournamentBean
;
@Override
protected
TournamentRule
find
(
Integer
id
)
{
return
tournamentBean
.
findRule
(
id
);
}
}
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