    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 ch.uzh.ifi.attempto.acewiki.Wiki;
    018    import ch.uzh.ifi.attempto.acewiki.core.ontology.OntologyElement;
    019    import ch.uzh.ifi.attempto.acewiki.core.ontology.Role;
    020    import ch.uzh.ifi.attempto.acewiki.core.ontology.Sentence;
    021    import ch.uzh.ifi.attempto.acewiki.gui.editor.SentenceEditorHandler;
    022    import nextapp.echo2.app.event.ActionEvent;
    023
    024    /**
    025     * This class stands for an article page showing the article of a role. Roles are represented by
    026     * verbs, of-constructs, or transitive adjectives.
    027     *
    028     * @author Tobias Kuhn
    029     */
    030    public class RolePage extends ArticlePage {
    031
    032            private static final long serialVersionUID = -7034483028750537141L;
    033
    034            private Role role;
    035
    036            /**
    037             * Creates a new article page for a role.
    038             *
    039             * @param role The role.
    040             * @param wiki The wiki instance.
    041             */
    042            public RolePage(Role role, Wiki wiki) {
    043                    super(wiki, role);
    044                    this.role = role;
    045
    046                    update();
    047            }
    048
    049            public OntologyElement getOntologyElement() {
    050                    return role;
    051            }
    052
    053            public void actionPerformed(ActionEvent e) {
    054                    super.actionPerformed(e);
    055            }
    056
    057            protected void doUpdate() {
    058                    super.doUpdate();
    059
    060                    getTitle().setText(role.getHeadword());
    061            }
    062
    063            public void edit(Sentence sentence) {
    064                    if (role.getSentences().contains(sentence)) {
    065                            getWiki().showWindow(SentenceEditorHandler.generatePreditorEditWindow(sentence, this));
    066                    }
    067            }
    068
    069    }