// XAAL toolkit // Copyright (C) 2009 Ville Karavirta // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . package xaal.objects.metadata; import java.net.MalformedURLException; import java.net.URL; /** * This class represents an application used to create the Xaal animation. This * is part of the metadata that can be used in Xaal. */ public class Application { private String name; private String version; private URL homepage; /** * Generates a new Application instance. */ public Application() { } /** * Generates a new Application instance with the given name. * * @param name Name of the application. */ public Application(String name) { this.name = name; } /** * Returns the homepage of the application. * * @return Returns the homepage. */ public String getHomepage() { if (homepage == null) return ""; return homepage.toString(); } /** * Sets the homepage of the application. * * @param homepage The homepage to set. This must be a valid URL. * @throws MalformedURLException */ public void setHomepage(String homepage) throws MalformedURLException { try { this.homepage = new URL(homepage); } catch (MalformedURLException e) { // TODO Common error handling/logging throw e; } } /** * Sets the homepage of the application. * * @param homepage The homepage to set. */ public void setHomepage(URL homepage) { this.homepage = homepage; } /** * Returns the name of the application. * * @return Returns the name. */ public String getName() { if (name == null) return ""; return name; } /** * Sets the name of the application. * * @param name The name to set. */ public void setName(String name) { this.name = name; } /** * Returns the version of the application. * * @return The version of the application. */ public String getVersion() { if (version == null) return ""; return version; } /** * Sets the version of the application. * * @param version The version to set. */ public void setVersion(String version) { this.version = version; } public String toString() { String str = getName(); if (getVersion() != null) str += " v" + getVersion(); return str; } }