LocationVO.java
001 /*
002  * Created on 02.03.2004
003  */
004 package de.fub.tip.datenanzeige.ormapper;
005 
006 import java.io.Serializable;
007 
008 import org.apache.log4j.Logger;
009 
010 import de.fub.tip.datenanzeige.Koordinate;
011 
012 /**
013  * Sinn: dient zur Anzeige eines Standortes und <br>
014  * soll die Klasse Koordinate bei der Anzeige von Daten kapseln<br>
015  <hr>
016  * History:
017  <ul>
018  <li>2004-03-18: name als String hinzugefügt- <br>
019  * damit ist es auch möglich, dass eine Location auch ein Ortsname ist</li>
020  </ul>
021  
022  @author hirsch, 02.03.2004
023  @version 2004-04-06
024  
025  * $Id: LocationVO.java,v 1.13 2004/06/11 21:52:48 hirsch Exp $
026  
027  @see de.fub.tip.datenanzeige.Koordinate
028  
029  */
030 public class LocationVO implements ViewObject, Serializable {
031   /** die zugrundeliegende Koordinate */
032   private Koordinate location = null;
033   private PictureVO picture = null;
034 
035   /** die Ortsbezeichnung (wenn vorhanden) */
036   private String name = null;
037 
038   /**
039    * Standardkonstruktor, der die Koordinate initialisiert
040    */
041   public LocationVO() {
042     this.location = new Koordinate();
043   // end of Standardkonstruktor
044   
045   /**
046    * zur Benutzung auf den Webseiten eine einfache Darstellung 
047    * der Koordinaten als geordnetes Paar mit Klammern
048    @return String - nullpointersichere String-Darstellung
049    */
050   public String toString() {
051     String ergebnis = "Name =";
052     if this.getName() != null ergebnis += this.getName();
053     ergebnis += "/";
054     if this.location != null ergebnis += this.location;
055     ergebnis += " / ";
056     if this.picture != null ergebnis += this.picture;
057     
058     return ergebnis;
059   // end of toString
060 
061   /**
062    * setzt die Koordinate neu und 
063    * berechnet die Umgebungsdaten
064    
065    @param location 
066    */
067   public void setLocation(Koordinate location) {
068     this.location = location;
069     this.location.calculateArea();
070   }
071   
072   /**
073    * Es gibt kein Setter, da man dann ein neues Objekt erzeugen soll!
074    
075    @return aktuelle Koordinate
076    */
077   public Koordinate getLocation() {
078     return location;
079   // end of getLocation
080 
081   /**
082    * Name des aktuellen Ortes, wenn vorhanden
083    @return name Name des Standorts
084    */
085   public String getName() {
086     return name;
087   }
088 
089   /**
090    * setzt den Namen des Ortes als Alternative zu Koordinaten
091    @param name Standortname
092    */
093   public void setName(String name) {
094     this.name = name;
095   }
096 
097   /**
098    * internes Logging der Komponente
099    @param log Logger, in den geschrieben werden soll
100    */
101   public void logObject(Logger log) {
102     log.debug("LocationVO.logObject( "+this.toString()+")")
103   
104   
105     /**
106      * gibt das Bild der aktuellen Position zurück, wenn vorhanden
107      @return Returns the picture.
108      */
109     public PictureVO getPicture() {
110         return this.picture;
111     }
112     
113     /**
114      * setzt das Bild des aktuellen Standorts neu
115      @param picture The picture to set.
116      */
117     public void setPicture(PictureVO picture) {
118         this.picture = picture;
119     }
120 // end of class