1.1 --- a/src/java/isac/session/Session.java Thu May 17 14:05:19 2007 +0200
1.2 +++ b/src/java/isac/session/Session.java Thu Jan 17 16:27:03 2008 +0100
1.3 @@ -35,7 +35,11 @@
1.4 import isac.users.UserManager;
1.5 import isac.util.formulae.KEStoreKey;
1.6 import isac.browserdialog.IContextPresenter;
1.7 +import isac.gui.TestWindowApplication;
1.8 import isac.interfaces.IToGUI;
1.9 +import isac.users.UserLogger;
1.10 +
1.11 +import org.apache.log4j.Logger;
1.12
1.13 /**
1.14 * This class contains all browser dialoges and a worksheet dialog handler. It
1.15 @@ -47,325 +51,363 @@
1.16 * @author Robert Koenighofer
1.17 */
1.18 public class Session extends UnicastRemoteObject implements IBDialogManager,
1.19 - IBrowserDialog,
1.20 - Serializable {
1.21 + IBrowserDialog, Serializable {
1.22
1.23 - static final long serialVersionUID = 233953442;// FIXXME generate with
1.24 - // plugin
1.25 + static final long serialVersionUID = 233953442;
1.26
1.27 - private String session_id_;
1.28 + private static final Logger logger = Logger.getLogger(Session.class
1.29 + .getName());
1.30
1.31 - private ProblemDialog problem_dialog_;
1.32 + private String session_id_;
1.33
1.34 - private MethodDialog method_dialog_;
1.35 + private ProblemDialog problem_dialog_;
1.36
1.37 - private TheoryDialog theory_dialog_;
1.38 + private MethodDialog method_dialog_;
1.39
1.40 - private ExampleDialog example_dialog_;
1.41 + private TheoryDialog theory_dialog_;
1.42
1.43 - private WSDialogManager ws_dialog_manager_;
1.44 + private ExampleDialog example_dialog_;
1.45
1.46 - private IToGUI interface_to_gui_;
1.47 -
1.48 - private BrowserDialog active_browser_dialog_;
1.49 + private WSDialogManager ws_dialog_manager_;
1.50
1.51 - private HashMap<String, KEStoreKey> wsid_map_example_;
1.52 -
1.53 - protected UserLanguage user_language_;
1.54 -
1.55 - protected User user_;
1.56 + private IToGUI interface_to_gui_;
1.57
1.58 - /**
1.59 - * Constructor Each Session creates its own browser dialoges and a worksheet
1.60 - * dialog handler.
1.61 - *
1.62 - * @param session_id
1.63 - * the session id of the session to create
1.64 - * @throws RemoteException
1.65 - * if remote object is not available
1.66 - */
1.67 - public Session(String session_id, User user) throws RemoteException {
1.68 - session_id_ = session_id;
1.69 - active_browser_dialog_ = null;
1.70 -
1.71 - user_ = user;
1.72 - user_language_ = user_.getLanguage();
1.73 -
1.74 - problem_dialog_ = new ProblemDialog(this);
1.75 - method_dialog_ = new MethodDialog(this);
1.76 - theory_dialog_ = new TheoryDialog(this);
1.77 - example_dialog_ = new ExampleDialog(this);
1.78 - ws_dialog_manager_ = new WSDialogManager(this);
1.79 - wsid_map_example_ = new HashMap<String, KEStoreKey>();
1.80 - }
1.81 + private BrowserDialog active_browser_dialog_;
1.82
1.83 - /**
1.84 - * returns the Hierarchy Key of the example, which started the worksheet
1.85 - * dialog with the specified worksheet dialog id. If the dialog with the
1.86 - * specified ID was not started from an example, null is returned.
1.87 - *
1.88 - * @param wsd_id
1.89 - * the worksheet dialog id
1.90 - * @return the HierarchyKey of the example of the worksheetdialog or null
1.91 - */
1.92 - public KEStoreKey getExampleOfWorksheet(String wsd_id) {
1.93 - return wsid_map_example_.get(wsd_id);
1.94 - }
1.95 + private HashMap<String, KEStoreKey> wsid_map_example_;
1.96
1.97 - /**
1.98 - * adds a new hierarchy key of a started example to the map. This is always
1.99 - * done, when a new worksheet dialog is started on a selecte example.
1.100 - *
1.101 - * @param wsd_id
1.102 - * the worksheet dialog id
1.103 - * @param example
1.104 - * the HierarchyKey of the example which started the dialog
1.105 - */
1.106 - public void addWorksheetWithExample(String wsd_id, KEStoreKey example) {
1.107 - wsid_map_example_.put(wsd_id, example);
1.108 - }
1.109 + protected UserLanguage user_language_;
1.110
1.111 - /**
1.112 - * removes an entry containing the worksheet dialog ID and the HierarchyKey
1.113 - * of the started example from the map. This method is called, whenever a
1.114 - * worksheet is closed. If the worksheet was not started from an example,
1.115 - * nothing happens.
1.116 - *
1.117 - * @param wsd_id
1.118 - * the worksheet dialog id
1.119 - */
1.120 - public void removeWorksheetWithExample(String wsd_id) {
1.121 - wsid_map_example_.remove(wsd_id);
1.122 - }
1.123 + protected User user_;
1.124
1.125 - /**
1.126 - * returns the session ID
1.127 - *
1.128 - * @return the session ID
1.129 - * @throws RemoteException
1.130 - * if remote object is not available
1.131 - */
1.132 - public String getId() throws RemoteException {
1.133 - return session_id_;
1.134 - }
1.135 + protected UserLogger user_logger_;
1.136
1.137 - /**
1.138 - * returns the problem dialog of the session
1.139 - *
1.140 - * @return the problem dialog of the session
1.141 - * @throws RemoteException
1.142 - * if remote object is not available
1.143 - */
1.144 - public ProblemDialog getProblemDialog() throws RemoteException {
1.145 - return problem_dialog_;
1.146 - }
1.147 + protected ICompod compod_;
1.148
1.149 - /**
1.150 - * returns the method dialog of the session
1.151 - *
1.152 - * @return the method dialog of the session
1.153 - * @throws RemoteException
1.154 - * if remote object is not available
1.155 - */
1.156 - public MethodDialog getMethodDialog() throws RemoteException {
1.157 - return method_dialog_;
1.158 - }
1.159 + /**
1.160 + * Constructor Each Session creates its own browser dialoges and a worksheet
1.161 + * dialog handler.
1.162 + *
1.163 + * @param session_id
1.164 + * the session id of the session to create
1.165 + * @throws RemoteException
1.166 + * if remote object is not available
1.167 + */
1.168 + public Session(String session_id, User user, ICompod compod)
1.169 + throws RemoteException {
1.170 + session_id_ = session_id;
1.171 + user_ = user;
1.172 + user_language_ = user_.getLanguage();
1.173 + active_browser_dialog_ = null;
1.174
1.175 - /**
1.176 - * returns the theory dialog of the session
1.177 - *
1.178 - * @return the theory dialog of the session
1.179 - * @throws RemoteException
1.180 - * if remote object is not available
1.181 - */
1.182 - public TheoryDialog getTheoryDialog() throws RemoteException {
1.183 - return theory_dialog_;
1.184 - }
1.185 + // both must be before new *Dialog(this);
1.186 + compod_ = compod;
1.187 + user_logger_ = new UserLogger(session_id, user_);
1.188
1.189 - /**
1.190 - * returns the example dialog of the session
1.191 - *
1.192 - * @return the example dialog of the session
1.193 - * @throws RemoteException
1.194 - * if remote object is not available
1.195 - */
1.196 - public ExampleDialog getExampleDialog() throws RemoteException {
1.197 - return example_dialog_;
1.198 - }
1.199 + problem_dialog_ = new ProblemDialog(this);
1.200 + method_dialog_ = new MethodDialog(this);
1.201 + theory_dialog_ = new TheoryDialog(this);
1.202 + example_dialog_ = new ExampleDialog(this);
1.203 + ws_dialog_manager_ = new WSDialogManager(this);
1.204 + wsid_map_example_ = new HashMap<String, KEStoreKey>();
1.205
1.206 - /**
1.207 - * returns the WSDialogManager of the session
1.208 - *
1.209 - * @return the WSDialogManager of the session
1.210 - * @throws RemoteException
1.211 - * if remote object is not available
1.212 - */
1.213 - public WSDialogManager getWSDialogManager() throws RemoteException {
1.214 - return ws_dialog_manager_;
1.215 - }
1.216 + user_logger_.setExampleDialog(example_dialog_);
1.217 + }
1.218
1.219 - /**
1.220 - * returns a IContextProvider, which acts as the interface between the the
1.221 - * browser dialoges and the active worksheet dialog. This interface can only
1.222 - * be used by the browser dialoges to access the active worksheet dailog.
1.223 - * The IContextProvider is implemented by the Worksheetdialog. The returned
1.224 - * interface belogs to the currently active WorksheetDialog. If no
1.225 - * WorksheetDialog is active at the moment (e.g. if there is no opened
1.226 - * WorksheetDialog at all), null is returned. The WSDialogManager knows the
1.227 - * active WorksheetDialog.
1.228 - *
1.229 - * @return the IContextProvider or null if there is no active
1.230 - * WorksheetDialog
1.231 - * @throws RemoteException
1.232 - * if remote object is not available
1.233 - * @see isac.wsdialog.WSDialogManager#getActiveWSDialog()
1.234 - */
1.235 - public IContextProvider getContextProvider() throws RemoteException {
1.236 - return (IContextProvider) ws_dialog_manager_.getActiveWSDialog();
1.237 - }
1.238 + /**
1.239 + * returns the Hierarchy Key of the example, which started the worksheet
1.240 + * dialog with the specified worksheet dialog id. If the dialog with the
1.241 + * specified ID was not started from an example, null is returned.
1.242 + *
1.243 + * @param wsd_id
1.244 + * the worksheet dialog id
1.245 + * @return the HierarchyKey of the example of the worksheetdialog or null
1.246 + */
1.247 + public KEStoreKey getExampleOfWorksheet(String wsd_id) {
1.248 + return wsid_map_example_.get(wsd_id);
1.249 + }
1.250
1.251 - /**
1.252 - * returns a IContextPresenter, which acts as the interface between the the
1.253 - * browser dialoges and the active worksheet dialog. This interface can only
1.254 - * be used by the active worksheet dialoges to commnicate to the method
1.255 - * dialog. The IContextPresenter interface is implemented by all browser
1.256 - * dialoges. The returned interface belogs to the currently active browser
1.257 - * dialog. The active browser dialog is the one which is shown on top.
1.258 - *
1.259 - * @return the IContextPresenter interface of the MethodDialog of this
1.260 - * Session
1.261 - */
1.262 - public IContextPresenter getContextPresenter() {
1.263 - return (IContextPresenter) active_browser_dialog_;
1.264 - }
1.265 -
1.266 - /**
1.267 - * Sets a Browser Dialog to the active browser dialog. This is done
1.268 - * by the browser dialoges themself whenever they get the focus.
1.269 - *
1.270 - * @param new_active_dialog the browser dialog to set as active
1.271 - */
1.272 - public void setActiveBrowserDialog(BrowserDialog new_active_dialog) {
1.273 - active_browser_dialog_ = new_active_dialog;
1.274 - }
1.275 + /**
1.276 + * adds a new hierarchy key of a started example to the map. This is always
1.277 + * done, when a new worksheet dialog is started on a selecte example.
1.278 + *
1.279 + * @param wsd_id
1.280 + * the worksheet dialog id
1.281 + * @param example
1.282 + * the HierarchyKey of the example which started the dialog
1.283 + */
1.284 + public void addWorksheetWithExample(String wsd_id, KEStoreKey example) {
1.285 + wsid_map_example_.put(wsd_id, example);
1.286 + }
1.287
1.288 - /**
1.289 - * This method is called when one of the BrowserFrames gets closed
1.290 - * by the user.
1.291 - * Checks if the given BrowserDialogue is registered as active and
1.292 - * if that is the case, then the active dialogue is reset.
1.293 - *
1.294 - * @param inactive_dialog
1.295 - */
1.296 - public void setInactiveBrowserDialog(BrowserDialog inactive_dialog) {
1.297 - if( active_browser_dialog_ == inactive_dialog )
1.298 - active_browser_dialog_ = null;
1.299 - }
1.300 -
1.301 -
1.302 - /**
1.303 - * returns an interface to the WindowApplication of the session
1.304 - *
1.305 - * @return an interface to the window application of the session
1.306 - * @throws RemoteException
1.307 - * if remote object is not available
1.308 - */
1.309 - public IToGUI getIToGUI() throws RemoteException {
1.310 - return interface_to_gui_;
1.311 - }
1.312 -
1.313 - /**
1.314 - * Initialises the WindowApplication.
1.315 - * This method sends the buttons to the window application and
1.316 - * asks the WindowApplication to create the BrowserFrames.
1.317 - *
1.318 - */
1.319 - private void initialiseWindowApplication() throws RemoteException {
1.320 - if( interface_to_gui_ == null )
1.321 - return;
1.322 -
1.323 - /// Add the buttons
1.324 - interface_to_gui_.addUIElement( new UIAction(
1.325 - EUIElement.UI_OPEN_WORKSHEET,
1.326 - EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_ ) );
1.327 -
1.328 - interface_to_gui_.addUIElement( new UIAction(
1.329 - EUIElement.UI_SHOW_EXAMPLE_BROWSER,
1.330 - EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_ ) );
1.331 + /**
1.332 + * removes an entry containing the worksheet dialog ID and the HierarchyKey
1.333 + * of the started example from the map. This method is called, whenever a
1.334 + * worksheet is closed. If the worksheet was not started from an example,
1.335 + * nothing happens.
1.336 + *
1.337 + * @param wsd_id
1.338 + * the worksheet dialog id
1.339 + */
1.340 + public void removeWorksheetWithExample(String wsd_id) {
1.341 + wsid_map_example_.remove(wsd_id);
1.342 + }
1.343
1.344 - interface_to_gui_.addUIElement( new UIAction(
1.345 - EUIElement.UI_SHOW_THEORY_BROWSER,
1.346 - EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_ ) );
1.347 -
1.348 - interface_to_gui_.addUIElement( new UIAction(
1.349 - EUIElement.UI_SHOW_PROBLEM_BROWSER,
1.350 - EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_ ) );
1.351 -
1.352 - interface_to_gui_.addUIElement( new UIAction(
1.353 - EUIElement.UI_SHOW_METHOD_BROWSER,
1.354 - EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_ ) );
1.355 -
1.356 - /// Add the browser frames
1.357 - interface_to_gui_.doUIAction( new UIActionOnBrowserDialog(
1.358 - EUIElement.UI_OPEN_BROWSER_FRAME, EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_,
1.359 - this.example_dialog_, "Example browser") );
1.360 + /**
1.361 + * returns the session ID
1.362 + *
1.363 + * @return the session ID
1.364 + * @throws RemoteException
1.365 + * if remote object is not available
1.366 + */
1.367 + public String getId() throws RemoteException {
1.368 + return session_id_;
1.369 + }
1.370
1.371 - interface_to_gui_.doUIAction( new UIActionOnBrowserDialog(
1.372 - EUIElement.UI_OPEN_BROWSER_FRAME, EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_,
1.373 - this.theory_dialog_, "Theory browser") );
1.374 -
1.375 - interface_to_gui_.doUIAction( new UIActionOnBrowserDialog(
1.376 - EUIElement.UI_OPEN_BROWSER_FRAME, EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_,
1.377 - this.problem_dialog_, "Problem browser") );
1.378 -
1.379 - interface_to_gui_.doUIAction( new UIActionOnBrowserDialog(
1.380 - EUIElement.UI_OPEN_BROWSER_FRAME, EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_,
1.381 - this.method_dialog_, "Method browser") );
1.382 - }
1.383 + /**
1.384 + * returns the problem dialog of the session
1.385 + *
1.386 + * @return the problem dialog of the session
1.387 + * @throws RemoteException
1.388 + * if remote object is not available
1.389 + */
1.390 + public ProblemDialog getProblemDialog() throws RemoteException {
1.391 + return problem_dialog_;
1.392 + }
1.393
1.394 - /**
1.395 - * Handles the requests from WindowApplication
1.396 - */
1.397 - public boolean notifyUserAction(IUserAction action) throws RemoteException, DialogProtocolException {
1.398 - System.out.println("In Session::notifyUserAction(IUserAction action) : Action is "
1.399 - + action.getActionID() + ", Context is " + action.getContext() );
1.400 -
1.401 - EUIElement actionID = action.getActionID();
1.402 - switch( actionID ) {
1.403 - case UI_SHOW_EXAMPLE_BROWSER:
1.404 - example_dialog_.showBrowserFrame();
1.405 - break;
1.406 - case UI_SHOW_METHOD_BROWSER:
1.407 - method_dialog_.showBrowserFrame();
1.408 - break;
1.409 - case UI_SHOW_PROBLEM_BROWSER:
1.410 - problem_dialog_.showBrowserFrame();
1.411 - break;
1.412 - case UI_SHOW_THEORY_BROWSER:
1.413 + /**
1.414 + * returns the method dialog of the session
1.415 + *
1.416 + * @return the method dialog of the session
1.417 + * @throws RemoteException
1.418 + * if remote object is not available
1.419 + */
1.420 + public MethodDialog getMethodDialog() throws RemoteException {
1.421 + return method_dialog_;
1.422 + }
1.423 +
1.424 + /**
1.425 + * returns the theory dialog of the session
1.426 + *
1.427 + * @return the theory dialog of the session
1.428 + * @throws RemoteException
1.429 + * if remote object is not available
1.430 + */
1.431 + public TheoryDialog getTheoryDialog() throws RemoteException {
1.432 + return theory_dialog_;
1.433 + }
1.434 +
1.435 + /**
1.436 + * returns the example dialog of the session
1.437 + *
1.438 + * @return the example dialog of the session
1.439 + * @throws RemoteException
1.440 + * if remote object is not available
1.441 + */
1.442 + public ExampleDialog getExampleDialog() throws RemoteException {
1.443 + return example_dialog_;
1.444 + }
1.445 +
1.446 + /**
1.447 + * returns the WSDialogManager of the session
1.448 + *
1.449 + * @return the WSDialogManager of the session
1.450 + * @throws RemoteException
1.451 + * if remote object is not available
1.452 + */
1.453 + public WSDialogManager getWSDialogManager() throws RemoteException {
1.454 + return ws_dialog_manager_;
1.455 + }
1.456 +
1.457 + /**
1.458 + * returns a IContextProvider, which acts as the interface between the the
1.459 + * browser dialoges and the active worksheet dialog. This interface can only
1.460 + * be used by the browser dialoges to access the active worksheet dailog.
1.461 + * The IContextProvider is implemented by the Worksheetdialog. The returned
1.462 + * interface belogs to the currently active WorksheetDialog. If no
1.463 + * WorksheetDialog is active at the moment (e.g. if there is no opened
1.464 + * WorksheetDialog at all), null is returned. The WSDialogManager knows the
1.465 + * active WorksheetDialog.
1.466 + *
1.467 + * @return the IContextProvider or null if there is no active
1.468 + * WorksheetDialog
1.469 + * @throws RemoteException
1.470 + * if remote object is not available
1.471 + * @see isac.wsdialog.WSDialogManager#getActiveWSDialog()
1.472 + */
1.473 + public IContextProvider getContextProvider() throws RemoteException {
1.474 + return (IContextProvider) ws_dialog_manager_.getActiveWSDialog();
1.475 + }
1.476 +
1.477 + /**
1.478 + * returns a IContextPresenter, which acts as the interface between the the
1.479 + * browser dialoges and the active worksheet dialog. This interface can only
1.480 + * be used by the active worksheet dialoges to commnicate to the method
1.481 + * dialog. The IContextPresenter interface is implemented by all browser
1.482 + * dialoges. The returned interface belogs to the currently active browser
1.483 + * dialog. The active browser dialog is the one which is shown on top.
1.484 + *
1.485 + * @return the IContextPresenter interface of the MethodDialog of this
1.486 + * Session
1.487 + */
1.488 + public IContextPresenter getContextPresenter() {
1.489 + return (IContextPresenter) active_browser_dialog_;
1.490 + }
1.491 +
1.492 + /**
1.493 + * Sets a Browser Dialog the active browser dialog. This is done by the
1.494 + * browser dialoges themself whenever they get the focus.
1.495 + *
1.496 + * @param new_active_dialog
1.497 + * the browser dialog to set as active
1.498 + */
1.499 + public void setActiveBrowserDialog(BrowserDialog new_active_dialog) {
1.500 + active_browser_dialog_ = new_active_dialog;
1.501 + }
1.502 +
1.503 + /**
1.504 + * This method is called when one of the BrowserFrames is closed by the
1.505 + * user. Checks if the given BrowserDialogue is registered as active and if
1.506 + * that is the case, then the active dialogue is reset.
1.507 + *
1.508 + * @param inactive_dialog
1.509 + */
1.510 + public void setInactiveBrowserDialog(BrowserDialog inactive_dialog) {
1.511 + if (active_browser_dialog_ == inactive_dialog)
1.512 + active_browser_dialog_ = null;
1.513 + }
1.514 +
1.515 + /**
1.516 + * returns an interface to the WindowApplication of the session
1.517 + *
1.518 + * @return an interface to the window application of the session
1.519 + * @throws RemoteException
1.520 + * if remote object is not available
1.521 + */
1.522 + public IToGUI getIToGUI() throws RemoteException {
1.523 + return interface_to_gui_;
1.524 + }
1.525 +
1.526 + /**
1.527 + * Initialises the WindowApplication. This method sends the buttons to the
1.528 + * window application and asks the WindowApplication to create the
1.529 + * BrowserFrames.
1.530 + *
1.531 + */
1.532 + private void initialiseWindowApplication() throws RemoteException {
1.533 + if (interface_to_gui_ == null)
1.534 + return;
1.535 +
1.536 + if (logger.isDebugEnabled())
1.537 + logger.debug("----- add buttons to browsers--------------------");
1.538 + interface_to_gui_.addUIElement(new UIAction(
1.539 + EUIElement.UI_OPEN_WORKSHEET,
1.540 + EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_));
1.541 +
1.542 + interface_to_gui_.addUIElement(new UIAction(
1.543 + EUIElement.UI_SHOW_EXAMPLE_BROWSER,
1.544 + EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_));
1.545 +
1.546 + interface_to_gui_.addUIElement(new UIAction(
1.547 + EUIElement.UI_SHOW_THEORY_BROWSER,
1.548 + EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_));
1.549 +
1.550 + interface_to_gui_.addUIElement(new UIAction(
1.551 + EUIElement.UI_SHOW_PROBLEM_BROWSER,
1.552 + EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_));
1.553 +
1.554 + interface_to_gui_.addUIElement(new UIAction(
1.555 + EUIElement.UI_SHOW_METHOD_BROWSER,
1.556 + EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_));
1.557 +
1.558 + if (logger.isDebugEnabled())
1.559 + logger.debug("----- add the browser frames--------------------");
1.560 + interface_to_gui_.doUIAction(new UIActionOnBrowserDialog(
1.561 + EUIElement.UI_OPEN_BROWSER_FRAME,
1.562 + EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_,
1.563 + this.example_dialog_, "Example browser"));
1.564 +
1.565 + interface_to_gui_.doUIAction(new UIActionOnBrowserDialog(
1.566 + EUIElement.UI_OPEN_BROWSER_FRAME,
1.567 + EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_,
1.568 + this.theory_dialog_, "Theory browser"));
1.569 +
1.570 + interface_to_gui_.doUIAction(new UIActionOnBrowserDialog(
1.571 + EUIElement.UI_OPEN_BROWSER_FRAME,
1.572 + EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_,
1.573 + this.problem_dialog_, "Problem browser"));
1.574 +
1.575 + interface_to_gui_.doUIAction(new UIActionOnBrowserDialog(
1.576 + EUIElement.UI_OPEN_BROWSER_FRAME,
1.577 + EUIContext.UI_CONTEXT_WINDOW_APPLICATION, user_language_,
1.578 + this.method_dialog_, "Method browser"));
1.579 + }
1.580 +
1.581 + /**
1.582 + * Handles the requests from <code>WindowApplication</code>
1.583 + */
1.584 + public boolean notifyUserAction(IUserAction action) throws RemoteException,
1.585 + DialogProtocolException {
1.586 + System.out
1.587 + .println("In Session::notifyUserAction(IUserAction action) : Action is "
1.588 + + action.getActionID()
1.589 + + ", Context is "
1.590 + + action.getContext());
1.591 +
1.592 + EUIElement actionID = action.getActionID();
1.593 + switch (actionID) {
1.594 + case UI_SHOW_EXAMPLE_BROWSER:
1.595 + example_dialog_.showBrowserFrame();
1.596 + break;
1.597 + case UI_SHOW_METHOD_BROWSER:
1.598 + method_dialog_.showBrowserFrame();
1.599 + break;
1.600 + case UI_SHOW_PROBLEM_BROWSER:
1.601 + problem_dialog_.showBrowserFrame();
1.602 + break;
1.603 + case UI_SHOW_THEORY_BROWSER:
1.604 theory_dialog_.showBrowserFrame();
1.605 break;
1.606 - case UI_OPEN_WORKSHEET:
1.607 - ws_dialog_manager_.openWSDialog();
1.608 - break;
1.609 - default:
1.610 - WorksheetDialog wd = this.ws_dialog_manager_.getActiveWSDialog();
1.611 - if( wd != null ) {
1.612 - wd.notifyUserAction( action );
1.613 - }
1.614 - }
1.615 - return true;
1.616 - }
1.617 + case UI_OPEN_WORKSHEET:
1.618 + ws_dialog_manager_.openWSDialog();
1.619 + break;
1.620 + case UI_STOP_SESSION:{
1.621 + UserManager.getInstance().logout(this);
1.622 + System.out.println("####### Session: UI_STOP_SESSION #######");
1.623 + break;
1.624 + }
1.625 + default:
1.626 + WorksheetDialog wd = this.ws_dialog_manager_.getActiveWSDialog();
1.627 + if (wd != null) {
1.628 + wd.notifyUserAction(action);
1.629 + }
1.630 + }
1.631 + return true;
1.632 + }
1.633
1.634 - /**
1.635 - * Registers the WindowApplication to this session
1.636 - */
1.637 - public void registerBrowserFrame(IToGUI window_application) throws RemoteException {
1.638 - interface_to_gui_ = window_application;
1.639 - initialiseWindowApplication();
1.640 - }
1.641 -
1.642 - public UserLanguage getLanguage() {
1.643 - return user_language_;
1.644 - }
1.645 -
1.646 + /**
1.647 + * Registers the WindowApplication to this session
1.648 + */
1.649 + public void registerBrowserFrame(IToGUI window_application)
1.650 + throws RemoteException {
1.651 + interface_to_gui_ = window_application;
1.652 + initialiseWindowApplication();
1.653 + }
1.654 +
1.655 + public UserLanguage getLanguage() {
1.656 + return user_language_;
1.657 + }
1.658 +
1.659 + public UserLogger getUserLogger() {
1.660 + return user_logger_;
1.661 + }
1.662 +
1.663 + /** @deprecated because quick and dirty for startind Compod */
1.664 + public User getUser() {
1.665 + return user_;
1.666 + }
1.667 +
1.668 + public ICompod getCompod() {
1.669 + return compod_;
1.670 + }
1.671 }