irc.gui
Class AWTSource

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--irc.gui.AWTSource
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, AWTStyleSelectorExListener, java.util.EventListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.MenuContainer, MouseWheelPanelListener, PixxScrollBarListener, java.io.Serializable, SourceListener, StyledListListener, java.awt.event.WindowListener
Direct Known Subclasses:
AWTChanList, AWTChannel, AWTDCCChat, AWTDefaultSource, AWTQuery, AWTStatus

public class AWTSource
extends java.awt.Panel
implements SourceListener, java.awt.event.ActionListener, PixxScrollBarListener, java.awt.event.FocusListener, StyledListListener, java.awt.event.WindowListener, MouseWheelPanelListener, AWTStyleSelectorExListener

The AWT source.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  IRCConfiguration _ircConfiguration
           
protected  StyledList _list
           
protected  java.awt.Panel _panel
           
protected  PixxVerticalScrollBar _scroll
           
protected  AWTStyleSelectorEx _selector
           
protected  Source _source
           
protected  java.lang.String _strippedTitle
           
protected  FormattedStringDrawer _styler
           
protected  AWTIrcTextField _textField
           
protected  java.lang.String _title
           
protected  boolean _topToBottom
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AWTSource(IRCConfiguration config, Source source)
          Create a new AWTSource.
AWTSource(IRCConfiguration config, Source source, boolean topToBottom)
          Create a new AWTSource.
 
Method Summary
 void action(java.lang.String nick, java.lang.String msg)
          A new action has been received.
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void activate()
          This source has been activated.
 void addAWTSourceListener(AWTSourceListener lis)
          Add listener.
 void channelEvent(StyledList lis, java.lang.String chan, java.awt.event.MouseEvent e)
          A mouse event has occured on a channel.
protected  void checkSound(java.lang.String msg)
          Test wether the specified line should trigger "on word" sounds.
 void clear()
          Clear this awt source display.
 void copyEvent(StyledList lis, java.lang.String txt, java.awt.event.MouseEvent e)
          A copy event has occured on a channel.
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 void fontSelected(java.awt.Font fnt)
          A new font has been selected.
 ColorContext getColorContext()
          Get color context for this awt source.
 java.lang.String getFieldText()
          Get the current textfield text.
 java.awt.Dimension getPreferredSize()
           
 java.lang.String getShortTitle()
          Get a shorter title.
 Source getSource()
          Get the source.
 java.lang.String getStrippedTitle()
          Get the stripped title.
 java.lang.String getText(int code)
          Get formatted text associated with the given text code, with no parameter.
 java.lang.String getText(int code, java.lang.String p1)
          Get formatted text associated with the given text code, with one parameter.
 java.lang.String getText(int code, java.lang.String p1, java.lang.String p2)
          Get formatted text associated with the given text code, with two parameters.
 java.lang.String getText(int code, java.lang.String p1, java.lang.String p2, java.lang.String p3)
          Get formatted text associated with the given text code, with three parameters.
 java.lang.String getTitle()
          Get the title.
 boolean isActive()
          Return the active state for this awt source.
 void leave()
          Leave this awt source.
 void messageReceived(java.lang.String source, java.lang.String str)
          A new message has been received.
 void mouseWheelMoved(java.lang.Integer amount)
          The mouse wheel moved.
protected  boolean needHighLight(java.lang.String msg)
          Test wether the specified line should be highlighted.
 void nickEvent(StyledList lis, java.lang.String nick, java.awt.event.MouseEvent e)
          A nick event has occured on a channel.
 void noticeReceived(java.lang.String from, java.lang.String msg)
          A new notice has been received.
protected  void print(java.lang.String msg)
          Print the given message on the awt source display.
protected  void print(java.lang.String msg, int color)
          Print the given message on the awt source display.
