Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jChatBox.Chat
Class ChatroomTimer

    java.lang.Object
      |
      +--jChatBox.Chat.ChatroomTimer

All Implemented Interfaces:
  java.lang.Runnable

public class ChatroomTimer
extends java.lang.Object
implements java.lang.Runnable

This class generates periodical chatroom events for ChatroomTimerListener. It runs (in a thread) until the matching chatroom is closed of period is set to -1. It generates trigger event before sleeping the period (milliseconds) of time.

Since:
  2.6

Constructor Summary
`ChatroomTimer(Chatroom room, ChatroomTimerListener listener)` Constructor from a given chatroom and listener.

Method Summary
`Chatroom` | `getChatroom()` Return chatroom matching the ChatroomTimer.
`ChatroomTimerListener` | `getListener()` Return listener to be notified.
`long` | `getPeriod()` Return timer's period
`void` | `run()` Main thread loop.
`void` | `setPeriod(long period)` Set period of timer.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ChatroomTimer

    public ChatroomTimer(Chatroom room,
                         ChatroomTimerListener listener)

  Constructor from a given chatroom and listener.

Parameters:
  `room` -
  `listener` -

Method Detail

### getPeriod

    public long getPeriod()

  Return timer's period

  Returns:
    period in milliseconds

### setPeriod

    public void setPeriod(long period)

  Set period of timer.

  Parameters:
    `period` - -1 will stop the timer.

### getChatroom

    public Chatroom getChatroom()

  Return chatroom matching the ChatroomTimer.

  Returns:

### getListener

    public ChatroomTimerListener getListener()

  Return listener to be notified.

  Returns:

### run

    public void run()

  Main thread loop. Run until period=-1 or matching chatroom is closed.

  Specified by:
    `run` in interface `java.lang.Runnable`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD