2280N/A/*
2280N/A * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
2280N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2280N/A *
2280N/A * This code is free software; you can redistribute it and/or modify it
2280N/A * under the terms of the GNU General Public License version 2 only, as
2280N/A * published by the Free Software Foundation. Oracle designates this
2280N/A * particular file as subject to the "Classpath" exception as provided
2280N/A * by Oracle in the LICENSE file that accompanied this code.
2280N/A *
2280N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2280N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2280N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2280N/A * version 2 for more details (a copy is included in the LICENSE file that
2280N/A * accompanied this code).
2280N/A *
2280N/A * You should have received a copy of the GNU General Public License version
2280N/A * 2 along with this work; if not, write to the Free Software Foundation,
2280N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2280N/A *
2280N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2280N/A * or visit www.oracle.com if you need additional information or have any
2280N/A * questions.
2280N/A */
2280N/Apackage javax.swing.text.html;
2280N/A
2280N/Aimport javax.swing.text.*;
2280N/A
2280N/A
2280N/A/**
2280N/A * TextAreaDocument extends the capabilities of the PlainDocument
2280N/A * to store the data that is initially set in the Document.
2280N/A * This is stored in order to enable an accurate reset of the
2280N/A * state when a reset is requested.
2280N/A *
2280N/A * @author Sunita Mani
2280N/A */
2280N/A
2280N/Aclass TextAreaDocument extends PlainDocument {
2280N/A
2280N/A String initialText;
2280N/A
2280N/A
2280N/A /**
2280N/A * Resets the model by removing all the data,
2280N/A * and restoring it to its initial state.
2280N/A */
2280N/A void reset() {
2280N/A try {
2280N/A remove(0, getLength());
2280N/A if (initialText != null) {
2280N/A insertString(0, initialText, null);
2280N/A }
2280N/A } catch (BadLocationException e) {
2280N/A }
2280N/A }
2280N/A
2280N/A /**
2280N/A * Stores the data that the model is initially
2280N/A * loaded with.
2280N/A */
2280N/A void storeInitialText() {
2280N/A try {
2280N/A initialText = getText(0, getLength());
2280N/A } catch (BadLocationException e) {
2280N/A }
2280N/A }
2280N/A}
2280N/A