protected  void print(java.lang.String msg, int color, boolean bold, boolean underline)
          Print the given message on the awt source display.
 void release()
          Release this object.
 void removeAWTSourceListener(AWTSourceListener lis)
          Remove listener.
 void reportReceived(java.lang.String msg)
          A new report has been received.
 void setFieldText(java.lang.String txt)
          Set the current textfield text.
 void setTitle(java.lang.String title)
          Set this source title.
 void setVisible(boolean b)
           
 java.lang.String toString()
           
 void URLEvent(StyledList lis, java.lang.String url, java.awt.event.MouseEvent e)
          An url event has occured on a channel.
 void validateText()
          Validate the current textfield text, as if user pressed return key.
 void valueChanged(PixxScrollBar pixScrollBar)
          Position has changed.
 void virtualSizeChanged(StyledList lis)
          The logical width or height of the list has changed.
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_source

protected Source _source

_scroll

protected PixxVerticalScrollBar _scroll

_panel

protected java.awt.Panel _panel

_list

protected StyledList _list

_textField

protected AWTIrcTextField _textField

_styler

protected FormattedStringDrawer _styler

_title

protected java.lang.String _title

_strippedTitle

protected java.lang.String _strippedTitle

_ircConfiguration

protected IRCConfiguration _ircConfiguration

_selector

protected AWTStyleSelectorEx _selector

_topToBottom

protected boolean _topToBottom
Constructor Detail

AWTSource

public AWTSource(IRCConfiguration config,
                 Source source)
Create a new AWTSource.

Parameters:
config - the global configuration.
source - the source of this awt source.

AWTSource

public AWTSource(IRCConfiguration config,
                 Source source,
                 boolean topToBottom)
Create a new AWTSource.

Parameters:
config - the global configuration.
source - the source of this awt source.
topToBottom - true if the display should be performed from top to bottom instead of bottom to top.
Method Detail

release

public void release()
Release this object. No further call may be performed on this object.


getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class java.awt.Container

setFieldText

public void setFieldText(java.lang.String txt)
Set the current textfield text.


getFieldText

public java.lang.String getFieldText()
Get the current textfield text.

Returns:
the current textfield text.

validateText

public void validateText()
Validate the current textfield text, as if user pressed return key.


getColorContext

public ColorContext getColorContext()
Get color context for this awt source.

Returns:
color context for this awt source.

getText

public java.lang.String getText(int code)
Get formatted text associated with the given text code, with no parameter.

Parameters:
code - text code.
Returns:
formatted text.

getText

public java.lang.String getText(int code,
                                java.lang.String p1)
Get formatted text associated with the given text code, with one parameter.

Parameters:
code - text code.
p1 - first parameter.
Returns:
formatted text.

getText

public java.lang.String getText(int code,
                                java.lang.String p1,
                                java.lang.String p2)
Get formatted text associated with the given text code, with two parameters.

Parameters:
code - text code.
p1 - first parameter.
p2 - second parameter.
Returns:
formatted text.

getText

public java.lang.String getText(int code,
                                java.lang.String p1,
                                java.lang.String p2,
                                java.lang.String p3)
Get formatted text associated with the given text code, with three parameters.

Parameters:
code - text code.
p1 - first parameter.
p2 - second parameter.
p3 - third parameter.
Returns:
formatted text.

addAWTSourceListener

public void addAWTSourceListener(AWTSourceListener lis)
Add listener.

Parameters:
lis - the listener to add.

removeAWTSourceListener

public void removeAWTSourceListener(AWTSourceListener lis)
Remove listener.

Parameters:
lis - the listener to remove.

setTitle

public void setTitle(java.lang.String title)
Set this source title.


getStrippedTitle

public java.lang.String getStrippedTitle()
Get the stripped title.

Returns:
the stripped title.

getTitle

public java.lang.String getTitle()
Get the title.

Returns:
the title.

getShortTitle

public java.lang.String getShortTitle()
Get a shorter title.

Returns:
a shorter title.

getSource

public Source getSource()
Get the source.

Returns:
the source.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

fontSelected

public void fontSelected(java.awt.Font fnt)
Description copied from interface: AWTStyleSelectorExListener
A new font has been selected.

Specified by:
fontSelected in interface AWTStyleSelectorExListener
Parameters:
fnt - new selected font.

clear

public void clear()
Clear this awt source display.

Specified by:
clear in interface SourceListener

needHighLight

protected boolean needHighLight(java.lang.String msg)
Test wether the specified line should be highlighted.

Parameters:
msg - line to test.
Returns:
true if msg should be highlighted, false otherwise.

checkSound

