Package jadex.tools.chat
Class ChatPanel
- java.lang.Object
- 
- jadex.base.gui.componentviewer.AbstractServiceViewerPanel<IChatGuiService>
- 
- jadex.tools.chat.ChatPanel
 
 
- 
- All Implemented Interfaces:
- IAbstractViewerPanel,- IServiceViewerPanel,- IPropertiesProvider
 
 public class ChatPanel extends AbstractServiceViewerPanel<IChatGuiService> Panel for displaying the chat.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classChatPanel.FileTableModelTable model for up/downloads.classChatPanel.FileTransferMouseAdapterMouse listener that allows to manipulate transfers.classChatPanel.UserTableModelTable model for list of users.
 - 
Field SummaryFields Modifier and Type Field Description protected booleanautorefreshThe autorefresh flag.protected booleanawayThe away state.protected javax.swing.TimerawaytimerThe away timer.protected javax.swing.JTextPanechatareaThe text area.java.text.DateFormatdfThe time format.protected java.util.Map<TransferInfo,javax.swing.JComponent>dialogsMap for panels of open accept dialogs to close when transfer has been accepted/rejected/timeouted in background.protected javax.swing.JTabledtableThe download table.protected javax.swing.JFileChooserfilechooserThe file chooser (created on demand, if local).protected JSplitPanelhorsplitThe main split panel between left and right.protected static javax.swing.UIDefaultsiconsThe icons.protected javax.swing.TimericontimerThe timer for the flashing chat icon.static java.lang.StringlfThe linefeed separator.protected JSplitPanellistpanThe split panel on left hand side.static java.lang.StringNOTIFICATION_FILE_ABORTThe notification sound for an aborted or failed file transfer.static java.lang.StringNOTIFICATION_FILE_COMPLETEThe notification sound for a successfully completed file.static java.lang.StringNOTIFICATION_MSG_FAILEDThe notification sound for a failed message.static java.lang.StringNOTIFICATION_NEW_FILEThe notification sound for an incoming file request.static java.lang.StringNOTIFICATION_NEW_MSGThe notification sound for a new message.static java.lang.StringNOTIFICATION_NEW_USERThe notification sound for a newly online user.protected static java.util.Map<java.lang.String,java.lang.String>NOTIFICATION_SOUNDSThe default notification sounds.protected java.util.Map<java.lang.String,java.lang.String>notificationsoundsThe custom notification sounds.protected javax.swing.JPanelpanelThe chat panel.protected booleanplayingFlag to indicate that a sound is playing.protected javax.swing.TimerrefreshtimerThe refresh timer.protected intreqcntThe message counter to differentiate sent messages.protected RemoteFileChooserrfilechooserThe remote file chooser (created on demand, if remote).protected static java.util.List<java.lang.String>smileysprotected booleansoundThe sound flag.protected ISubscriptionIntermediateFuture<ChatEvent>subscriptionRegistration at the service.protected javax.swing.JTabbedPanetpaneThe tabbed pane.protected booleantypingThe typing state.protected ChatPanel.UserTableModelusermodelprotected javax.swing.JTableusertableThe user table.protected javax.swing.JTableutableThe upload table.- 
Fields inherited from class jadex.base.gui.componentviewer.AbstractServiceViewerPaneljcc, service, shutdown
 - 
Fields inherited from interface jadex.base.gui.componentviewer.IAbstractViewerPanelPROPERTY_VIEWERCLASS
 
- 
 - 
Constructor SummaryConstructors Constructor Description ChatPanel()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.lang.String>acceptFile(TransferInfo ti)Open dialog and check if user wants to receive the file.voidaddMessage(IComponentIdentifier cid, java.lang.String text, java.lang.String nick, boolean privatemessage, boolean sendfailure)Add a message to the text area.static voidappend(java.awt.Color c, java.lang.String s, javax.swing.JTextPane p)Append text.static voiddoAppend(java.awt.Color c, java.lang.String s, javax.swing.JTextPane p)javax.swing.JComponentgetComponent()Get the plugin view.java.lang.StringgetNotificationSound(java.lang.String type)Get the notification sound.IFuture<Properties>getProperties()Write current state into properties.IFuture<java.lang.Void>init(IControlCenter jcc, IService service)Called once to initialize the panel.protected voidnotifyChatEvent(java.lang.String type, IComponentIdentifier source, java.lang.Object value, boolean quiet)Show a status message and optionally play a notification sound.protected voidplaySound(java.lang.String type, boolean verbose)Play the notification sound for the selected event.IFuture<java.lang.Void>postStatus()Post the local state to available chattersprotected voidsetAway(boolean away)Change the status to away and post a change, if necessary.IFuture<java.lang.Void>setProperties(Properties props)Update from given properties.voidsetUserState(IComponentIdentifier cid, java.lang.Boolean online, java.lang.Boolean typing, java.lang.Boolean away, java.lang.String nickname, byte[] image)Add a user or change its state.IFuture<java.lang.Void>shutdown()Informs the panel that it should stop all its computationIFuture<java.lang.Void>tell(java.lang.String text)Send a message.protected voidupdateChatUser(IComponentIdentifier cid, IChatService cs)protected voidupdateRefreshTimer()Start or stop the refresh timer, if necessary.voidupdateTransfer(TransferInfo fi)Update the fileinfo in the upload/download area.- 
Methods inherited from class jadex.base.gui.componentviewer.AbstractServiceViewerPanelgetId, getJCC, getService, getServiceAccess, isLocal, isShutdown
 
- 
 
- 
- 
- 
Field Detail- 
iconsprotected static final javax.swing.UIDefaults icons The icons.
 - 
smileysprotected static final java.util.List<java.lang.String> smileys 
 - 
lfpublic static final java.lang.String lf The linefeed separator.
 - 
dfpublic final java.text.DateFormat df The time format.
 - 
NOTIFICATION_NEW_USERpublic static final java.lang.String NOTIFICATION_NEW_USER The notification sound for a newly online user.- See Also:
- Constant Field Values
 
 - 
NOTIFICATION_NEW_MSGpublic static final java.lang.String NOTIFICATION_NEW_MSG The notification sound for a new message.- See Also:
- Constant Field Values
 
 - 
NOTIFICATION_MSG_FAILEDpublic static final java.lang.String NOTIFICATION_MSG_FAILED The notification sound for a failed message.- See Also:
- Constant Field Values
 
 - 
NOTIFICATION_NEW_FILEpublic static final java.lang.String NOTIFICATION_NEW_FILE The notification sound for an incoming file request.- See Also:
- Constant Field Values
 
 - 
NOTIFICATION_FILE_COMPLETEpublic static final java.lang.String NOTIFICATION_FILE_COMPLETE The notification sound for a successfully completed file.- See Also:
- Constant Field Values
 
 - 
NOTIFICATION_FILE_ABORTpublic static final java.lang.String NOTIFICATION_FILE_ABORT The notification sound for an aborted or failed file transfer.- See Also:
- Constant Field Values
 
 - 
NOTIFICATION_SOUNDSprotected static final java.util.Map<java.lang.String,java.lang.String> NOTIFICATION_SOUNDS The default notification sounds.
 - 
panelprotected javax.swing.JPanel panel The chat panel.
 - 
chatareaprotected javax.swing.JTextPane chatarea The text area.
 - 
usertableprotected javax.swing.JTable usertable The user table.
 - 
usermodelprotected ChatPanel.UserTableModel usermodel 
 - 
typingprotected boolean typing The typing state.
 - 
awayprotected boolean away The away state.
 - 
dtableprotected javax.swing.JTable dtable The download table.
 - 
utableprotected javax.swing.JTable utable The upload table.
 - 
tpaneprotected javax.swing.JTabbedPane tpane The tabbed pane.
 - 
subscriptionprotected ISubscriptionIntermediateFuture<ChatEvent> subscription Registration at the service.
 - 
refreshtimerprotected javax.swing.Timer refreshtimer The refresh timer.
 - 
awaytimerprotected javax.swing.Timer awaytimer The away timer.
 - 
listpanprotected JSplitPanel listpan The split panel on left hand side.
 - 
horsplitprotected JSplitPanel horsplit The main split panel between left and right.
 - 
soundprotected boolean sound The sound flag.
 - 
autorefreshprotected boolean autorefresh The autorefresh flag.
 - 
notificationsoundsprotected java.util.Map<java.lang.String,java.lang.String> notificationsounds The custom notification sounds.
 - 
filechooserprotected javax.swing.JFileChooser filechooser The file chooser (created on demand, if local).
 - 
rfilechooserprotected RemoteFileChooser rfilechooser The remote file chooser (created on demand, if remote).
 - 
dialogsprotected java.util.Map<TransferInfo,javax.swing.JComponent> dialogs Map for panels of open accept dialogs to close when transfer has been accepted/rejected/timeouted in background.
 - 
reqcntprotected int reqcnt The message counter to differentiate sent messages.
 - 
icontimerprotected javax.swing.Timer icontimer The timer for the flashing chat icon.
 - 
playingprotected boolean playing Flag to indicate that a sound is playing.
 
- 
 - 
Method Detail- 
initpublic IFuture<java.lang.Void> init(IControlCenter jcc, IService service) Called once to initialize the panel. Called on the swing thread.- Specified by:
- initin interface- IServiceViewerPanel
- Overrides:
- initin class- AbstractServiceViewerPanel<IChatGuiService>
- Parameters:
- jcc- The jcc.
- service- The service.
 
 - 
updateRefreshTimerprotected void updateRefreshTimer() Start or stop the refresh timer, if necessary.
 - 
setAwayprotected void setAway(boolean away) Change the status to away and post a change, if necessary.
 - 
updateChatUserprotected void updateChatUser(IComponentIdentifier cid, IChatService cs) 
 - 
getComponentpublic javax.swing.JComponent getComponent() Get the plugin view.- Specified by:
- getComponentin interface- IAbstractViewerPanel
- Specified by:
- getComponentin class- AbstractServiceViewerPanel<IChatGuiService>
- Returns:
- The component to be displayed.
 
 - 
shutdownpublic IFuture<java.lang.Void> shutdown() Informs the panel that it should stop all its computation- Specified by:
- shutdownin interface- IAbstractViewerPanel
- Overrides:
- shutdownin class- AbstractServiceViewerPanel<IChatGuiService>
 
 - 
tellpublic IFuture<java.lang.Void> tell(java.lang.String text) Send a message.- Parameters:
- text- The text.
 
 - 
postStatuspublic IFuture<java.lang.Void> postStatus() Post the local state to available chatters
 - 
addMessagepublic void addMessage(IComponentIdentifier cid, java.lang.String text, java.lang.String nick, boolean privatemessage, boolean sendfailure) Add a message to the text area.
 - 
setUserStatepublic void setUserState(IComponentIdentifier cid, java.lang.Boolean online, java.lang.Boolean typing, java.lang.Boolean away, java.lang.String nickname, byte[] image) Add a user or change its state.
 - 
acceptFilepublic IFuture<java.lang.String> acceptFile(TransferInfo ti) Open dialog and check if user wants to receive the file.- Returns:
- The path name to store the file, if accepted.
 
 - 
notifyChatEventprotected void notifyChatEvent(java.lang.String type, IComponentIdentifier source, java.lang.Object value, boolean quiet)Show a status message and optionally play a notification sound.
 - 
playSoundprotected void playSound(java.lang.String type, boolean verbose)Play the notification sound for the selected event.- Parameters:
- type- The notification event.
 
 - 
updateTransferpublic void updateTransfer(TransferInfo fi) Update the fileinfo in the upload/download area.
 - 
appendpublic static void append(java.awt.Color c, java.lang.String s, javax.swing.JTextPane p)Append text.
 - 
doAppendpublic static void doAppend(java.awt.Color c, java.lang.String s, javax.swing.JTextPane p)
 - 
getNotificationSoundpublic java.lang.String getNotificationSound(java.lang.String type) Get the notification sound.
 - 
setPropertiespublic IFuture<java.lang.Void> setProperties(Properties props) Update from given properties.- Specified by:
- setPropertiesin interface- IPropertiesProvider
- Overrides:
- setPropertiesin class- AbstractServiceViewerPanel<IChatGuiService>
 
 - 
getPropertiespublic IFuture<Properties> getProperties() Write current state into properties.- Specified by:
- getPropertiesin interface- IPropertiesProvider
- Overrides:
- getPropertiesin class- AbstractServiceViewerPanel<IChatGuiService>
 
 
- 
 
-