|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.chat.ChatOverlay
com.threerings.chat.SubtitleChatOverlay
public class SubtitleChatOverlay
Implements subtitle chat.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.threerings.chat.ChatOverlay |
|---|
ChatOverlay.InfoProvider |
| Field Summary | |
|---|---|
protected int |
_histOffset
The history offset (from 0) such that the history lines (0, _histOffset - 1) will all fit onscreen if the lowest scrollbar position is _histOffset. |
protected boolean |
_histOffsetFinal
If the history offset we've figured is all figured out or needs to be refigured. |
protected com.threerings.crowd.chat.client.HistoryList |
_history
List of existing messages from our chat director. |
protected int |
_historyExtent
A guess of how many history lines fit onscreen at a time. |
protected BoundedRangeModel |
_historyModel
If we're in history mode, this will be non-null and will notify us of our historical positioning. |
protected boolean |
_laidout
Tracks whether or not we've been laid out. |
protected long |
_lastExpire
The unbounded expire time of the last chat glyph displayed. |
protected boolean |
_overrideHistory
If set, show history no matter what the client prefs say. |
protected JScrollBar |
_scrollbar
Our history scrollbar. |
protected List<ChatGlyph> |
_showingHistory
The currently displayed subtitles O' history. |
protected int |
_subtitleHeight
The amount of vertical space to use for subtitles. |
protected List<ChatGlyph> |
_subtitles
The currently displayed subtitle areas. |
protected boolean |
_subtitlesFill
If true, subtitles should fill all available height. |
protected int |
_subtitleXSpacing
The amount of space we want around the subtitles. |
protected int |
_subtitleYSpacing
|
protected static int |
ICON_PADDING
The amount of space to insert between the icon and the text. |
protected static int |
PAD
The padding in each direction around the text to the edges of a chat 'bubble'. |
protected static int |
SUBTITLE_HEIGHT_GUESS
A guess as to the height of a subtitle (plus spacing). |
| Fields inherited from class com.threerings.chat.ChatOverlay |
|---|
_ctx, _dimmed, _logic, _provider, _target |
| Constructor Summary | |
|---|---|
|
SubtitleChatOverlay(com.threerings.crowd.util.CrowdContext ctx,
ChatLogic logic,
JScrollBar bar)
Construct a comic chat overlay using all the available space for subtitling. |
|
SubtitleChatOverlay(com.threerings.crowd.util.CrowdContext ctx,
ChatLogic logic,
JScrollBar bar,
boolean full)
|
|
SubtitleChatOverlay(com.threerings.crowd.util.CrowdContext ctx,
ChatLogic logic,
JScrollBar bar,
boolean full,
boolean overrideHistory)
|
|
SubtitleChatOverlay(com.threerings.crowd.util.CrowdContext ctx,
ChatLogic logic,
JScrollBar bar,
int subtitleHeight)
Construct a subtitle chat overlay. |
protected |
SubtitleChatOverlay(com.threerings.crowd.util.CrowdContext ctx,
ChatLogic logic,
JScrollBar bar,
int height,
boolean fill,
int xspace,
int yspace)
Shared chained constructor. |
| Method Summary | |
|---|---|
void |
added(VirtualMediaPanel target)
Indicates that the target component was added to the widget hier. |
protected void |
addSubtitle(ChatGlyph rec)
Add a subtitle for display now. |
void |
clear()
|
protected void |
clearGlyphs(List<ChatGlyph> glyphs)
Clears out the supplied list of chat glyphs. |
protected ChatGlyph |
createHistorySubtitle(int index,
Graphics2D layoutGfx)
Creates a subtitle for display in the history panel. |
protected ChatGlyph |
createSubtitle(com.threerings.crowd.chat.data.ChatMessage message,
int type,
Graphics2D layoutGfx,
boolean expires)
Create a subtitle, but don't do anything funny with it. |
protected ChatGlyph |
createSubtitle(Graphics2D gfx,
int type,
long timestamp,
Icon icon,
int indent,
String text,
boolean expires)
Create a subtitle- a line of text that goes on the bottom. |
boolean |
displayMessage(com.threerings.crowd.chat.data.ChatMessage message,
boolean alreadyDisplayed)
|
protected void |
displayMessage(com.threerings.crowd.chat.data.ChatMessage message,
Graphics2D gfx)
Display the specified message now, unless we are to ignore it. |
protected void |
displayMessage(com.threerings.crowd.chat.data.ChatMessage message,
int type,
Graphics2D layoutGfx)
Display the message after we've decided which type it is. |
protected void |
figureCurrentHistory()
Figure out which ChatMessages in the history should currently appear in the showing history. |
protected void |
figureHistoryOffset(Graphics2D gfx)
Figure out how many of the first history elements fit in our bounds such that we can set the bounds on the scrollbar correctly such that the scrolling to the smallest value just barely puts the first element onscreen. |
protected long |
getChatExpire(long timestamp,
String text)
Get the expire time for the specified chat. |
protected int |
getDisplayDurationOffset()
A hack to allow subtitle chat to display longer and comic chat to display for a normal duration. |
protected ChatGlyph |
getHistorySubtitle(int index,
Graphics2D layoutGfx)
Get the glyph for the specified history index, creating if necessary. |
protected int |
getHistorySubtitleSpacing(int index)
Determines the amount of spacing to put after a history subtitle. |
protected Graphics2D |
getTargetGraphics()
Return the current Graphics context of our target, or null if not applicable. |
protected int |
getType(com.threerings.crowd.chat.data.ChatMessage message,
boolean history)
Convert the Message class/localtype/mode into our internal type code. |
protected void |
glyphExpired(ChatGlyph glyph)
Called by a chat glyph when it has determined that it is expired. |
void |
historyUpdated(int adjustment)
|
protected boolean |
isApprovedLocalType(String localtype)
Check to see if we want to display the specified localtype. |
protected boolean |
isHistoryMode()
Are we currently in history mode? |
protected boolean |
isLaidOut()
|
void |
layout()
Layout the chat overlay inside the previously configured target component. |
void |
removed()
Indicates that the target component was removed from the widget hier. |
protected void |
resetHistoryOffset()
Reset the history offset so that it will be recalculated next time it is needed. |
protected void |
scrollUpSubtitles(int dy)
Scroll all the subtitles up by the specified amount. |
void |
setDimmed(boolean dimmed)
Set the dimmed mode of the currently displaying glyphs. |
protected void |
setHistoryEnabled(boolean historyEnabled)
Configures us for display of chat history or not. |
protected boolean |
shouldShowFromHistory(com.threerings.crowd.chat.data.ChatMessage msg,
int index)
We're looking through history to figure out what messages we should be showing, should we show the following? |
void |
stateChanged(ChangeEvent e)
|
protected void |
updateDimmed(List<? extends ChatGlyph> glyphs)
Update the chat glyphs in the specified list to be set to the current dimmed setting. |
protected void |
updateHistBar(int val)
Update the history scrollbar with the specified value. |
void |
viewDidScroll(int dx,
int dy)
Called if our containing media panel scrolled its view. |
protected void |
viewDidScroll(List<? extends ChatGlyph> glyphs,
int dx,
int dy)
Helper function for informing glyphs of the scrolled view. |
| Methods inherited from class com.threerings.chat.ChatOverlay |
|---|
getTarget, isShowing, newPlaceEntered, placeExited, setVisible, speakerDeparted, xlate, xlate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected com.threerings.crowd.chat.client.HistoryList _history
protected boolean _overrideHistory
protected List<ChatGlyph> _showingHistory
protected JScrollBar _scrollbar
protected boolean _laidout
protected BoundedRangeModel _historyModel
protected List<ChatGlyph> _subtitles
protected int _subtitleHeight
protected boolean _subtitlesFill
protected int _subtitleXSpacing
protected int _subtitleYSpacing
protected long _lastExpire
protected boolean _histOffsetFinal
protected int _histOffset
protected int _historyExtent
protected static final int SUBTITLE_HEIGHT_GUESS
protected static final int ICON_PADDING
protected static final int PAD
| Constructor Detail |
|---|
public SubtitleChatOverlay(com.threerings.crowd.util.CrowdContext ctx,
ChatLogic logic,
JScrollBar bar,
int subtitleHeight)
subtitleHeight - the height of the subtitle area.
public SubtitleChatOverlay(com.threerings.crowd.util.CrowdContext ctx,
ChatLogic logic,
JScrollBar bar)
public SubtitleChatOverlay(com.threerings.crowd.util.CrowdContext ctx,
ChatLogic logic,
JScrollBar bar,
boolean full)
public SubtitleChatOverlay(com.threerings.crowd.util.CrowdContext ctx,
ChatLogic logic,
JScrollBar bar,
boolean full,
boolean overrideHistory)
protected SubtitleChatOverlay(com.threerings.crowd.util.CrowdContext ctx,
ChatLogic logic,
JScrollBar bar,
int height,
boolean fill,
int xspace,
int yspace)
| Method Detail |
|---|
public void historyUpdated(int adjustment)
historyUpdated in interface com.threerings.crowd.chat.client.HistoryList.Observerpublic void stateChanged(ChangeEvent e)
stateChanged in interface ChangeListenerpublic void clear()
clear in interface com.threerings.crowd.chat.client.ChatDisplay
public boolean displayMessage(com.threerings.crowd.chat.data.ChatMessage message,
boolean alreadyDisplayed)
displayMessage in interface com.threerings.crowd.chat.client.ChatDisplay
public void viewDidScroll(int dx,
int dy)
ChatOverlay
viewDidScroll in class ChatOverlaypublic void added(VirtualMediaPanel target)
ChatOverlay
added in class ChatOverlaypublic void layout()
ChatOverlay
layout in class ChatOverlaypublic void setDimmed(boolean dimmed)
ChatOverlay
setDimmed in class ChatOverlaypublic void removed()
ChatOverlay
removed in class ChatOverlayprotected void updateDimmed(List<? extends ChatGlyph> glyphs)
protected boolean isHistoryMode()
protected Graphics2D getTargetGraphics()
protected void setHistoryEnabled(boolean historyEnabled)
protected void viewDidScroll(List<? extends ChatGlyph> glyphs,
int dx,
int dy)
protected void updateHistBar(int val)
protected void resetHistoryOffset()
protected void figureHistoryOffset(Graphics2D gfx)
protected void figureCurrentHistory()
protected ChatGlyph getHistorySubtitle(int index,
Graphics2D layoutGfx)
protected ChatGlyph createHistorySubtitle(int index,
Graphics2D layoutGfx)
index - the index of the message in the history listprotected int getHistorySubtitleSpacing(int index)
index - the index of the message in the history listprotected boolean isLaidOut()
protected boolean shouldShowFromHistory(com.threerings.crowd.chat.data.ChatMessage msg,
int index)
protected void clearGlyphs(List<ChatGlyph> glyphs)
protected void displayMessage(com.threerings.crowd.chat.data.ChatMessage message,
Graphics2D gfx)
protected void displayMessage(com.threerings.crowd.chat.data.ChatMessage message,
int type,
Graphics2D layoutGfx)
protected void addSubtitle(ChatGlyph rec)
protected ChatGlyph createSubtitle(com.threerings.crowd.chat.data.ChatMessage message,
int type,
Graphics2D layoutGfx,
boolean expires)
protected ChatGlyph createSubtitle(Graphics2D gfx,
int type,
long timestamp,
Icon icon,
int indent,
String text,
boolean expires)
protected long getChatExpire(long timestamp,
String text)
protected int getDisplayDurationOffset()
protected void glyphExpired(ChatGlyph glyph)
protected int getType(com.threerings.crowd.chat.data.ChatMessage message,
boolean history)
protected boolean isApprovedLocalType(String localtype)
protected void scrollUpSubtitles(int dy)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||