protected void checkSound(java.lang.String msg)
Test wether the specified line should trigger "on word" sounds. Play the sounds associated with the words.

Parameters:
msg - line to test.

print

protected void print(java.lang.String msg,
                     int color,
                     boolean bold,
                     boolean underline)
Print the given message on the awt source display.

Parameters:
color - color to use.
bold - true if message should be in bold.
underline - if message should be underlined.

print

protected void print(java.lang.String msg,
                     int color)
Print the given message on the awt source display.

Parameters:
color - color to use.

print

protected void print(java.lang.String msg)
Print the given message on the awt source display.

Parameters:
msg - message to print.

messageReceived

public void messageReceived(java.lang.String source,
                            java.lang.String str)
Description copied from interface: SourceListener
A new message has been received.

Specified by:
messageReceived in interface SourceListener
Parameters:
source - source nick.
str - message.

reportReceived

public void reportReceived(java.lang.String msg)
Description copied from interface: SourceListener
A new report has been received.

Specified by:
reportReceived in interface SourceListener
Parameters:
msg - report.

noticeReceived

public void noticeReceived(java.lang.String from,
                           java.lang.String msg)
Description copied from interface: SourceListener
A new notice has been received.

Specified by:
noticeReceived in interface SourceListener
Parameters:
from - source nick.
msg - notice.

action

public void action(java.lang.String nick,
                   java.lang.String msg)
Description copied from interface: SourceListener
A new action has been received.

Specified by:
action in interface SourceListener
Parameters:
nick - source nick.
msg - message.

activate

public void activate()
Description copied from interface: SourceListener
This source has been activated.

Specified by:
activate in interface SourceListener

isActive

public boolean isActive()
Return the active state for this awt source.

Returns:
awt source active state.

leave

public void leave()
Leave this awt source.


mouseWheelMoved

public void mouseWheelMoved(java.lang.Integer amount)
Description copied from interface: MouseWheelPanelListener
The mouse wheel moved.

Specified by:
mouseWheelMoved in interface MouseWheelPanelListener
Parameters:
amount - wheel move amplitude.

valueChanged

public void valueChanged(PixxScrollBar pixScrollBar)
Description copied from interface: PixxScrollBarListener
Position has changed.

Specified by:
valueChanged in interface PixxScrollBarListener
Parameters:
pixScrollBar - scrollbar whose position has changed.

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener

channelEvent

public void channelEvent(StyledList lis,
                         java.lang.String chan,
                         java.awt.event.MouseEvent e)
Description copied from interface: StyledListListener
A mouse event has occured on a channel.

Specified by:
channelEvent in interface StyledListListener
Parameters:
lis - the source list.
chan - the channel name.
e - the mouse event associated with this event.

URLEvent

public void URLEvent(StyledList lis,
                     java.lang.String url,
                     java.awt.event.MouseEvent e)
Description copied from interface: StyledListListener
An url event has occured on a channel.

Specified by:
URLEvent in interface StyledListListener
Parameters:
lis - the source list.
url - the url name.
e - the mouse event associated with this event.

nickEvent

public void nickEvent(StyledList lis,
                      java.lang.String nick,
                      java.awt.event.MouseEvent e)
Description copied from interface: StyledListListener
A nick event has occured on a channel.

Specified by:
nickEvent in interface StyledListListener
Parameters:
lis - the source list.
nick - the nick name.
e - the mouse event associated with this event.

toString

public java.lang.String toString()
Overrides:
toString in class java.awt.Component

setVisible

public void setVisible(boolean b)
Overrides:
setVisible in class java.awt.Component

copyEvent

public void copyEvent(StyledList lis,
                      java.lang.String txt,
                      java.awt.event.MouseEvent e)
Description copied from interface: StyledListListener
A copy event has occured on a channel.

Specified by:
copyEvent in interface StyledListListener
Parameters:
lis - the source list.
txt - the copied text.
e - the mouse event associated with this event.

virtualSizeChanged

public void virtualSizeChanged(StyledList lis)
Description copied from interface: StyledListListener
The logical width or height of the list has changed.

Specified by:
virtualSizeChanged in interface StyledListListener
Parameters:
lis - the source list.

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener