001    // This file is part of the Attempto Java Packages.
002    // Copyright 2008, Attempto Group, University of Zurich (see http://attempto.ifi.uzh.ch).
003    //
004    // The Attempto Java Packages is free software: you can redistribute it and/or modify it under the
005    // terms of the GNU Lesser General Public License as published by the Free Software Foundation,
006    // either version 3 of the License, or (at your option) any later version.
007    //
008    // The Attempto Java Packages is distributed in the hope that it will be useful, but WITHOUT ANY
009    // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
010    // PURPOSE. See the GNU Lesser General Public License for more details.
011    //
012    // You should have received a copy of the GNU Lesser General Public License along with the Attempto
013    // Java Packages. If not, see http://www.gnu.org/licenses/.
014    
015    package ch.uzh.ifi.attempto.acewiki.gui.page;
016    
017    import nextapp.echo2.app.event.ActionEvent;
018    import ch.uzh.ifi.attempto.acewiki.Wiki;
019    import ch.uzh.ifi.attempto.acewiki.core.ontology.Individual;
020    import ch.uzh.ifi.attempto.acewiki.core.ontology.OntologyElement;
021    import ch.uzh.ifi.attempto.acewiki.core.ontology.Sentence;
022    import ch.uzh.ifi.attempto.acewiki.gui.editor.SentenceEditorHandler;
023    
024    /**
025     * This class stands for an article page showing the article of an individual. Individuals
026     * are represented by proper names.
027     * 
028     * @author Tobias Kuhn
029     */
030    public class IndividualPage extends ArticlePage {
031            
032            private static final long serialVersionUID = 8411734605383577958L;
033    
034            private Individual ind;
035            
036            /**
037             * Creates a new article page for an individual.
038             * 
039             * @param ind The individual.
040             * @param wiki The wiki instance.
041             */
042            public IndividualPage(Individual ind, Wiki wiki) {
043                    super(wiki, ind);
044                    this.ind = ind;
045                    
046                    addTab("Assignments", this);
047                    
048                    update();
049            }
050            
051            public OntologyElement getOntologyElement() {
052                    return ind;
053            }
054    
055            public void actionPerformed(ActionEvent e) {
056                    super.actionPerformed(e);
057                    if ("Assignments".equals(e.getActionCommand())) {
058                            getWiki().showPage(new AssignmentsPage(this));
059                    }
060            }
061            
062            protected void doUpdate() {
063                    super.doUpdate();
064                    
065                    getTitle().setText(ind.getHeadword());
066            }
067            
068            public void edit(Sentence sentence) {
069                    if (ind.getSentences().contains(sentence)) {
070                            getWiki().showWindow(SentenceEditorHandler.generatePreditorEditWindow(sentence, this));
071                    }
072            }
073    
074    }