    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.Font;
    018    import nextapp.echo2.app.Insets;
    019    import nextapp.echo2.app.Row;
    020    import ch.uzh.ifi.attempto.acewiki.Wiki;
    021    import ch.uzh.ifi.attempto.acewiki.gui.Title;
    022    import ch.uzh.ifi.attempto.echocomp.SolidLabel;
    023
    024    /**
    025     * This page shows an error message. It is used if a page should be shown that does not
    026     * exist anymore, e.g. because its ontology element has been deleted.
    027     *
    028     * @author Tobias Kuhn
    029     */
    030    public class ErrorPage extends WikiPage {
    031
    032            private static final long serialVersionUID = -3853876045940143810L;
    033
    034            private String text;
    035
    036            /**
    037             * Creates a new error page.
    038             *
    039             * @param wiki The wiki instance.
    040             * @param text The error text.
    041             */
    042            public ErrorPage(Wiki wiki, String text) {
    043                    super(wiki, new Title("Error", true));
    044                    this.text = text;
    045
    046                    Row textRow = new Row();
    047                    textRow.setInsets(new Insets(10, 10, 0, 15));
    048                    textRow.add(new SolidLabel(text, Font.ITALIC));
    049                    add(textRow);
    050            }
    051
    052            public boolean equals(Object obj) {
    053                    if (obj instanceof ErrorPage) {
    054                            return text.equals(((ErrorPage) obj).text);
    055                    }
    056                    return false;
    057            }
    058
    059            public String toString() {
    060                    return "-ERROR-";
    061            }
    062
    063    }