001 // This file is part of AceWiki.
002 // Copyright 2008-2012, AceWiki developers.
003 //
004 // AceWiki is free software: you can redistribute it and/or modify it under the terms of the GNU
005 // Lesser General Public License as published by the Free Software Foundation, either version 3 of
006 // the License, or (at your option) any later version.
007 //
008 // AceWiki is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
010 // Lesser General Public License for more details.
011 //
012 // You should have received a copy of the GNU Lesser General Public License along with AceWiki. If
013 // not, see http://www.gnu.org/licenses/.
014
015 package ch.uzh.ifi.attempto.acewiki.gui;
016
017 import nextapp.echo.app.event.ActionEvent;
018 import ch.uzh.ifi.attempto.acewiki.Wiki;
019 import ch.uzh.ifi.attempto.acewiki.core.OntologyElement;
020
021 /**
022 * This class represents the start page of a wiki.
023 *
024 * @author Tobias Kuhn
025 */
026 public class StartPage extends ArticlePage {
027
028 private static final long serialVersionUID = -1528040616289818728L;
029
030 private OntologyElement oe;
031
032 /**
033 * Creates a new start page.
034 *
035 * @param wiki The wiki instance.
036 */
037 public StartPage(Wiki wiki) {
038 super(wiki, wiki.getOntology().get(0));
039
040 this.oe = wiki.getOntology().get(0);
041 getTitle().setText("Main Page");
042
043 addSelectedTab("Main Page");
044 addTab("Index", this);
045 addTab("Search", this);
046 addTab("About", this);
047 }
048
049 public void actionPerformed(ActionEvent e) {
050 super.actionPerformed(e);
051 if ("Index".equals(e.getActionCommand())) {
052 getWiki().showIndexPage();
053 } else if ("Search".equals(e.getActionCommand())) {
054 getWiki().showSearchPage();
055 } else if ("About".equals(e.getActionCommand())) {
056 getWiki().showAboutPage();
057 }
058 }
059
060 public OntologyElement getOntologyElement() {
061 return oe;
062 }
063
064 public boolean equals(Object obj) {
065 return obj instanceof StartPage;
066 }
067
068 public String toString() {
069 return "-MAIN-";
070 }
071
072 }