|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object MessageDecoderSettings
This class acts in tandem with the MessageDecoder, to give control over how the translated output is styled. Rather than set these preferences inside the decoder object itself, this independent object allows for a single set of preferences to be shared between multiple decoders, and immediately updated across all.
The font/text settings fall into two categories. 'Default' determines the initial state of the decoder, while 'overridden' determines the settings to use to override those specified in each message.
For example, setting a default font will effect the way text is rendered for messages which do not set their fonts explicity. (Not setting this will mean that the decoder will use the default style provided by Swing.) Setting an overriding font will effect the way text is rendered for messages which carry their own font details - your overriding font will always be used in preference to the message's choosen font. (Not setting this will mean that the message fonts will be respected.)
To force all font faces to be Courier, for example, one would set both the default and the overriding font faces. This will ensure that all messages without font data will be rendered using Courier (thanks to 'default') and all messages *with* font data will also be rendered using Courier (thanks to 'override').
Setting a field to null or -1 will have the effect of disabling that style attribute. It is therefore quite possible to override message font faces, while not overriding their font size. Or to set a maximum font size for messages, but no minimum.
Fade and alt are two ways of creating highly coloured text. Fade provides a transitional effect evenly between an array of colours across a message. Alt also takes an array of colours, but instead of gradually fading from colour to colour across a message, the colours are simply alternated over and over, one per character.
Displaying highly coloured text like fade and alt can use excessive resources, so it is recommended software provides a way to switch off fade and alt decoding. (See the 'respect' methods provided.)
Constructor Summary | |
MessageDecoderSettings()
|
Method Summary | |
String |
getDefaultFontFace()
Returns default font face name, if set. |
int |
getDefaultFontSize()
Returns default font size, if set. |
Color |
getDefaultForeground()
Returns default text colour, if set. |
EmoticonLoader |
getEmoticonLoader()
Returns emoticon loader object, if set. |
boolean |
getEmoticonsDecoded()
Returns whether emoticons will be translated to icons. |
String |
getOverrideFontFace()
Returns overriding font face name, if set. |
Color |
getOverrideForeground()
Returns overriding text colour, if set. |
int |
getOverrideMaxFontSize()
Returns overriding maximum font size, if set. |
int |
getOverrideMinFontSize()
Returns overriding minimum font size, if set. |
boolean |
getRespectTextAlt()
Returns whether alt message components are respected. |
boolean |
getRespectTextFade()
Returns whether fade message components are respected. |
void |
setDefaultFont(String face,
int sz,
Color fgCol)
Convenience method for setting all default font settings at once. |
void |
setDefaultFontFace(String s)
Set the default (starting) font face. |
void |
setDefaultFontSize(int sz)
Set the default (starting) font point size. |
void |
setDefaultForeground(Color col)
Set the default (starting) text colour. |
void |
setEmoticonLoader(EmoticonLoader l)
Set an emoticon loader instance. |
void |
setEmoticonsDecoded(boolean b)
Set whether emoticons should be decoded as images, or left as text. |
void |
setOverrideFont(String face,
int min,
int max,
Color fgCol)
Convenience method for setting all overriding font settings at once. |
void |
setOverrideFontFace(String s)
Set the overriding font face. |
void |
setOverrideForeground(Color col)
Set the overriding text colour. |
void |
setOverrideMaxFontSize(int sz)
Set the overriding maximum font point size. |
void |
setOverrideMinFontSize(int sz)
Set the overriding minimum font point size. |
void |
setRespectTextAlt(boolean b)
Determines whether ALT message components will be ignored. |
void |
setRespectTextFade(boolean b)
Determines whether FADE message components will be ignored. |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MessageDecoderSettings()
Method Detail |
public void setEmoticonsDecoded(boolean b)
b
- true=translate, false=leavepublic void setEmoticonLoader(EmoticonLoader l)
EmoticonLoader
for more details. Setting this property to null disables it.
l
- class of type EmoticonLoader, or nullpublic void setDefaultFontFace(String s)
s
- name of default font, or nullpublic void setDefaultFontSize(int sz)
sz
- size of default font, or -1public void setDefaultForeground(Color col)
col
- AWT Color of default text, or nullpublic void setOverrideFontFace(String s)
s
- name of overriding font, or nullpublic void setOverrideMaxFontSize(int sz)
sz
- max size of overriding font, or -1public void setOverrideMinFontSize(int sz)
sz
- min size of overriding font, or -1public void setOverrideForeground(Color col)
col
- AWT Color of overriding text, or nullpublic void setDefaultFont(String face, int sz, Color fgCol)
face
- name of default font, or nullsz
- size of default font, or -1fgCol
- AWT Color of default text, or nullpublic void setOverrideFont(String face, int min, int max, Color fgCol)
face
- name of overriding font, or nullmin
- min size of overriding font, or -1max
- max size of overriding font, or -1fgCol
- AWT Color of overriding text, or nullpublic void setRespectTextFade(boolean b)
(Note: highly coloured text like this might greatly increase the resources required to process and display said messages in UI components.)
b
- true if fade is to be respectedpublic void setRespectTextAlt(boolean b)
(Note: highly coloured text like this might greatly increase the resources required to process and display said messages in UI components.)
b
- true if alt is to be respectedpublic boolean getEmoticonsDecoded()
public EmoticonLoader getEmoticonLoader()
public String getDefaultFontFace()
public int getDefaultFontSize()
public Color getDefaultForeground()
public String getOverrideFontFace()
public int getOverrideMaxFontSize()
public int getOverrideMinFontSize()
public Color getOverrideForeground()
public boolean getRespectTextFade()
public boolean getRespectTextAlt()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |