org.freehep.jas.plugin.console
Class ConsolePlugin

java.lang.Object
  extended by org.freehep.application.studio.Plugin
      extended by org.freehep.jas.plugin.console.ConsolePlugin
All Implemented Interfaces:
ConsoleService

public class ConsolePlugin
extends org.freehep.application.studio.Plugin
implements ConsoleService

The main class of the console plugin

Version:
$Id: ConsolePlugin.java 14085 2012-12-13 18:37:19Z tonyj $
Author:
tonyj

Constructor Summary
ConsolePlugin()
           
 
Method Summary
 Console createConsole(String name, Icon icon)
          Create a new console.
 Console getConsole(String name)
          Get a pointer to an existing console with a given name.
 ConsoleOutputStream getConsoleOutputStream(String name, Icon icon)
          Creates an output stream associated to a named console area.
 ConsoleOutputStream getConsoleOutputStream(String name, Icon icon, AttributeSet set)
          Create an attributed output stream
 org.freehep.application.mdi.PageContext getPageContextForConsole(Console console)
          Gets the page context corresponding to a given console.
protected  void init()
           
 void redirectStandardOutputOnThreadToConsole(Thread thread, ConsoleOutputStream out)
          Redirects output to System.out for a specific thread to a given console
 void showConsole(Console console)
          Requests that a given console be made visible
 
Methods inherited from class org.freehep.application.studio.Plugin
addMenu, applicationVisible, canBeShutDown, getApplication, postInit, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsolePlugin

public ConsolePlugin()
Method Detail

getConsole

public Console getConsole(String name)
Description copied from interface: ConsoleService
Get a pointer to an existing console with a given name.

Specified by:
getConsole in interface ConsoleService
Parameters:
name - The name to search for
Returns:
The console, or null if no console by this name exists

createConsole

public Console createConsole(String name,
                             Icon icon)
Description copied from interface: ConsoleService
Create a new console. Multiple consoles with the same name are allowed, but will render the other methods in this interface of limited use.

Specified by:
createConsole in interface ConsoleService
Parameters:
name - The name of the newly created console
icon - An icon to associate with the console, or null for no icon.
Returns:
The newly created console.

getConsoleOutputStream

public ConsoleOutputStream getConsoleOutputStream(String name,
                                                  Icon icon)
                                           throws IOException
Description copied from interface: ConsoleService
Creates an output stream associated to a named console area. All output written to the output stream will appear in the console area. More than one OutputStream can be associated with a single console area. The returned OutputStream will be thread safe, so it can be written to from any thread. Writing to this output stream will cause the corresponding console to appear if it is not visible, (or to be reopened if it has been closed).

Specified by:
getConsoleOutputStream in interface ConsoleService
Parameters:
name - The name of the console.
icon - The Icon to be used if a new console is created, or null.
Returns:
The newly created OutputStream.
Throws:
IOException - If an IO error occurs

getConsoleOutputStream

public ConsoleOutputStream getConsoleOutputStream(String name,
                                                  Icon icon,
                                                  AttributeSet set)
                                           throws IOException
Description copied from interface: ConsoleService
Create an attributed output stream

Specified by:
getConsoleOutputStream in interface ConsoleService
Parameters:
name - The name of the Console
icon - The icon to use if a new console is created, or null
set - The attributes for text created using this outputstream, or null for default attributes.
Returns:
The newly created output stream
Throws:
IOException - If an IO error occurs
See Also:
ConsoleService.getConsoleOutputStream(String, Icon)

init

protected void init()
             throws SAXException,
                    IOException
Overrides:
init in class org.freehep.application.studio.Plugin
Throws:
SAXException
IOException

redirectStandardOutputOnThreadToConsole

public void redirectStandardOutputOnThreadToConsole(Thread thread,
                                                    ConsoleOutputStream out)
Description copied from interface: ConsoleService
Redirects output to System.out for a specific thread to a given console

Specified by:
redirectStandardOutputOnThreadToConsole in interface ConsoleService
Parameters:
thread - The thread for which redirection should apply
out - The output stream to redirect to

showConsole

public void showConsole(Console console)
Description copied from interface: ConsoleService
Requests that a given console be made visible

Specified by:
showConsole in interface ConsoleService
Parameters:
console - The console to be made visible

getPageContextForConsole

public org.freehep.application.mdi.PageContext getPageContextForConsole(Console console)
Description copied from interface: ConsoleService
Gets the page context corresponding to a given console.

Specified by:
getPageContextForConsole in interface ConsoleService
Parameters:
console - The console
Returns:
The PageContext (or null if the console has been closed).


Copyright © 2013. All Rights Reserved.