Package ucar.unidata.idv.collab
Class CollabManager
java.lang.Object
ucar.unidata.ui.WindowHolder
ucar.unidata.idv.IdvManager
ucar.unidata.idv.collab.CollabManager
- All Implemented Interfaces:
ActionListener,EventListener,SharableListener,IdvConstants
This class manages the IDV collaboration mechanism
- Author:
- IDV development team
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CollabMsgTypeMessage type to acknowledge the acceptance or rejection of a new userstatic final CollabMsgTypeMessage type for some ui action (not used now)static final CollabMsgTypeMessage type for xml idv bundlesstatic final CollabMsgTypeMessage type to tell others we are closingstatic final CollabMsgTypeMessage type for announcing new data sourcesstatic final StringThe de,limiter between the msg id and the body of the messagestatic final CollabMsgTypeMessage type for announcing new displaysstatic final CollabMsgTypeMessage type for chat text messagestatic final CollabMsgTypeMessage type for new usersstatic final CollabMsgTypeMessage type for when a new window is createdstatic final CollabMsgTypeMessage type for when a datasource is removedstatic final CollabMsgTypeMessage type for when a display is removedstatic final CollabMsgTypeMessage type for when an objects state changesstatic StringWill identify the accept all.static StringWill identify the hostname preference.static StringWill identify the port preference.Fields inherited from class ucar.unidata.ui.WindowHolder
contents, dialog, frame, windowFields inherited from interface ucar.unidata.idv.IdvConstants
ARG_B64BUNDLE, ARG_B64ISL, ARG_BUNDLE, ARG_CATALOG, ARG_CHOOSER, ARG_CLEARDEFAULT, ARG_CODE, ARG_CONNECT, ARG_CURRENTTIME, ARG_DATA, ARG_DEBUG, ARG_DEFAULT, ARG_DISPLAY, ARG_DXML, ARG_FIXEDTIME, ARG_HELP, ARG_IMAGE, ARG_IMAGESERVER, ARG_INSTALLPLUGIN, ARG_ISLFILE, ARG_ISLINTERACTIVE, ARG_LISTRESOURCES, ARG_MAINCLASS, ARG_MOVIE, ARG_MSG_DEBUG, ARG_MSG_RECORD, ARG_NODEFAULT, ARG_NOERRORSINGUI, ARG_NOGUI, ARG_NOONEINSTANCE, ARG_NOPLUGINS, ARG_NOPREF, ARG_ONEINSTANCEPORT, ARG_PLUGIN, ARG_PORT, ARG_PRINTJNLP, ARG_PROPERTIES, ARG_SCRIPT, ARG_SERVER, ARG_SETFILES, ARG_SITEPATH, ARG_TEMPLATE, ARG_TEST, ARG_TESTEVAL, ARG_TRACE, ARG_TRACEONLY, ARG_USERPATH, DEFAULT_DATE_FORMAT, DEFAULT_DOCPATH, DEFAULT_TIMEZONE, FILTER_CPT, FILTER_ISL, FILTER_JNLP, FILTER_XIDV, FILTER_XIDVZIDV, FILTER_XML, FILTER_ZIDV, ID_COMMANDSTORUN, ID_DATASOURCES, ID_DISPLAYCONTROLS, ID_IDV, ID_JYTHON, ID_MESSAGE, ID_MISCHASHTABLE, ID_NCIDV_VERSION, ID_VERSION, ID_VIEWMANAGERS, ID_WINDOWS, INITIAL_PROBE_EARTHLOCATION, NULL_DATA_SELECTION, NULL_STRING, PREF_APPEARANCEMODE, PREF_ARCHIVEDIR, PREF_ARCHIVENAME, PREF_AUTODISPLAYS_ENABLE, PREF_AUTODISPLAYS_SHOWGUI, PREF_AUTOSELECTDATA, PREF_CACHESIZE, PREF_CONTROLSINTABS, PREF_DATAPREFIX, PREF_DATE_FORMAT, PREF_DISTANCEUNIT, PREF_DOCACHE, PREF_EMBEDDATACHOOSERINDASHBOARD, PREF_EMBEDFIELDSELECTORINDASHBOARD, PREF_EMBEDLEGENDINDASHBOARD, PREF_EMBEDQUICKLINKSINDASHBOARD, PREF_EVENT_KEYBOARDMAP, PREF_EVENT_MOUSEMAP, PREF_EVENT_WHEELMAP, PREF_FAST_RENDER, PREF_FIELD_CACHETHRESHOLD, PREF_FILEREADDIR, PREF_FILEWRITEDIR, PREF_GEOMETRY_BY_REF, PREF_HISTORY, PREF_IMAGE_BY_REF, PREF_LARGE_REMOTE_DATA_WARN, PREF_LASTVERSION, PREF_LATLON_FORMAT, PREF_LEGEND_SHOWICONS, PREF_LOCALE, PREF_LOOKANDFEEL, PREF_MAXIMAGESIZE, PREF_MEMORY, PREF_NPOT_IMAGE, PREF_OPEN_ASK, PREF_OPEN_MERGE, PREF_OPEN_REMOVE, PREF_PROJ_LIST, PREF_SAMPLINGMODE, PREF_SHOWCONTROLWINDOW, PREF_SHOWDASHBOARD, PREF_SHOWDECODEDIALOG, PREF_SHOWHIDDENFILES, PREF_SHOWQUITCONFIRM, PREF_SITEPATH, PREF_THREADS_DATA, PREF_THREADS_RENDER, PREF_TIMEZONE, PREF_VERTICALCS, PREF_VERTICALUNIT, PREF_WINDOW_SHOWTOOLBAR, PREF_ZIDV_ASK, PREF_ZIDV_DIRECTORY, PREF_ZIDV_SAVETOTMP, PROP_3DMODE, PROP_ABOUTTEXT, PROP_APPRESOURCEPATH, PROP_CHOOSERS, PROP_CHOOSERS_ALL, PROP_CONTROLDESCRIPTORS, PROP_CONTROLDESCRIPTORS_ALL, PROP_DATAHOLDERBOUNDS, PROP_DEFAULTLOCATIONS, PROP_DISPLAYLIST_GROUP, PROP_FIXFILELOCKUP, PROP_JNLPCODEBASE, PROP_JNLPTEMPLATE, PROP_JNLPTITLE, PROP_LOADINGXML, PROP_MAP_GLOBE_LEVEL, PROP_MAP_MAP_LEVEL, PROP_MINIMUMFRAMECYCLETIME, PROP_MONITORPORT, PROP_OLDCONTROLDESCRIPTORS, PROP_ONEINSTANCEPORT, PROP_PREFERENCES, PROP_PROJ_NAME, PROP_RESOURCEFILES, PROP_SHOWCLOCK_DASH, PROP_SHOWCLOCK_VIEW, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, PROP_USE_DISPLAYAREA, PROP_USE_TIMEDRIVER, PROP_VERSIONFILE, PROP_WINDOW_SCREENSIZEOFFSET, PROP_WINDOW_SIZEHEIGHT, PROP_WINDOW_SIZEWIDTH, PROP_WINDOW_USESCREENSIZE, SUFFIX_BAT, SUFFIX_CPT, SUFFIX_ISL, SUFFIX_JNLP, SUFFIX_RBI, SUFFIX_SH, SUFFIX_XIDV, SUFFIX_XML, SUFFIX_ZIDV -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckShareData(Sharable from, Object dataId, Object[] data) The implementation of the SharableListener interface.protected voidclientAdded(CollabClient client) We have a new clientprotected voidclientRemoved(CollabClient client) Client is goenvoidconnect()Try to connect to the class member hostname.protected booleanTry to connect to the given hostvoidcontrolHasBeenInitialized(DisplayControl control) This gets called when the givenDisplayControlhas been initialized.voidClose down all connectionsprotected JComponentMake the GUIprotected SharablefindSharable(String id) Find theSharableobject identified by the given id.protected SharablefindSharable(String id, List sharables) Find theSharableobject identified by the given id in the list of sharablesbooleanIs it ok for the server to relay messages that have been sent by another client to any other clients we may be connected to.protected StringGet our user's nameGet the window title to useprotected voidhandleMessage(CollabClient from, String msg) Process the given message from the given client.protected voidhandleMessage(CollabClient from, String msg, boolean checkIfMessageHasBeenSeen) Process the given message from the given client.protected voidhandleMessageInner(CollabClient fromClient, String msg, boolean checkIfMessageHasBeenSeen) Handle the incoming message.protected voidhandleMessageInnerInner(CollabClient fromClient, CollabMsgType msgType, String from, String contents) Really handle the incoming message.protected booleanAre there any clients we are connected tobooleanhaveDisplayControl(DisplayControl displayControl) Is this an existingDisplayControlprotected booleanAre we doing an event capture and/or do we have any connected clientsprotected StringmakeMsg(CollabMsgType type, String body1) Construct the message.voidnewWindow(ViewManager vm) Send the MSG_NEWWINDOW message.voidrunCaptureFile(String filename) Execute the events in the given capture filevoidSend the MSG_MESSAGE text message (the chat text)protected voidThe server has started.protected voidThe server has stopped.voidBring up the event capture windowvoidshowChat()Show the chat panevoidShow the clients panevoidShow the connect panevoidshowLog()Show the log panevoidCreate the GUI if needed and popup the window.voidwrite(CollabMsgType type, String message) Write to all clients the given message of the given message type.protected voidwriteChatText(String from, String msg) Add the given chat text to the text areavoidwriteRemoveDataSource(DataSource dataSource) Send the MSG_REMOVEDATASOURCE message for the given data sourcevoidwriteRemoveDisplayControl(DisplayControl display) Send the MSG_REMOVEDISPLAYCONTROL message for the given display controlvoidSend the MSG_BUNDLE message.protected voidwriteState(CollabClient client) Write the current state of the application to the given client.Methods inherited from class ucar.unidata.idv.IdvManager
getArgsManager, getCollabManager, getColorTableManager, getDataManager, getIdv, getIdvChooserManager, getIdvClass, getIdvProjectionManager, getIdvUIManager, getImageGenerator, getInstallManager, getJythonManager, getPersistenceManager, getPreferenceManager, getProperty, getProperty, getProperty, getPublishManager, getResourceManager, getStateManager, getStationModelManager, getStore, getVMManager, logException, showNormalCursor, showWaitCursor, waitUntilDisplaysAreDone, waitUntilDisplaysAreDoneMethods inherited from class ucar.unidata.ui.WindowHolder
actionPerformed, close, getContents, getDialog, getFrame, getWindow, isShowing, removeAll, setMenuBar, setWindowTitle, shouldMakeDialog, show, show, showModal, toFront, windowIsClosing
-
Field Details
-
PREF_HOSTNAME
Will identify the hostname preference. Not used at the moment -
PREF_PORT
Will identify the port preference. Not used at the moment -
PREF_ACCEPTALL
Will identify the accept all. Not used at the moment -
MSG_DELIMITER
The de,limiter between the msg id and the body of the message- See Also:
-
MSG_NEWUSER
Message type for new users -
MSG_ACKNEWUSER
Message type to acknowledge the acceptance or rejection of a new user -
MSG_CLOSE
Message type to tell others we are closing -
MSG_BUNDLE
Message type for xml idv bundles -
MSG_DATASOURCE
Message type for announcing new data sources -
MSG_DISPLAY
Message type for announcing new displays -
MSG_MESSAGE
Message type for chat text message -
MSG_STATE
Message type for when an objects state changes -
MSG_NEWWINDOW
Message type for when a new window is created -
MSG_REMOVEDATASOURCE
Message type for when a datasource is removed -
MSG_REMOVEDISPLAYCONTROL
Message type for when a display is removed -
MSG_ACTION
Message type for some ui action (not used now)
-
-
Constructor Details
-
CollabManager
Create the CollabManager- Parameters:
idv- Reference to the IDV
-
-
Method Details
-
connect
public void connect()Try to connect to the class member hostname. -
writeState
Write the current state of the application to the given client. This creates an application bundle which is sent to the given client.- Parameters:
client- The client to write to
-
connectTo
Try to connect to the given host- Parameters:
collabHostName- The host to connect to- Returns:
- Was the connection successful
-
getOkToRelay
public boolean getOkToRelay()Is it ok for the server to relay messages that have been sent by another client to any other clients we may be connected to.- Returns:
- OK to relay messages
-
isEnabled
protected boolean isEnabled()Are we doing an event capture and/or do we have any connected clients- Returns:
- Are we enabled to handle events
-
haveClients
protected boolean haveClients()Are there any clients we are connected to- Returns:
- Have any clients
-
showConnect
public void showConnect()Show the connect pane -
showClients
public void showClients()Show the clients pane -
showChat
public void showChat()Show the chat pane -
showLog
public void showLog()Show the log pane -
showCapture
public void showCapture()Bring up the event capture window -
runCaptureFile
Execute the events in the given capture file- Parameters:
filename- Filename of the capture file
-
disconnectAll
public void disconnectAll()Close down all connections -
clientAdded
We have a new client- Parameters:
client- The new client
-
clientRemoved
Client is goen- Parameters:
client- The goner client
-
serverStopped
protected void serverStopped()The server has stopped. Update the GUI labels, etc. -
serverStarted
protected void serverStarted()The server has started. Update the GUI labels, etc. -
showWindow
public void showWindow()Create the GUI if needed and popup the window. -
doMakeContents
Make the GUI- Overrides:
doMakeContentsin classWindowHolder- Returns:
- The gui
-
getWindowTitle
Get the window title to use- Overrides:
getWindowTitlein classWindowHolder- Returns:
- The window title
-
sendText
Send the MSG_MESSAGE text message (the chat text)- Parameters:
msg- The message to send
-
writeRemoveDataSource
Send the MSG_REMOVEDATASOURCE message for the given data source- Parameters:
dataSource- The data source that was removed
-
writeRemoveDisplayControl
Send the MSG_REMOVEDISPLAYCONTROL message for the given display control- Parameters:
display- The display control that was removed
-
writeState
public void writeState()Send the MSG_BUNDLE message. This creates the application state bundle and sends it out to all clients. -
newWindow
Send the MSG_NEWWINDOW message.- Parameters:
vm- The new ViewManager
-
write
Write to all clients the given message of the given message type.- Parameters:
type- The message typemessage- The message
-
getUserName
Get our user's name- Returns:
- User's name
-
makeMsg
Construct the message. The format is:UNIQUEID:MESSAGETYPE:USERNAME:MESSAGEBODY
- Parameters:
type- The type of the messagebody1- The message text- Returns:
- The constructed message
-
handleMessage
Process the given message from the given client.- Parameters:
from- TheCollabClientthis message is from . This may be the replayClientmsg- the message
-
handleMessage
Process the given message from the given client. If checkIfMessageHasBeenSeen is true then if we have seen this message before we ignore it.- Parameters:
from- TheCollabClientthis message is from . This may be the replayClientmsg- the messagecheckIfMessageHasBeenSeen- Only process unique messages
-
handleMessageInner
protected void handleMessageInner(CollabClient fromClient, String msg, boolean checkIfMessageHasBeenSeen) throws Exception Handle the incoming message.- Parameters:
fromClient- Who sent itmsg- The messagecheckIfMessageHasBeenSeen- Should we check if we have seen this. Normal collaboration message we always check. This flag is there so theCaptureManagercan replay messages even though we may have already seen them.- Throws:
Exception- the exception
-
handleMessageInnerInner
protected void handleMessageInnerInner(CollabClient fromClient, CollabMsgType msgType, String from, String contents) throws Exception Really handle the incoming message.- Parameters:
fromClient- From wheremsgType- Typefrom- From whomcontents- Message body- Throws:
Exception- the exception
-
writeChatText
Add the given chat text to the text area- Parameters:
from- From whommsg- The text
-
haveDisplayControl
Is this an existingDisplayControl- Parameters:
displayControl- The display control to check- Returns:
- Does the display control exist in the app
-
findSharable
Find theSharableobject identified by the given id in the list of sharables- Parameters:
id- Id to search forsharables- The haystack- Returns:
- The found Sharable or null if not found
-
findSharable
Find theSharableobject identified by the given id. This looks in the list of display controls, the data sources, the view managers and the animation widgets. (Which are the different classes of of objects that we share state for.- Parameters:
id- Id to search for- Returns:
- The found Sharable or null if not found
-
controlHasBeenInitialized
This gets called when the givenDisplayControlhas been initialized. When we get this, if we are enabled, we send the MSG_DISPLAY message with the xml encoding of the display.- Parameters:
control- The display control that has been initialized
-