com.ibm.dse.tools.workbench.gui
Class GraphicConsole

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--com.ibm.dse.tools.workbench.gui.GraphicConsole

public class GraphicConsole
extends javax.swing.JFrame
implements java.awt.event.ActionListener, java.io.DataOutput, IconNames

This class provides a graphical console to send errors, messages, etc.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Field Summary
static javax.swing.text.SimpleAttributeSet DEFAULT_ATTRIBUTE_SET
           
static javax.swing.text.SimpleAttributeSet ERROR_ATTRIBUTE_SET
           
static javax.swing.text.SimpleAttributeSet WARNING_ATTRIBUTE_SET
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.ibm.dse.tools.workbench.gui.IconNames
ATTRIBUTE, ATTRIBUTE_BIG, C_SETTINGS, C_SETTINGS_BIG, CLIENT, CLIENT_SERVER, CONSOLE, CONTEXT, DATA, DEVELOPMENT_WORKBENCH, DOMAIN, DOMAIN_BIG, ENTITY, ENTITY_BIG, ERROR, FILE, FOLDER_CLOSED, FOLDER_OPENED, FORMAT, GROUP, GROUP_BIG, GROUP_CLOSED, GROUP_OPENED, INSTANCE, INSTANCE_BIG, INSTANCE_CLOSED, INSTANCE_OPENED, LIST_VIEW, NONE, OPEN, OPERATION, PROCESS, PROPERTY, PROPERTY_BIG, REPOSITORY, REPOSITORY_BIG, SERVER, SETTINGS, STANDALONE, TREE_VIEW, USER, USERS_BIG, VERSION, VERSION_BIG, VERSION_WINDOW, VIEW, WARNING, WIZARD, WORKSPACE, WORKSPACE_BIG, WORKSPACE_EXPLORER
 
Constructor Summary
GraphicConsole()
          This constructor creates a GraphicConsole object.
GraphicConsole(java.lang.String title)
          This constructor creates a GraphicConsole object with the given title.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Method to handle events for the ActionListener interface.
 void append(java.lang.String str)
          This method appends a string to the text.
 void append(java.lang.String str, javax.swing.text.AttributeSet attrs)
          This method appends a string to the text with the given attributes.
 void dispose()
          This method closes the console
 void doCopy()
          This method copies the selected text in the system clipboard.
 void doSaveAs()
          This method saves the text in the console to a file.
static GraphicConsole getConsole()
          Returns an instance of GraphicConsole.
static java.io.PrintStream getErr()
          This method returns a PrintStream for errors redirected to the GraphicConsole.
static java.io.PrintStream getOut()
          This method returns a PrintStream for messages redirected to the GraphicConsole.
static void handleSystemMessages(boolean handle)
          This method assign the standard error and output PrintStreams to the console or restore them.
 boolean isActive()
          This method returns true if the graphic console is active.
 void setActive(boolean active)
          This method enables or disables the console.
static void setAttributes(javax.swing.text.SimpleAttributeSet sat, java.awt.Color foreground, boolean italic, boolean bold)
          This method sets the attributes for the next outputs.
 void setTextAttributeSet(javax.swing.text.SimpleAttributeSet sas)
          This method sets the attributes of the next paragraph in the console.
 void showError(java.lang.String msg)
          This method shows and error to the console.
 void showInfo(java.lang.String msg)
          This method shows a message of information in the console.
 void showWarning(java.lang.String msg)
          This method shows a warning message to the console.
 void write(byte[] b)
          This method writes a byte array to the console.
 void write(byte[] b, int start, int len)
          This method writes a portion of the byte array in the console.
 void write(int i)
          This method writes an int in the console.
 void write(java.lang.String s)
          This method writes a string in the console.
 void writeBoolean(boolean b)
          This method writes a boolean in the console.
 void writeByte(int i)
          This method writes a byte in the console.
 void writeBytes(java.lang.String s)
          This method writes the byte representation of the given string.
 void writeChar(char c)
          This method writes a character to the console.
 void writeChar(int i)
          This method writes the character representation of the given int.
 void writeChars(java.lang.String s)
          This method writes the characters of the given string to the console.
 void writeDouble(double d)
          This method writes a double to the console.
 void writeFloat(float f)
          This method writes a float to the console.
 void writeInt(int i)
          This method writes an int to the console.
 void writeLong(long l)
          This method writes a long to the console.
 void writeShort(int i)
          This method writes a short to the console.
 void writeShort(short s)
          This method writes a short to the console.
 void writeUTF(java.lang.String s)
          This method writes an UTF string to the console.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, isResizable, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, getFocusOwner, getInputContext, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isShowing, pack, postEvent, processEvent, removeWindowListener, setCursor, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_ATTRIBUTE_SET

public static javax.swing.text.SimpleAttributeSet DEFAULT_ATTRIBUTE_SET

WARNING_ATTRIBUTE_SET

public static javax.swing.text.SimpleAttributeSet WARNING_ATTRIBUTE_SET

ERROR_ATTRIBUTE_SET

public static javax.swing.text.SimpleAttributeSet ERROR_ATTRIBUTE_SET
Constructor Detail

GraphicConsole

public GraphicConsole()
This constructor creates a GraphicConsole object.

