net.rim.blackberry.api.bbm.platform.ui.chat.component
Class TextMessageField

java.lang.Object
  |
  +--net.rim.device.api.ui.Field
        |
        +--net.rim.device.api.ui.component.TextField
              |
              +--net.rim.device.api.ui.component.RichTextField
                    |
                    +--net.rim.device.api.ui.component.ActiveRichTextField
                          |
                          +--net.rim.blackberry.api.bbm.platform.ui.chat.component.TextMessageField
All Implemented Interfaces:
ActiveRegionSupport.ActiveRegionFieldIf, CookieProvider, FieldLabelProvider, Formatter.TextRenderer, IComponent, IInputLocationRequests, InputMethodListener, InputMethodRequests, ITextInputStyle, MessageFieldProvider
Direct Known Subclasses:
IncomingTextMessageField, OutgoingTextMessageField

public abstract class TextMessageField
extends ActiveRichTextField
implements MessageFieldProvider

Represents a text message field. You can extend this class to make your own version of a message field.

Since:
BBM SDK 1.0

Field Summary
protected  int _borderColor
          Border color.
protected  TextMessage _message
          Text message.
 
Constructor Summary
TextMessageField(TextMessage message, int borderColor)
          Creates an instance of the field.
TextMessageField(TextMessage message, long style, int borderColor)
          Creates an instance of the field.
 
Method Summary
 Manager createFieldContainer()
          Returns new VerticalFieldManager().
 Field createSenderField()
          Returns the a simple field with the display name.
protected  void drawFocus(Graphics graphics, boolean on)
           
 int getBorderColor()
          Returns the border color.
 Field getField()
          Returns this.
 MessageSender getSender()
          Returns the sender of the message.
 String getSenderDisplayName()
          Returns the sender's display name.
 boolean isEditable()
           
abstract  boolean isIncoming()
          Indicates whether this is an incoming message.
protected  int scrollHorizontally(int amount)
           
protected  int scrollVertically(int amount)
           
 boolean shouldGroupWithLastField(Manager container)
          This message will be grouped with the last message if they are from the same sender and isIncoming() return values are equal.
 

Field Detail

_borderColor

protected int _borderColor
Border color.
Since:
BBM SDK 1.0

_message

protected TextMessage _message
Text message.
Since:
BBM SDK 1.0
Constructor Detail

TextMessageField

public TextMessageField(TextMessage message,
                        int borderColor)
Creates an instance of the field.
Parameters:
message - message that this field will display
borderColor - border color as defined in ChatBorderFactory
Since:
BBM SDK 1.0

TextMessageField

public TextMessageField(TextMessage message,
                        long style,
                        int borderColor)
Creates an instance of the field.
Parameters:
message - message that this field will display
style - style bit passed to the super implementations
borderColor - border color as defined in ChatBorderFactory
Since:
BBM SDK 1.0
Method Detail

createFieldContainer

public Manager createFieldContainer()
Returns new VerticalFieldManager().
Since:
BBM SDK 1.0
See Also:
MessageFieldProvider.createFieldContainer()

createSenderField

public Field createSenderField()
Returns the a simple field with the display name.
Since:
BBM SDK 1.0
See Also:
MessageFieldProvider.createSenderField()

drawFocus

protected void drawFocus(Graphics graphics,
                         boolean on)
Since:
BBM SDK 1.0
See Also:
ActiveRichTextField#drawFocus

getBorderColor

public int getBorderColor()
Returns the border color.
Returns:
border color
Since:
BBM SDK 1.0

getField

public Field getField()
Returns this.
Since:
BBM SDK 1.0
See Also:
MessageFieldProvider.getField()

getSender

public MessageSender getSender()
Returns the sender of the message.
Returns:
sender of the message
Since:
BBM SDK 1.0

getSenderDisplayName

public String getSenderDisplayName()
Returns the sender's display name.
Returns:
sender's display name
Since:
BBM SDK 1.0

isEditable

public boolean isEditable()
Since:
BBM SDK 1.0
See Also:
ActiveRichTextField#isEditable

isIncoming

public abstract boolean isIncoming()
Indicates whether this is an incoming message.
Returns:
true if this is an incoming message; otherwise, returns false
Since:
BBM SDK 1.0

scrollHorizontally

protected int scrollHorizontally(int amount)
Since:
BBM SDK 1.0
See Also:
ActiveRichTextField#scrollHorizontally

scrollVertically

protected int scrollVertically(int amount)
Since:
BBM SDK 1.0
See Also:
ActiveRichTextField#scrollVertically

shouldGroupWithLastField

public boolean shouldGroupWithLastField(Manager container)
This message will be grouped with the last message if they are from the same sender and isIncoming() return values are equal.
Parameters:
container - the last message is managed by this container
Returns:
true if this message should be grouped with the last message in the container; otherwise, returns false
Since:
BBM SDK 1.0



Copyright 1999- Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.