Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
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 52de433e
authored
Oct 25, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of codecrew.fi:bortal
2 parents
961b98f1
6704b31f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
26 deletions
code/LanBortalWeb/WebContent/useradmin/list.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserCartView.java
code/LanBortalWeb/WebContent/useradmin/list.xhtml
View file @
52de433
...
@@ -49,6 +49,7 @@
...
@@ -49,6 +49,7 @@
<div
id=
"usercart"
style=
"display: #{((userCartView.isEmpty())?'none':'block')};"
>
<div
id=
"usercart"
style=
"display: #{((userCartView.isEmpty())?'none':'block')};"
>
<h:outputText
value=
"#{i18n['usercart.cartsize']}"
/>
<h:outputText
value=
"#{i18n['usercart.cartsize']}"
/>
<h:outputText
value=
" #{userCartView.userCartSize}"
/>
<h:outputText
value=
" #{userCartView.userCartSize}"
/>
<h:commandButton
action=
"#{userCartView.clearCart}"
value=
"#{i18n['usercart.clear']}"
/>
<br
/>
<br
/>
<h:commandButton
actionListener=
"#{userSearchView.addToCart}"
value=
"#{i18n['usercart.addSearcherUsers']}"
/>
<h:commandButton
actionListener=
"#{userSearchView.addToCart}"
value=
"#{i18n['usercart.addSearcherUsers']}"
/>
<h:commandButton
action=
"#{userCartView.traverse}"
value=
"#{i18n['usercart.traverse']}"
/>
<h:commandButton
action=
"#{userCartView.traverse}"
value=
"#{i18n['usercart.traverse']}"
/>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserCartView.java
View file @
52de433
...
@@ -26,12 +26,12 @@ public class UserCartView extends GenericCDIView {
...
@@ -26,12 +26,12 @@ public class UserCartView extends GenericCDIView {
private
List
<
EventUser
>
usercart
;
private
List
<
EventUser
>
usercart
;
public
void
initView
()
public
void
initView
()
{
{
}
}
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserCartView
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserCartView
.
class
);
public
String
next
()
{
public
String
next
()
{
++
current
;
++
current
;
...
@@ -45,37 +45,34 @@ public class UserCartView extends GenericCDIView {
...
@@ -45,37 +45,34 @@ public class UserCartView extends GenericCDIView {
return
null
;
return
null
;
}
}
public
String
getUserCartSize
()
public
String
getUserCartSize
()
{
{
String
ret
=
"0"
;
String
ret
=
"0"
;
if
(
usercart
!=
null
)
if
(
usercart
!=
null
)
{
{
ret
=
Integer
.
toString
(
usercart
.
size
());
ret
=
Integer
.
toString
(
usercart
.
size
());
}
}
return
ret
;
return
ret
;
}
}
public
String
removeCurrent
()
public
String
removeCurrent
()
{
{
EventUser
removed
=
usercart
.
remove
(
current
.
intValue
());
EventUser
removed
=
usercart
.
remove
(
current
.
intValue
());
logger
.
debug
(
"Removed idx {} from usercart {}"
,
current
,
removed
);
logger
.
debug
(
"Removed idx {} from usercart {}"
,
current
,
removed
);
if
(!
usercart
.
isEmpty
())
if
(!
usercart
.
isEmpty
())
{
{
updateCurrent
();
updateCurrent
();
}
}
return
null
;
return
null
;
}
}
public
String
traverse
()
public
String
traverse
()
{
{
if
(
usercart
!=
null
)
{
current
=
0
;
current
=
0
;
updateCurrent
();
updateCurrent
();
return
"/useradmin/userCartShow"
;
return
"/useradmin/userCartShow"
;
}
else
return
"/useradmin/list"
;
}
}
public
String
saveUser
()
public
String
saveUser
()
{
{
userview
.
saveUser
();
userview
.
saveUser
();
return
null
;
return
null
;
}
}
...
@@ -84,14 +81,12 @@ public class UserCartView extends GenericCDIView {
...
@@ -84,14 +81,12 @@ public class UserCartView extends GenericCDIView {
logger
.
debug
(
"Updating current user to {}"
,
current
);
logger
.
debug
(
"Updating current user to {}"
,
current
);
if
(
current
>=
usercart
.
size
())
{
if
(
current
>=
usercart
.
size
())
{
current
=
usercart
.
size
()
-
1
;
current
=
usercart
.
size
()
-
1
;
}
else
if
(
current
<
0
)
}
else
if
(
current
<
0
)
{
{
current
=
0
;
current
=
0
;
}
}
EventUser
u
=
usercart
.
get
(
current
);
EventUser
u
=
usercart
.
get
(
current
);
logger
.
debug
(
"usercart current {}, got {}"
,
current
,
u
);
logger
.
debug
(
"usercart current {}, got {}"
,
current
,
u
);
if
(
u
!=
null
)
if
(
u
!=
null
)
{
{
userview
.
setUserid
(
u
.
getUser
().
getId
());
userview
.
setUserid
(
u
.
getUser
().
getId
());
userview
.
setUser
(
null
);
userview
.
setUser
(
null
);
userview
.
initView
();
userview
.
initView
();
...
@@ -99,8 +94,7 @@ public class UserCartView extends GenericCDIView {
...
@@ -99,8 +94,7 @@ public class UserCartView extends GenericCDIView {
}
}
public
void
addUsers
(
List
<
EventUser
>
results
)
{
public
void
addUsers
(
List
<
EventUser
>
results
)
{
if
(
usercart
==
null
)
if
(
usercart
==
null
)
{
{
usercart
=
new
ArrayList
<
EventUser
>();
usercart
=
new
ArrayList
<
EventUser
>();
}
}
usercart
.
removeAll
(
results
);
usercart
.
removeAll
(
results
);
...
@@ -108,8 +102,13 @@ public class UserCartView extends GenericCDIView {
...
@@ -108,8 +102,13 @@ public class UserCartView extends GenericCDIView {
}
}
public
boolean
isEmpty
()
public
void
clearCart
()
{
{
if
(
usercart
!=
null
)
usercart
.
clear
();
//return null;
}
public
boolean
isEmpty
()
{
return
usercart
==
null
||
usercart
.
isEmpty
();
return
usercart
==
null
||
usercart
.
isEmpty
();
}
}
...
...
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