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 f1b25329
authored
May 08, 2010
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Plain Diff
committing changes
2 parents
118a735f
ed4fd0ed
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
113 additions
and
16 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceMapBean.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/PlaceMapBeanLocal.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/TestDataBeanLocal.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventMap.java
code/LanBortalWeb/WebContent/resources/tools/map/placeSelect.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/servlet/PlaceMap.java
code/LanBortalWeb/src/fi/insomnia/bortal/view/MapView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceMapBean.java
View file @
f1b2532
...
@@ -36,7 +36,6 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
...
@@ -36,7 +36,6 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
public
PlaceMapBean
()
{
public
PlaceMapBean
()
{
// TODO Auto-generated constructor stub
// TODO Auto-generated constructor stub
}
}
@EJB
@EJB
private
PlaceFacade
placeFacade
;
private
PlaceFacade
placeFacade
;
@EJB
@EJB
...
@@ -70,8 +69,9 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
...
@@ -70,8 +69,9 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
if
(
user
!=
null
)
{
if
(
user
!=
null
)
{
for
(
PlaceGroup
uplacegroup
:
user
.
getPlaceGroups
())
{
for
(
PlaceGroup
uplacegroup
:
user
.
getPlaceGroups
())
{
for
(
Place
uplace
:
uplacegroup
.
getPlaces
())
for
(
Place
uplace
:
uplacegroup
.
getPlaces
())
{
uplace
.
drawOwnedPlace
(
image
);
uplace
.
drawOwnedPlace
(
image
);
}
}
}
}
}
}
}
...
@@ -83,4 +83,6 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
...
@@ -83,4 +83,6 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
ImageIO
.
write
(
image
,
filetype
,
outputStream
);
ImageIO
.
write
(
image
,
filetype
,
outputStream
);
}
}
}
}
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/PlaceMapBeanLocal.java
View file @
f1b2532
package
fi
.
insomnia
.
bortal
.
beans
;
package
fi
.
insomnia
.
bortal
.
beans
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
javax.ejb.Local
;
import
javax.ejb.Local
;
import
fi.insomnia.bortal.model.Event
;
import
fi.insomnia.bortal.model.Event
;
import
fi.insomnia.bortal.model.Place
;
@Local
@Local
public
interface
PlaceMapBeanLocal
{
public
interface
PlaceMapBeanLocal
{
void
printPlaceMapToStream
(
OutputStream
outputStream
,
String
filetype
,
Event
event
,
Integer
mapId
,
Integer
userId
,
Integer
placeId
)
throws
IOException
;
void
printPlaceMapToStream
(
OutputStream
outputStream
,
String
filetype
,
Event
event
,
Integer
mapId
,
Integer
userId
,
Integer
placeId
)
throws
IOException
;
}
}
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/TestDataBeanLocal.java
View file @
f1b2532
...
@@ -10,7 +10,6 @@ public interface TestDataBeanLocal {
...
@@ -10,7 +10,6 @@ public interface TestDataBeanLocal {
EventMap
generateTestMap
(
Event
event
);
EventMap
generateTestMap
(
Event
event
);
void
generateTestPlaces
(
EventMap
map
);
void
generateTestPlaces
(
EventMap
map
);
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventMap.java
View file @
f1b2532
...
@@ -33,10 +33,9 @@ import org.slf4j.LoggerFactory;
...
@@ -33,10 +33,9 @@ import org.slf4j.LoggerFactory;
*/
*/
@Entity
@Entity
@Table
(
name
=
"maps"
)
@Table
(
name
=
"maps"
)
@NamedQueries
(
{
@NamedQueries
({
@NamedQuery
(
name
=
"EventMap.findAll"
,
query
=
"SELECT e FROM EventMap e"
),
@NamedQuery
(
name
=
"EventMap.findAll"
,
query
=
"SELECT e FROM EventMap e"
),
@NamedQuery
(
name
=
"EventMap.findByName"
,
query
=
"SELECT e FROM EventMap e WHERE e.name = :name"
)})
@NamedQuery
(
name
=
"EventMap.findByName"
,
query
=
"SELECT e FROM EventMap e WHERE e.name = :name"
)
})
public
class
EventMap
implements
EventChildInterface
{
public
class
EventMap
implements
EventChildInterface
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
EventMap
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
EventMap
.
class
);
...
@@ -44,21 +43,16 @@ public class EventMap implements EventChildInterface {
...
@@ -44,21 +43,16 @@ public class EventMap implements EventChildInterface {
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
@EmbeddedId
@EmbeddedId
private
EventPk
id
;
private
EventPk
id
;
@Lob
@Lob
@Column
(
name
=
"map_data"
)
@Column
(
name
=
"map_data"
)
private
byte
[]
mapData
;
private
byte
[]
mapData
;
@Column
(
name
=
"map_name"
)
@Column
(
name
=
"map_name"
)
private
String
name
;
private
String
name
;
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"map"
)
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"map"
,
fetch
=
FetchType
.
EAGER
)
private
List
<
Place
>
places
;
private
List
<
Place
>
places
=
new
ArrayList
<
Place
>();
@ManyToOne
(
optional
=
false
)
@ManyToOne
(
optional
=
false
)
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
insertable
=
false
,
updatable
=
false
,
nullable
=
false
)
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
insertable
=
false
,
updatable
=
false
,
nullable
=
false
)
private
Event
event
;
private
Event
event
;
@Version
@Version
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
private
int
jpaVersionField
=
0
;
private
int
jpaVersionField
=
0
;
...
@@ -189,4 +183,19 @@ public class EventMap implements EventChildInterface {
...
@@ -189,4 +183,19 @@ public class EventMap implements EventChildInterface {
return
event
;
return
event
;
}
}
public
Place
findPlace
(
int
x
,
int
y
)
{
for
(
Place
place
:
getPlaces
())
{
if
(
place
.
getMapX
()
<
x
&&
(
place
.
getMapX
()
+
place
.
getWidth
())
>
x
&&
place
.
getMapY
()
<
y
&&
(
place
.
getMapY
()
+
place
.
getHeight
())
>
y
)
{
return
place
;
}
}
return
null
;
}
}
}
code/LanBortalWeb/WebContent/resources/tools/map/placeSelect.xhtml
0 → 100644
View file @
f1b2532
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:composite=
"http://java.sun.com/jsf/composite"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
xmlns:tools=
"http://java.sun.com/jsf/composite/tools"
xmlns:role=
"http://java.sun.com/jsf/composite/tools/role"
>
<composite:interface>
</composite:interface>
<composite:implementation>
<h:form>
<h:commandButton
image=
"#{mapView.selectPlaceMapUrl}"
actionListener=
"#{mapView.placeSelectActionListener}"
/>
</h:form>
</composite:implementation>
</html>
code/LanBortalWeb/src/fi/insomnia/bortal/servlet/PlaceMap.java
View file @
f1b2532
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
*/
*/
package
fi
.
insomnia
.
bortal
.
servlet
;
package
fi
.
insomnia
.
bortal
.
servlet
;
import
fi.insomnia.bortal.model.Place
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.io.PrintWriter
;
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/view/MapView.java
0 → 100644
View file @
f1b2532
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package
fi
.
insomnia
.
bortal
.
view
;
import
fi.insomnia.bortal.model.EventMap
;
import
fi.insomnia.bortal.model.Place
;
import
java.util.Map
;
import
javax.faces.bean.ManagedBean
;
import
javax.faces.bean.SessionScoped
;
import
javax.faces.context.FacesContext
;
import
javax.faces.event.ActionEvent
;
/**
*
* @author tuukka
*/
@ManagedBean
(
name
=
"mapView"
)
@SessionScoped
public
class
MapView
{
private
EventMap
activeMap
;
/** Creates a new instance of MapView */
public
MapView
()
{
}
public
void
placeSelectActionListener
(
ActionEvent
e
)
{
FacesContext
context
=
FacesContext
.
getCurrentInstance
();
String
clientId
=
e
.
getComponent
().
getClientId
(
context
);
Map
requestParams
=
context
.
getExternalContext
().
getRequestParameterMap
();
int
x
=
new
Integer
((
String
)
requestParams
.
get
(
clientId
+
".x"
)).
intValue
();
int
y
=
new
Integer
((
String
)
requestParams
.
get
(
clientId
+
".y"
)).
intValue
();
Place
place
=
getActiveMap
().
findPlace
(
x
,
y
);
throw
new
UnsupportedOperationException
(
"We got place, but are doing nothing with it"
);
}
public
String
getSelectPlaceMapUrl
()
{
throw
new
UnsupportedOperationException
(
"Return map url"
);
}
/**
* @return the activeMap
*/
public
EventMap
getActiveMap
()
{
return
activeMap
;
}
/**
* @param activeMap the activeMap to set
*/
public
void
setActiveMap
(
EventMap
activeMap
)
{
this
.
activeMap
=
activeMap
;
}
}
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