Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sourceforge.jsxe
Class jsXe

    java.lang.Object
      net.sourceforge.jsxe.jsXe

public class jsXe
extends Object

The main class of the java simple XML editor (jsXe)

Version:
  $Id: jsXe.java 1052 2006-07-21 19:31:46Z ian_lewis $
Author:
  Ian Lewis (IanLewis@member.fsf.org)

Field Summary
`static String` | `MIN_JAVA_VERSION` The minimum version of the Java Runtime Environment needed to run and compile jsXe
`static String` | `MIN_XERCES_VERSION` The minimum version of Xerces that is needed to run jsXe

Method Summary
`static boolean` | `closeAllDocumentBuffers(TabbedView view)` Closes all open DocumentBuffers.
`static boolean` | `closeDocumentBuffer(TabbedView view, DocumentBuffer buffer)` Closes an open DocumentBuffer.
`static boolean` | `closeDocumentBuffer(TabbedView view, DocumentBuffer buffer, boolean confirmClose)` Overloaded version of closeDocumentBuffer() method.
`static void` | `exit(TabbedView view)` Called when exiting jsXe.
`static void` | `exiterror(Object source, Object error, int errorcode)` Called when crashing jsXe.
`static TabbedView` | `getActiveView()` Gets the currently active view.
`static String` | `getAppTitle()` Gets the title of the jsXe application.
`static boolean` | `getBooleanProperty(String name, boolean defaultValue)` Gets the value of an boolean property.
`static BufferHistory` | `getBufferHistory()` Gets jsXe's buffer history.
`static String` | `getBuild()` Gets the internal build version for jsXe.
`static Date` | `getBuildDate()` Gets the date that jsXe was built as a string.
`static InputStream` | `getDefaultDocument()` Gets the default XML document in jsXe.
`static String` | `getDefaultProperty(String key)` Gets a default global property.
`static DocumentBuffer[]` | `getDocumentBuffers()` Gets an array of the open Buffers.
`static Font` | `getFontProperty(String name)` Returns the value of a font property.
`static Font` | `getFontProperty(String name, Font def)` Returns the value of a font property.
`static String` | `getHomeDirectory()` Returns the path to the user's home directory.
`static ImageIcon` | `getIcon()` Gets jsXe's icon that is displayed in the about menu, taskbar and upper left hand corner (where appropriate)
`static String` | `getInstallDirectory()` Returns the path to where jsXe is installed
`static int` | `getIntegerProperty(String key, int defaultValue)` Returns the value of an integer property.
`static DocumentBuffer` | `getOpenBuffer(File file)` Gets the DocumentBuffer for this file if the file is open already.
`static JARClassLoader` | `getPluginLoader()` Gets the plugin loader that is used to load plugins into jsXe
`static String` | `getProperty(String key)` Gets a jsXe global property.
`static String` | `getProperty(String key, String defaultValue)` Gets a jsXe global property.
`static String` | `getSettingsDirectory()` Returns the path of the directory where user-specific settings are stored.
`static String` | `getVersion()` Gets the formatted, human readable version of jsXe.
`static boolean` | `isExiting()` Indicates whether jsXe is exiting i.e.
`static void` | `main(String[] args)` The main method of jsXe
`static boolean` | `openXMLDocument(TabbedView view, File file)` Attempts to open an XML document in jsXe from a file on disk.
`static boolean` | `openXMLDocument(TabbedView view, File file, Properties properties, String viewName)` Attempts to open an XML document in jsXe from a file on disk.
`static boolean` | `openXMLDocument(TabbedView view, InputStream stream)` Attempts to open an XML document in the form of a Reader object as an untitled document.
`static boolean` | `openXMLDocument(TabbedView view, String doc)` Attempts to open an XML document in the form of a String object as an untitled document.
`static void` | `setBooleanProperty(String name, boolean value)` Sets the value of an boolean property.
`static void` | `setFontProperty(String name, Font value)` Sets the value of a font property.
`static void` | `setIntegerProperty(String name, int value)` Sets the value of an integer property.
`static Object` | `setProperty(String key, String value)` Sets a global property to jsXe.
`static boolean` | `showOpenFileDialog(TabbedView view)` Shows an open file dialog for jsXe.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MIN_JAVA_VERSION

    public static final String MIN_JAVA_VERSION

  The minimum version of the Java Runtime Environment needed to run and compile jsXe

  See Also:
    Constant Field Values

### MIN_XERCES_VERSION

    public static final String MIN_XERCES_VERSION

  The minimum version of Xerces that is needed to run jsXe

  See Also:
    Constant Field Values

Method Detail

### main

    public static void main(String[] args)

  The main method of jsXe

  Parameters:
    `args` - The command line arguments

### getBuild

    public static String getBuild()

  Gets the internal build version for jsXe. An example is 00.03.15.00

  Returns:
    a string of the form Major.Minor.Beta.Build
  Since:
    jsXe 0.3pre15

### getBuildDate

    public static Date getBuildDate()

  Gets the date that jsXe was built as a string.

  Returns:
    a date object for when jsXe was built.
  Since:
    jsXe 0.4 pre3

