/* * @(#)UndoableTreeEdit.java 3.1 25 Sep 2000 * * Copyright 2000 Voquette Inc. All Rights Reserved. * * This software is the proprietary information of VerticalNet, Inc. * Use is subject to license terms. */ import org.jdom.*; /** * Handles the undo actions for JTree. * @version 3.1 25 Sep 2000 * @author Kesav Kumar Kolla, Ruchi Kolla */ public class UndoableTreeEdit { private Element parent = null; private String action = null; private Element newElement = null; private Element oldElement = null; private String textContent = null; private int index = -1; public UndoableTreeEdit() { } /** * Constructor to initialize the instance variables. * * @param action Represents the action * @param parent Parent Element * @param newElement Represents the NewElement * @param oldElement Represents the OldElement * @param textContent Represents textContent of the element */ public UndoableTreeEdit(final String action, final Element parent, final Element newElement, final Element oldElement, int index, final String textContent) { this.action = action; this.parent = parent; this.newElement = newElement; this.oldElement = oldElement; this.index = index; this.textContent = textContent; } /** * Stores the action * * @param action */ public void setAction(final String action) { this.action = action; } /** * Returns the action * * @return Action */ public String getAction() { return this.action; } /** * Stores the Parent * * @param parent */ public void setParent(final Element parent) { this.parent = parent; } /** * Returns the parent * * @return parent */ public Element getParent() { return this.parent; } /** * Stores the NewElement * * @param newElement */ public void setNewElement(final Element newElement) { this.newElement = newElement; } /** * Retuns the newElement * * @return newElement */ public Element getNewElement() { return this.newElement; } /** * Stores the OldElement * * @param oldElement Old Element */ public void setOldElement(final Element oldElement) { this.oldElement = oldElement; } /** * Returns the OldElement * * @return Retuns the oldElement */ public Element getOldElement() { return this.oldElement; } /** * Returns the index of the child. * * @return retuns the index of the child */ public int getIndex() { return this.index; } /** * Sets the index of the child node in the parent * * @param index Index of the child */ public void setIndex(int index) { this.index = index; } /** * Returns the textcontent of the element * * @return textContent */ public String getTextContent() { return this.textContent; } /** * Sets the text content of the node * * @param textContent Text content of the element */ public void setTextContent(final String textContent) { this.textContent = textContent; } /** * String reprasentation of the object. */ public String toString() { final StringBuffer buffer = new StringBuffer(100); buffer.append(action).append("["); buffer.append(parent).append(", ").append(newElement).append(", "); buffer.append(oldElement).append(", ").append(textContent).append("]"); return buffer.toString(); } }