org.freehep.jas.plugin.console
Interface ConsoleService

All Known Implementing Classes:
ConsolePlugin

public interface ConsoleService

A service that allows for creating, writing to, and reading from Consoles.

Version:
$Id: ConsoleService.java 14500 2013-03-19 00:41:26Z tonyj $
Author:
Tony Johnson (tonyj@slac.stanford.edu)

Method Summary
 Console createConsole(String name, Icon icon)
          Create a new console.
 Console createConsole(String name, Icon icon, org.freehep.swing.popup.HasPopupItems popupItems)
          Create a new console, with extra popup items.
 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.
 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
 

Method Detail

getConsole

Console getConsole(String name)
Get a pointer to an existing console with a given name.

Parameters:
name - The name to search for
Returns:
The console, or null if no console by this name exists

createConsole

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

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.

createConsole

Console createConsole(String name,
                      Icon icon,
                      org.freehep.swing.popup.HasPopupItems popupItems)
Create a new console, with extra popup items.

Parameters:
name - The name of the newly created console
icon - An icon to associate with the console, or null for no icon.
popupItems - Allows extra popup items to be attached to console.
Returns:
The newly created console.

getConsoleOutputStream

ConsoleOutputStream getConsoleOutputStream(String name,
                                           Icon icon)
                                           throws IOException
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).

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

ConsoleOutputStream getConsoleOutputStream(String name,
                                           Icon icon,
                                           AttributeSet set)
                                           throws IOException
Create an attributed output stream

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:
getConsoleOutputStream(String, Icon)

redirectStandardOutputOnThreadToConsole

void redirectStandardOutputOnThreadToConsole(Thread thread,
                                             ConsoleOutputStream out)
Redirects output to System.out for a specific thread to a given console

Parameters:
thread - The thread for which redirection should apply
out - The output stream to redirect to

showConsole

void showConsole(Console console)
Requests that a given console be made visible

Parameters:
console - The console to be made visible

getPageContextForConsole

org.freehep.application.mdi.PageContext getPageContextForConsole(Console console)
Gets the page context corresponding to a given console.

Parameters:
console - The console
Returns:
The PageContext (or null if the console has been closed).
Since:
3.0.0


Copyright © 2013. All Rights Reserved.