### getVersion

    public static String getVersion()

  Gets the formatted, human readable version of jsXe.

  Returns:
    The current version of jsXe.

### getIcon

    public static ImageIcon getIcon()

  Gets jsXe's icon that is displayed in the about menu, taskbar and upper left hand corner (where appropriate)

  Returns:
    jsXe's icon

### getInstallDirectory

    public static String getInstallDirectory()

  Returns the path to where jsXe is installed

### getHomeDirectory

    public static String getHomeDirectory()

  Returns the path to the user's home directory.

### getSettingsDirectory

    public static String getSettingsDirectory()

  Returns the path of the directory where user-specific settings are stored.

### getAppTitle

    public static String getAppTitle()

  Gets the title of the jsXe application. Most likely "jsXe"

  Returns:
    The title of the jsXe application.

### getActiveView

    public static TabbedView getActiveView()

  Gets the currently active view.

  Returns:
    the currently active view.
  Since:
    jsXe 0.4 pre1

### showOpenFileDialog

    public static boolean showOpenFileDialog(TabbedView view)
                                      throws IOException

  Shows an open file dialog for jsXe. When a file is selected jsXe attempts to open it.

  Parameters:
    `view` - The view that is to be the parent of the file dialog
  Returns:
    true if the file is selected and opened successfully.
  Throws:
    `IOException` - if the document does not validate or cannot be opened for some reason.

### openXMLDocument

    public static boolean openXMLDocument(TabbedView view,
                                          File file)
                                   throws IOException

  Attempts to open an XML document in jsXe from a file on disk. If the file is already open then the view's focus is set to that document.

  Parameters:
    `view` - The view to open the document in.
    `file` - The file to open.
  Returns:
    true if the file is opened successfully.
  Throws:
    `IOException` - if the document does not validate or cannot be opened for some reason.

### openXMLDocument

    public static boolean openXMLDocument(TabbedView view,
                                          File file,
                                          Properties properties,
                                          String viewName)
                                   throws IOException

  Attempts to open an XML document in jsXe from a file on disk. If the file is already open then the view's focus is set to that document. The properties and view name given are ignored if the document is already open. If the view name is null then the document is opened in the default DocumentView.

  Parameters:
    `view` - The view to open the document in.
    `file` - The file to open.
    `properties` - the properties to set to the new document
    `viewName` - the name of the view to open this document in
  Returns:
    true if the file is opened successfully.
  Throws:
    `IOException` - if the document does not validate or cannot be opened for some reason.

### openXMLDocument

    public static boolean openXMLDocument(TabbedView view,
                                          String doc)
                                   throws IOException

  Attempts to open an XML document in the form of a String object as an untitled document.

  Parameters:
    `view` - The view to open the document in.
    `doc` - The String document to open.
  Returns:
    true if the file is opened successfully.
  Throws:
    `IOException` - if the document does not validate or cannot be opened for some reason.

### openXMLDocument

    public static boolean openXMLDocument(TabbedView view,
                                          InputStream stream)
                                   throws IOException

  Attempts to open an XML document in the form of a Reader object as an untitled document.

  Parameters:
    `view` - The view to open the document in.
    `stream` - The stream to the document.
  Returns:
    true if the file is opened successfully.
  Throws:
    `IOException` - if the document does not validate or cannot be opened for some reason.

### getOpenBuffer

    public static DocumentBuffer getOpenBuffer(File file)

  Gets the DocumentBuffer for this file if the file is open already. Returns null if the file is not open.

  Parameters:
    `file` - The file that is open in jsXe
  Returns:
    the DocumentBuffer for the given file or null if the file not open.

### closeDocumentBuffer

    public static boolean closeDocumentBuffer(TabbedView view,
                                              DocumentBuffer buffer)
                                       throws IOException

  Closes an open DocumentBuffer. If dirty then the user will be prompted to save.

  Parameters:
    `view` - The view that contains the buffer.
    `buffer` - The buffer to close.
  Returns:
    true if the buffer was closed successfully. May return false if user hits cancel when asked to save changes.
  Throws:
    `IOException` - if the user chooses to save and the file cannot be saved because of an I/O error.

### closeDocumentBuffer

    public static boolean closeDocumentBuffer(TabbedView view,
                                              DocumentBuffer buffer,
                                              boolean confirmClose)
                                       throws IOException

  Overloaded version of closeDocumentBuffer() method. Checks to see if confirmClose is is true. If confirmClose is set to true and the file is dirty then the user will be prompted to confirm that they want to save the file and then they will be provided with a JFileChooser. If a file is dirty and confirmClose is set to false, the user will be sent directly to the JFileChooser, they won't be asked first if they want to save the file or not.

  Parameters:
    `view` - The view that contains the buffer.
    `buffer` - The buffer to close.
    `confirmClose` - Whether or not user should be asked to confirm that they want to save file, before being sent to JFileChooser.
  Returns:
    true if the buffer was closed successfully. May return false if user hits cancel when asked to save changes.
  Throws:
    `IOException` - if the user chooses to save and the file cannot be saved because of an I/O error.

