net.rim.blackberry.api.bbm.platform.ui.chat.container
Class MessageListManager

java.lang.Object
  |
  +--net.rim.device.api.ui.Field
        |
        +--net.rim.device.api.ui.ScrollView
              |
              +--net.rim.device.api.ui.Manager
                    |
                    +--net.rim.blackberry.api.bbm.platform.ui.chat.container.MessageListManager
All Implemented Interfaces:
AdjustmentListener, FieldVisibleRectChangeListener, IComponent, InputMethodListener
Direct Known Subclasses:
BasicMessageListManager

public class MessageListManager
extends Manager

Manager for conversation messages. Each message knows how to draw itself. If you have a message that needs to draw itself in a specific way, you can add it to this manager by making it implement MessageFieldProvider. Your conversation should only have one instance of this manager. The border style bit will be respected for fields that are of type IncomingTextMessageField and OutgoingTextMessageField. If you want to have the same border around your field, you can use ChatBorderFactory to create the border.

Since:
BBM SDK 1.0

Field Summary
protected  VerticalFieldManager _fields
          Contains all the fields.
static int BORDER_STYLE_BUBBLE
          Bubble border around text messages.
static long MESSAGE_STYLE_GROUP_MESSAGES_SAME_SENDER
          Place consecutive messages from the same sender into one container.
static long MESSAGE_STYLE_SHOW_SENDER_DISPLAY_NAME
          Show the display name of the sender.
static int SCROLL_HOTKEY_BOTTOM
          Use this to scroll to the bottom of the manager.
static int SCROLL_HOTKEY_TOP
          Use this to scroll to the top of the manager.
 
Constructor Summary
MessageListManager(long style, long messageDisplayStyle, int borderStyle)
          Constructs an instance of the field.
 
Method Summary
protected  void addGroupedMessage(Manager lastField, MessageFieldProvider message)
          Appends the message to the last field of this manager, which is a container.
 void addMessage(MessageFieldProvider message)
          Adds a message field to the manager respecting the style specified when the manager was constructed.
protected  void addNonGroupedMessage(MessageFieldProvider message)
          Adds the message to the container of the message as returned by MessageFieldProvider.createFieldContainer(); if the container is null, uses a VerticalFieldManager.
protected  Field createDivider()
          Returns a new instance of the divider for separating the sender field from the sender's messages.
protected  Field getFields()
          Returns the manager which contains all the fields.
protected  int moveFocus(int amount, int status, int time)
          Ensures that horizontal scrolls do not leave this manager.
 void removeAllMessages()
          Remove all message fields that have been added to the manager.
 Field scroll(int flag)
          Scrolls the manager according to the flag passed.
 void scrollToField(Field field)
          Scrolls to the provided field.
protected  void sublayout(int width, int height)
          Layout the field which contains all the messages.
 

Field Detail


_fields

protected VerticalFieldManager _fields
Contains all the fields.
Since:
BBM SDK 1.0

BORDER_STYLE_BUBBLE

public static final int BORDER_STYLE_BUBBLE
Bubble border around text messages.
Since:
BBM SDK 1.0

MESSAGE_STYLE_GROUP_MESSAGES_SAME_SENDER

public static final long MESSAGE_STYLE_GROUP_MESSAGES_SAME_SENDER
Place consecutive messages from the same sender into one container.
Since:
BBM SDK 1.0

MESSAGE_STYLE_SHOW_SENDER_DISPLAY_NAME

public static final long MESSAGE_STYLE_SHOW_SENDER_DISPLAY_NAME
Show the display name of the sender.
Since:
BBM SDK 1.0

SCROLL_HOTKEY_BOTTOM

public static final int SCROLL_HOTKEY_BOTTOM
Use this to scroll to the bottom of the manager.
Since:
BBM SDK 1.0

SCROLL_HOTKEY_TOP

public static final int SCROLL_HOTKEY_TOP
Use this to scroll to the top of the manager.
Since:
BBM SDK 1.0
Constructor Detail

MessageListManager

public MessageListManager(long style,
                          long messageDisplayStyle,
                          int borderStyle)
Constructs an instance of the field. If the bubble border style is selected, the background is set to a solid color to match the background color of the bubbles. If you want to change the background color, you need to create your own bubbles.
Parameters:
style - style bit passed to the super
messageDisplayStyle - style bit dictating how message should be displayed: MESSAGE_STYLE_*
borderStyle - style bit dictating which border to use for messages: BORDER_STYLE_*
Since:
BBM SDK 1.0
Method Detail

addGroupedMessage

protected void addGroupedMessage(Manager lastField,
                                 MessageFieldProvider message)
Appends the message to the last field of this manager, which is a container.
Parameters:
lastField - last field in this manager
message - message to be added
Since:
BBM SDK 1.0

addMessage

public void addMessage(MessageFieldProvider message)
Adds a message field to the manager respecting the style specified when the manager was constructed.
Parameters:
message - message field
Since:
BBM SDK 1.0

addNonGroupedMessage

protected void addNonGroupedMessage(MessageFieldProvider message)
Adds the message to the container of the message as returned by MessageFieldProvider.createFieldContainer(); if the container is null, uses a VerticalFieldManager. Respects the border style display style bits.
Parameters:
message - message to be added
Since:
BBM SDK 1.0

createDivider

protected Field createDivider()
Returns a new instance of the divider for separating the sender field from the sender's messages.
Returns:
divider for separating the sender field name from the sender's messages
Since:
BBM SDK 1.0

getFields

protected Field getFields()
Returns the manager which contains all the fields.
Returns:
manager which contains all the fields
Since:
BBM SDK 1.0

moveFocus

protected int moveFocus(int amount,
                        int status,
                        int time)
Ensures that horizontal scrolls do not leave this manager.
Parameters:
amount - If positive, move focus forward this many index positions; if negative, move focus backwards this many index positions.
status - Trackwheel event modifiers.
time - Number of milliseconds since the device was turned on.
Returns:
Remaining scroll amount not used up, with the same sign as was originally provided with the amount parameter.
Since:
BBM SDK 1.0

removeAllMessages

public void removeAllMessages()
Remove all message fields that have been added to the manager.
Since:
BBM SDK 1.0

scroll

public Field scroll(int flag)
Scrolls the manager according to the flag passed. It does not set focus to the field that it is scrolled to automatically, but returns reference to this field, so that calling method may set the focus on this field according to its needs.
Parameters:
flag - Some identifier of the position that history manager is required to scroll to.
Returns:
Field that manager has scrolled to, or null if the flag was not recognized or field according to the flag passed was not found.
Since:
BBM SDK 1.0

scrollToField

public void scrollToField(Field field)
Scrolls to the provided field.
Parameters:
field - field to which to scroll.
Since:
BBM SDK 1.0

sublayout

protected void sublayout(int width,
                         int height)
Layout the field which contains all the messages.
Parameters:
width - available width
height - available height
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.