|
/******************************************************************************
Copyright (C) 2005 MakeLogic
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Date : 14th December 2005
Authors : MakeLogic
Design : Ujjwal
Developer : Dharma
********************************************************************************/
package com.makeLogic.utils;
//import javax.swing.JOptionPane;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.makeLogic.utils.MLInternalFrame;
import com.makeLogic.utils.SaveMenuItem;
/**
* This class will implements the methods of DocumentListener which are
* used by the MLInternalFrame class of FileMenu
*
*/
public class MLEditorListener implements DocumentListener
{
//..Declarations
SaveMenuItem saveMenuItem;
MLInternalFrame internalFrame;
//.. constructor
MLEditorListener(MLInternalFrame internalFrame)
{
//..initailizes the internalFrame flag status to true
internalFrame.setChanged(false);
//..assigns the old internalFrame to the current InternalFrame
this.internalFrame=internalFrame;
}
//..Document Handlers
//..ChangedUpdate
public void changedUpdate(DocumentEvent event)
{
//..Do this when the Document is updated
//..checks for * existance in the Tiltle
if(!internalFrame.getTitle().endsWith("*"))
{
//..Appends * to the MLInternalFrame Title
internalFrame.setTitle(internalFrame.getTitle()+"*");
//..gets the saveMenuItem
//saveMenuItem=FileMenu.getSaveMenuItem1();
saveMenuItem=(SaveMenuItem)FileMenu.getSaveMenuItem();
//..enables the save button
saveMenuItem.setEnabled(true);
//.. saves the editorPane contents into a File
}
//..changes the internalFrame flag to true
internalFrame.setChanged(true);
}
//..insertUpdate
public void insertUpdate(DocumentEvent event )
{
if(!internalFrame.getTitle().endsWith("*"))
{
//..Appends * to the MLInternalFrame Title
internalFrame.setTitle(internalFrame.getTitle()+"*");
//..gets the saveMenuItem
saveMenuItem=(SaveMenuItem)FileMenu.getSaveMenuItem();
//..enables the save button
saveMenuItem.setEnabled(true);
//.. saves the editorPane contents into a File
}
//..changes the internalFrame flag to true
internalFrame.setChanged(true);
}
//..removeUpdate
public void removeUpdate(DocumentEvent event)
{
if(!internalFrame.getTitle().endsWith("*"))
{
//..Appends * to the MLInternalFrame Title
internalFrame.setTitle(internalFrame.getTitle()+"*");
//..gets the saveMenuItem
//saveMenuItem=FileMenu.getSaveMenuItem1();
saveMenuItem=(SaveMenuItem)FileMenu.getSaveMenuItem();
//..enables the save button
saveMenuItem.setEnabled(true);
//.. saves the editorPane contents into a File
}
//..changes the internalFrame flag to true
internalFrame.setChanged(true);
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Founder of MakeLogic - A Mobile Solutions and XML Web Services Company. B-Tech engineer from India's reputed IITs.
Designed and Authored products like MicroGraphs, MakeLogic VersionManager and MakeLogic Device Broker. Pls see http://www.makelogic.com
MakeLogic is a strategic business partner of Microsoft, Sun, IBM, HP and Citrix.
Contact : madanuuk@makelogic.com OR +91 - 40 - 55322433