UTJML

edu.utep.cs.utjml.canica.jmleditor
Class JMLEditorMDI

java.lang.Object
  extended by edu.utep.cs.utjml.canica.jmleditor.JMLEditorMDI
All Implemented Interfaces:
JMLEditorable

public class JMLEditorMDI
extends Object
implements JMLEditorable

This is the controller class of the JML Editor. Its main responsiblities are to provide the services to other interface classes(StatusBarable, FileAccessable, BasicEditorable, and SearchInsertAndHighlightable classes), and implement the main services of the JMLEditorable class..

Author:
Angelica B. Perez Feb 23, 2006

Field Summary
 
Fields inherited from interface edu.utep.cs.utjml.canica.jmleditor.JMLEditorable
ERROR_MESSAGES, NO_MESSAGE
 
Constructor Summary
JMLEditorMDI(Mainable canica)
          Creates a new instance.
 
Method Summary
 void closeFile()
          Closes the active editing file in the JML editor.
 void closeFile(File file)
          Closes the file given, it first check if it is open in the JMl editor.
 File getActiveEditingFile()
          It returns the active editing file (the current file being edited in the JML editor)
 BasicEditorable getBasicEditorable()
          It returns the interface that will handle the basic editing (copy, paste, undo, redo, select all, delete, delete line, etc) in the JML editor.
 int getEditorSize()
          It returns the size (number of files opened) of the JML Editor.
 JPanel getEditorView()
          It returns the JML Editor view (see JMLEditorMDIView class) as a JPanel object.
 FileAccessable getFileAccessable()
          It returns the interface that will handle the access to files (open, new, save, save all, close , close all, save as, etc) in the JML editor.
 JTextPane getJMLTextPane()
          Returns the actual textPane of the JMLEditor.
 int getLine()
          Returns the actual Caret Line position of the active editing file.
 void getRedo()
          Redo the editing action.
 SearchInsertAndHighlightable getSearchInsertAndHighlightable()
          It returns the interface that will handle the search, insert and highlight functionalities in the JML editor.
 StatusBarable getStatusBarable()
          It returns the interface that will handle the status bar in the JML Editor.
 void getUndo()
          Undo the last editing action.
 void highlightLine(int line)
          It highlights the line of the active editing file It must be an active editing file.
 void highlightLine(int line, int col)
          It highlights the line of the active editing file It must be an active editing file.
 int insertAFile(File newFile)
          This method inserts a valid File into the View
 boolean isModified()
          Verifies if the active editing file has being modified.
 void refreshActiveEditingFile(int indexOfActiveFile)
          Based on the index given, refresh the status bar, and sets the active editing file's index.
 void saveAllFiles()
          It saves all files opened in the JML editor.
 void saveFile()
          It saves the contents of the view to the model of the active editing file.
 void saveFileAs(File newFile)
          It saves the contents of the actual JMLtextPane to a new file
 boolean setActiveEditingfile(File file)
          Sets to the JML editor this file active.
 boolean setActiveEditingfile(String fileName)
          Sets to the JML editor the first file containing this file name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMLEditorMDI

public JMLEditorMDI(Mainable canica)
Creates a new instance.

Parameters:
canical - The main class
Method Detail

insertAFile

public int insertAFile(File newFile)
This method inserts a valid File into the View

Parameters:
newFile - File
Returns:
Returns an error if the file couldn't be read or set it in the JML editor.

saveFile

public void saveFile()
It saves the contents of the view to the model of the active editing file.


saveAllFiles

public void saveAllFiles()
It saves all files opened in the JML editor.


saveFileAs

public void saveFileAs(File newFile)
It saves the contents of the actual JMLtextPane to a new file

Parameters:
newFile - File

closeFile

public void closeFile()
Closes the active editing file in the JML editor.


closeFile

public void closeFile(File file)
Closes the file given, it first check if it is open in the JMl editor.


highlightLine

public void highlightLine(int line)
It highlights the line of the active editing file It must be an active editing file.

Parameters:
line - Line number

highlightLine

public void highlightLine(int line,
                          int col)
It highlights the line of the active editing file It must be an active editing file.

Parameters:
line - Line number
col - Column number

getJMLTextPane

public JTextPane getJMLTextPane()
Returns the actual textPane of the JMLEditor.

Returns:
Actual document (from active editing file).

getLine

public int getLine()
Returns the actual Caret Line position of the active editing file.

Returns:
Actual line number.

getUndo

public void getUndo()
Undo the last editing action.


getRedo

public void getRedo()
Redo the editing action.


getEditorView

public JPanel getEditorView()
Description copied from interface: JMLEditorable
It returns the JML Editor view (see JMLEditorMDIView class) as a JPanel object.

Specified by:
getEditorView in interface JMLEditorable
Returns:
Return the Editor View object

getEditorSize

public int getEditorSize()
Description copied from interface: JMLEditorable
It returns the size (number of files opened) of the JML Editor.

Specified by:
getEditorSize in interface JMLEditorable
Returns:
Editor size.

setActiveEditingfile

public boolean setActiveEditingfile(File file)
Description copied from interface: JMLEditorable
Sets to the JML editor this file active.

Specified by:
setActiveEditingfile in interface JMLEditorable
Parameters:
file - The file to be active.

setActiveEditingfile

public boolean setActiveEditingfile(String fileName)
Description copied from interface: JMLEditorable
Sets to the JML editor the first file containing this file name.

Specified by:
setActiveEditingfile in interface JMLEditorable
Returns:
True if the file name was set active, false if not.

getActiveEditingFile

public File getActiveEditingFile()
Description copied from interface: JMLEditorable
It returns the active editing file (the current file being edited in the JML editor)

Specified by:
getActiveEditingFile in interface JMLEditorable
Returns:
Active editing file.

isModified

public boolean isModified()
Description copied from interface: JMLEditorable
Verifies if the active editing file has being modified.

Specified by:
isModified in interface JMLEditorable
Returns:
True if the actual editing file has being modified or false if it hasn't.

getStatusBarable

public StatusBarable getStatusBarable()
Description copied from interface: JMLEditorable
It returns the interface that will handle the status bar in the JML Editor.

Specified by:
getStatusBarable in interface JMLEditorable
Returns:
StatusBarable interface.

getFileAccessable

public FileAccessable getFileAccessable()
Description copied from interface: JMLEditorable
It returns the interface that will handle the access to files (open, new, save, save all, close , close all, save as, etc) in the JML editor.

Specified by:
getFileAccessable in interface JMLEditorable
Returns:
FileAccessable interface

getBasicEditorable

public BasicEditorable getBasicEditorable()
Description copied from interface: JMLEditorable
It returns the interface that will handle the basic editing (copy, paste, undo, redo, select all, delete, delete line, etc) in the JML editor.

Specified by:
getBasicEditorable in interface JMLEditorable
Returns:
BasicEditorable interface

getSearchInsertAndHighlightable

public SearchInsertAndHighlightable getSearchInsertAndHighlightable()
Description copied from interface: JMLEditorable
It returns the interface that will handle the search, insert and highlight functionalities in the JML editor.

Specified by:
getSearchInsertAndHighlightable in interface JMLEditorable
Returns:
SearchInsertAndHighlightable interface

refreshActiveEditingFile

public void refreshActiveEditingFile(int indexOfActiveFile)
Based on the index given, refresh the status bar, and sets the active editing file's index.

Parameters:
indexOfActiveFile - Index of active editing file.

UTJML

UTJML is Copyright (C) 2004-2006 by University of Texas at El Paso and is distributed under 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 release depends on code from the JML project.