### closeAllDocumentBuffers

    public static boolean closeAllDocumentBuffers(TabbedView view)
                                           throws IOException

  Closes all open DocumentBuffers. If there are any dirty files then the user will be prompted to save or close them in a single dialog.

  Parameters:
    `view` - the view that initiated the close
  Throws:
    `IOException` - if the user chooses to save and the file cannot be saved because of an I/O error

### getBufferHistory

    public static BufferHistory getBufferHistory()

  Gets jsXe's buffer history. This is the history of the of the last files that were opened by jsXe.

  Returns:
    jsXe's buffer history

### getDefaultDocument

    public static InputStream getDefaultDocument()

  Gets the default XML document in jsXe. This is necessary as XML documents cannot be blank files.

  Returns:
    jsXe's default XML document.

### getDocumentBuffers

    public static DocumentBuffer[] getDocumentBuffers()

  Gets an array of the open Buffers.

  Returns:
    An array of DocumentBuffers that jsXe currently has open.

### exit

    public static void exit(TabbedView view)

  Called when exiting jsXe.

  Parameters:
    `view` - The view from which the exit was called.

### exiterror

    public static void exiterror(Object source,
                                 Object error,
                                 int errorcode)

  Called when crashing jsXe. jsXe prints an error message and exits with the error code specifed.

  Parameters:
    `error` - The error. Either a string or Exception.
    `errorcode` - The errorcode to exit with.

### setProperty

    public static Object setProperty(String key,
                                     String value)

  Sets a global property to jsXe.

  Parameters:
    `key` - The key name for the property.
    `value` - The value to associate with the key.
  Returns:
    The previous value for the key, or null if there was none.

### getDefaultProperty

    public static final String getDefaultProperty(String key)

  Gets a default global property. Returns null if there is no default property for the given key.

### getProperty

    public static final String getProperty(String key)

  Gets a jsXe global property. This returns a user defined value for the property, the default value of the property if no user defined value is found or null if neither exist.

  Parameters:
    `key` - The key of the property to get.
  Returns:
    The value associated with the key or null if the key is not found.

### getProperty

    public static final String getProperty(String key,
                                           String defaultValue)

  Gets a jsXe global property. This returns a user defined value for the property, the default value of the property if no user defined value is found or the default value given if neither exist.

  Parameters:
    `key` - The key of the property to get.
    `defaultValue` - The default value to return when the key is not found.
  Returns:
    The value associated with the key or the default value if the key is not found.

### getIntegerProperty

    public static final int getIntegerProperty(String key,
                                               int defaultValue)

  Returns the value of an integer property.

  Since:
    jsXe 0.2 pre24

### setIntegerProperty

    public static final void setIntegerProperty(String name,
                                                int value)

  Sets the value of an integer property.

  Parameters:
    `name` - The property
    `value` - The value
  Since:
    jsXe 0.2 pre24

### getBooleanProperty

    public static final boolean getBooleanProperty(String name,
                                                   boolean defaultValue)

  Gets the value of an boolean property.

  Parameters:
    `name` - The property
    `defaultValue` - The default value of the property
  Since:
    jsXe 0.4 pre3

### setBooleanProperty

    public static final void setBooleanProperty(String name,
                                                boolean value)

  Sets the value of an boolean property.

  Parameters:
    `name` - The property
    `value` - The value
  Since:
    jsXe 0.4 pre3

### getFontProperty

    public static final Font getFontProperty(String name)

  Returns the value of a font property. The family is stored in the `name` property, the font size is stored in the `namesize` property, and the font style is stored in `namestyle`. For example, if `name` is `view.gutter.font`, the properties will be named `view.gutter.font`, `view.gutter.fontsize`, and `view.gutter.fontstyle`.

  Parameters:
    `name` - The property
  Since:
    jsXe 0.5 pre1

### getFontProperty

    public static final Font getFontProperty(String name,
                                             Font def)

  Returns the value of a font property. The family is stored in the `name` property, the font size is stored in the `namesize` property, and the font style is stored in `namestyle`. For example, if `name` is `view.gutter.font`, the properties will be named `view.gutter.font`, `view.gutter.fontsize`, and `view.gutter.fontstyle`.

  Parameters:
    `name` - The property
    `def` - The default value
  Since:
    jsXe 0.5 pre1

### setFontProperty

    public static final void setFontProperty(String name,
                                             Font value)

  Sets the value of a font property. The family is stored in the `name` property, the font size is stored in the `namesize` property, and the font style is stored in `namestyle`. For example, if `name` is `view.gutter.font`, the properties will be named `view.gutter.font`, `view.gutter.fontsize`, and `view.gutter.fontstyle`.

  Parameters:
    `name` - The property
    `value` - The value
  Since:
    jsXe 0.5 pre1

### getPluginLoader

    public static JARClassLoader getPluginLoader()

  Gets the plugin loader that is used to load plugins into jsXe

### isExiting

    public static final boolean isExiting()

  Indicates whether jsXe is exiting i.e. in the exit method.

  Returns:
    true if jsXe is exiting.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD