gov.sns.application.demo
Class Main

java.lang.Object
  |
  +--gov.sns.application.ApplicationAdaptor
        |
        +--gov.sns.application.demo.Main
All Implemented Interfaces:
ApplicationListener

public class Main
extends ApplicationAdaptor

Main is a demo concrete subclass of ApplicationAdaptor. This demo application is a simple plain text editor that demonstrates how to build a simple application using the application framework.


Field Summary
 
Fields inherited from class gov.sns.application.ApplicationAdaptor
docURLs
 
Constructor Summary
Main()
          Constructor
 
Method Summary
 void applicationFinishedLaunching()
          Capture the application launched event and print it.
 java.lang.String applicationName()
          Specifies the name of my application.
protected  void customizeCommands(Commander commander)
          Register actions for the Special menu items.
 void editPreferences(XalDocument document)
          Implement a preference panel for the document in this case.
static void main(java.lang.String[] args)
          The main method of the application.
 XalDocument newDocument(java.net.URL url)
          Implement this method to return an instance of my custom document corresponding to the specified URL.
 XalDocument newEmptyDocument()
          Implement this method to return an instance of my custom document.
 java.lang.String[] readableDocumentTypes()
          Returns the text file suffixes of files this application can open.
protected  void updateActions()
          Update the action enable states.
 java.lang.String[] writableDocumentTypes()
          Returns the text file suffixes of files this application can write.
 
Methods inherited from class gov.sns.application.ApplicationAdaptor
applicationWillQuit, documentClosed, documentCreated, getApplicationHelpPath, getApplicationInfoPath, getDocURLs, getMenuDefinitionPath, getPathToResource, getResourcesPath, setOptions, usesConsole
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Main

public Main()
Constructor

Method Detail

readableDocumentTypes

public java.lang.String[] readableDocumentTypes()
Returns the text file suffixes of files this application can open.

Specified by:
readableDocumentTypes in class ApplicationAdaptor
Returns:
Suffixes of readable files

writableDocumentTypes

public java.lang.String[] writableDocumentTypes()
Returns the text file suffixes of files this application can write.

Specified by:
writableDocumentTypes in class ApplicationAdaptor
Returns:
Suffixes of writable files

newEmptyDocument

public XalDocument newEmptyDocument()
Implement this method to return an instance of my custom document.

Specified by:
newEmptyDocument in class ApplicationAdaptor
Returns:
An instance of my custom document.

newDocument

public XalDocument newDocument(java.net.URL url)
Implement this method to return an instance of my custom document corresponding to the specified URL.

Specified by:
newDocument in class ApplicationAdaptor
Parameters:
url - The URL of the file to open.
Returns:
An instance of my custom document.

applicationName

public java.lang.String applicationName()
Specifies the name of my application.

Specified by:
applicationName in class ApplicationAdaptor
Returns:
Name of my application.

editPreferences

public void editPreferences(XalDocument document)
Implement a preference panel for the document in this case. One could implement application wide preferences or a combination of both application and document preferences. This method is optional to define. If this method is missing, the preferences menu item will be disabled. Here we demonstrate how to implement a simple preference panel for a document.

Overrides:
editPreferences in class ApplicationAdaptor
Parameters:
document - The document whose preferences are being changed. Subclass may ignore.

customizeCommands

protected void customizeCommands(Commander commander)
Register actions for the Special menu items. These actions simply print to standard output or standard error. This code demonstrates how to define custom actions for menus and the toolbar This method is optional. You may similarly define actions in the document class if those actions are document specific. Here the actions are application wide.

Overrides:
customizeCommands in class ApplicationAdaptor
Parameters:
commander - The commander with which to register the custom commands.
See Also:
Commander.registerAction(Action)

updateActions

protected void updateActions()
Update the action enable states. This method demonstrates how to enable or disable menu or toolbar items. Often this is unnecessary, but it is included to demonstrate how to do this if you wish to provide this kind of feedback to the user.


applicationFinishedLaunching

public void applicationFinishedLaunching()
Capture the application launched event and print it. This is an optional hook that can be used to do something useful at the end of the application launch.

Overrides:
applicationFinishedLaunching in class ApplicationAdaptor

main

public static void main(java.lang.String[] args)
The main method of the application.