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