/* ClientException.java * * Copyright (c) 2002, Benja Fallenstein * * You may use and distribute under the terms of either the GNU Lesser * General Public License, either version 2 of the license or, * at your choice, any later version. Alternatively, you may use and * distribute under the terms of the XPL. * * See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of * the licenses. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README * file for more details. * */ /* * Written by Benja Fallenstein */ package gzz.client; import gzz.vob.*; /** An exception that is not due to a programming error, ** but an incapability to perform the user's request. * If the computer can't do something, it needs to apologize to the * user for not understanding what they want. (This is often called * an "error message" which frightens non-power users, so let's keep * our language polite and remember if the user violated a rule, that's * only because computers are so stupid that they need all those rules...) *

* For example, the home cell cannot be deleted, as we always need * to be able to send a cursor back there; so when the user attempts * to delete the home cell, we show an apology saying, * "Sorry, I can't delete the home cell." *

* Subclasses can be created to: *

*/ public class ClientException extends Exception { protected String apology; /** Create a new ClientException. * @param The apology to render. * All apologies should start with "Sorry, ...". * For example: "Sorry, I can't hop in that direction * because there's no cell there." */ public ClientException(String apology) { super(apology); this.apology = apology; } /** Render an apology to the user into an HChain (usually the status bar). *

* @param ch The HChain to render the apology into. * @param style The text style to render the apology in. (Scale is 1.) */ public void renderApology(HChain ch, TextStyle style) { ch.addBox(new TextVob(style, apology, false, this)); } }