GraphicConsole

public GraphicConsole(java.lang.String title)
This constructor creates a GraphicConsole object with the given title.
Parameters:
title - java.lang.String
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Method to handle events for the ActionListener interface.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - java.awt.event.ActionEvent

append

public void append(java.lang.String str)
This method appends a string to the text.
Parameters:
str - java.lang.String

append

public void append(java.lang.String str,
                   javax.swing.text.AttributeSet attrs)
This method appends a string to the text with the given attributes.
Parameters:
str - java.lang.String
attr - javax.swing.text.AttributeSet

dispose

public void dispose()
This method closes the console
Overrides:
dispose in class java.awt.Window

doCopy

public void doCopy()
This method copies the selected text in the system clipboard.

doSaveAs

public void doSaveAs()
This method saves the text in the console to a file.

getConsole

public static GraphicConsole getConsole()
Returns an instance of GraphicConsole.
Returns:
com.ibm.dse.tools.workbench.base.GraphicConsole

getErr

public static java.io.PrintStream getErr()
This method returns a PrintStream for errors redirected to the GraphicConsole.
Returns:
java.io.PrintStream

getOut

public static java.io.PrintStream getOut()
This method returns a PrintStream for messages redirected to the GraphicConsole.
Returns:
java.io.PrintStream

handleSystemMessages

public static void handleSystemMessages(boolean handle)
This method assign the standard error and output PrintStreams to the console or restore them.
Parameters:
handle - boolean

isActive

public boolean isActive()
This method returns true if the graphic console is active.
Returns:
boolean

setActive

public void setActive(boolean active)
This method enables or disables the console.
Parameters:
active - boolean

setAttributes

public static void setAttributes(javax.swing.text.SimpleAttributeSet sat,
                                 java.awt.Color foreground,
                                 boolean italic,
                                 boolean bold)
This method sets the attributes for the next outputs.
Parameters:
sat - com.sun.java.swing.text.SimpleAttributeSet
foreground - java.awt.Color
italic - boolean
bold - boolean

setTextAttributeSet

public void setTextAttributeSet(javax.swing.text.SimpleAttributeSet sas)
This method sets the attributes of the next paragraph in the console.
Parameters:
sas - com.sun.java.swing.text.SimpleAttributeSet

showError

public void showError(java.lang.String msg)
This method shows and error to the console.
Parameters:
msg - java.lang.String

showInfo

public void showInfo(java.lang.String msg)
This method shows a message of information in the console.
Parameters:
msg - java.lang.String

showWarning

public void showWarning(java.lang.String msg)
This method shows a warning message to the console.
Parameters:
msg - java.lang.String

write

public void write(byte[] b)
This method writes a byte array to the console.
Specified by:
write in interface java.io.DataOutput
Parameters:
i - int

write

public void write(byte[] b,
                  int start,
                  int len)
This method writes a portion of the byte array in the console.
Specified by:
write in interface java.io.DataOutput
Parameters:
b - byte[]
start - int
len - int

write

public void write(int i)
This method writes an int in the console.
Specified by:
write in interface java.io.DataOutput
Parameters:
i - int

write

public void write(java.lang.String s)
This method writes a string in the console.
Parameters:
i - int

writeBoolean

public void writeBoolean(boolean b)
This method writes a boolean in the console.
Specified by:
writeBoolean in interface java.io.DataOutput
Parameters:
b - boolean

writeByte

public void writeByte(int i)
This method writes a byte in the console.
Specified by:
writeByte in interface java.io.DataOutput
Parameters:
i - int

writeBytes

public void writeBytes(java.lang.String s)
This method writes the byte representation of the given string.
Specified by:
writeBytes in interface java.io.DataOutput
Parameters:
s - String

writeChar

public void writeChar(char c)
This method writes a character to the console.
Parameters:
c - char

writeChar

public void writeChar(int i)
This method writes the character representation of the given int.
Specified by:
writeChar in interface java.io.DataOutput
Parameters:
i - int

writeChars

public void writeChars(java.lang.String s)
This method writes the characters of the given string to the console.
Specified by:
writeChars in interface java.io.DataOutput
Parameters:
s - String

writeDouble

public void writeDouble(double d)
This method writes a double to the console.
Specified by:
writeDouble in interface java.io.DataOutput
Parameters:
d - double

writeFloat

public void writeFloat(float f)
This method writes a float to the console.
Specified by:
writeFloat in interface java.io.DataOutput
Parameters:
f - float

writeInt

public void writeInt(int i)
This method writes an int to the console.
Specified by:
writeInt in interface java.io.DataOutput
Parameters:
i - int

writeLong

public void writeLong(long l)
This method writes a long to the console.
Specified by:
writeLong in interface java.io.DataOutput
Parameters:
l - long

writeShort

public void writeShort(int i)
This method writes a short to the console.
Specified by:
writeShort in interface java.io.DataOutput
Parameters:
i - int

writeShort

public void writeShort(short s)
This method writes a short to the console.
Parameters:
s - short

writeUTF

public void writeUTF(java.lang.String s)
This method writes an UTF string to the console.
Specified by:
writeUTF in interface java.io.DataOutput
Parameters:
s - String