ditignuish between tryMatch and new Site for Browser in ProblemBrowserDialog
authorjloinig
Sun, 21 Aug 2005 13:54:25 +0200
changeset 29209ee63afb91f3
parent 2919 00558b34dcee
child 2921 26929d576447
ditignuish between tryMatch and new Site for Browser in ProblemBrowserDialog
admin/projplans/JL.txt
src/java/isac/browserdialog/ProblemBrowserDialog.java
src/java/isac/gui/browser/panels/ProblemBrowserPanel.java
     1.1 --- a/admin/projplans/JL.txt	Sun Aug 21 13:53:55 2005 +0200
     1.2 +++ b/admin/projplans/JL.txt	Sun Aug 21 13:54:25 2005 +0200
     1.3 @@ -110,6 +110,14 @@
     1.4  (a) implemented new variant of action handling after selecting a new problem
     1.5  (aa) after mail from WN changes necessary, browser dialog sends _allways_ both,
     1.6  	the ke_store_id and the wsd_id if a new problem is selected
     1.7 +	
     1.8 +050821
     1.9 +(a) rethink and reimplement methods for getting the last focused worksheet
    1.10 +(aa) store last focused worksheet in a private member
    1.11 +(ab) implement a MULTICAST, a really big hack to get the worksheet out of a lot
    1.12 +	 of gui components
    1.13 +(b) dsitinguisch between tryMatch and new Site in MiniBrowser in ProblemBrowserDialog
    1.14 +
    1.15  		
    1.16  
    1.17  ==============================================================================
     2.1 --- a/src/java/isac/browserdialog/ProblemBrowserDialog.java	Sun Aug 21 13:53:55 2005 +0200
     2.2 +++ b/src/java/isac/browserdialog/ProblemBrowserDialog.java	Sun Aug 21 13:54:25 2005 +0200
     2.3 @@ -62,38 +62,24 @@
     2.4              DialogProtocolException {
     2.5          System.out.println("ProblemBrowserDialog::notifyUserAction()");
     2.6          switch (action.getActionID()) {
     2.7 -        case (IUserAction.UI_PROBLEMBROWSER_PROBLEM_TO_WORKSHEET): {
     2.8 -            return doProblemToWorksheet();
     2.9 -        }
    2.10 -        case (IUserAction.UI_PROBLEMBROWSER_AUTO_MATCH_ON): {
    2.11 -            return setToAutoMatchModeOn();
    2.12 -        }
    2.13 -        case (IUserAction.UI_PROBLEMBROWSER_AUTO_MATCH_OFF): {
    2.14 -            return setToAutoMatchModeOff();
    2.15 -        }
    2.16 -        case (IUserAction.UI_PROBLEMBROWSER_REFINE): {
    2.17 -            return startRefinement();
    2.18 -        }
    2.19 -        case (IUserAction.UI_PROBLEMBROWSER_SELECTION_CHANGED): {
    2.20 -        	ProblemID problem_id = (ProblemID)((UserActionOnKEStoreIDAndWSDID)action).getKEStoreID();
    2.21 -        	String wsd_id = ((UserActionOnKEStoreIDAndWSDID)action).getWSDID();
    2.22 -            if (auto_match_mode_)
    2.23 -                return doTryMatch(problem_id, wsd_id) 
    2.24 -						&& selectedProblemChanged(problem_id);
    2.25 -            else
    2.26 -                return selectedProblemChanged(problem_id);
    2.27 -        }
    2.28 -        case (IUIElement.UI_PROBLEMBROWSER_SELECTED_ID): {
    2.29 -            selected_id_ = (ProblemID) ((UserActionOnKEStoreID) action)
    2.30 -                    .getObjectID();
    2.31 -            browser_ready_ = true;
    2.32 -            return true;
    2.33 -        }
    2.34 -        case (IUIElement.UI_PROBLEMBROWSER_ACTIVE_WORKSHEET): {
    2.35 -            active_worksheet_id_ = ((UserActionOnString) action).getString();
    2.36 -            browser_ready_ = true;
    2.37 -            return true;
    2.38 -        }
    2.39 +	        case (IUserAction.UI_PROBLEMBROWSER_PROBLEM_TO_WORKSHEET): {
    2.40 +	            return doProblemToWorksheet();
    2.41 +	        }
    2.42 +	        case (IUserAction.UI_PROBLEMBROWSER_AUTO_MATCH_ON): {
    2.43 +	            return setToAutoMatchModeOn();
    2.44 +	        }
    2.45 +	        case (IUserAction.UI_PROBLEMBROWSER_AUTO_MATCH_OFF): {
    2.46 +	            return setToAutoMatchModeOff();
    2.47 +	        }
    2.48 +	        case (IUserAction.UI_PROBLEMBROWSER_REFINE): {
    2.49 +	            return startRefinement();
    2.50 +	        }
    2.51 +	        case (IUserAction.UI_PROBLEMBROWSER_SELECTION_CHANGED): {
    2.52 +	        	UserActionOnKEStoreIDAndWSDID ke_store_action = (UserActionOnKEStoreIDAndWSDID)action;
    2.53 +	        	ProblemID problem_id = new ProblemID(ke_store_action.getKEStoreID().getID());
    2.54 +	        	String wsd_id = ke_store_action.getWSDID();
    2.55 +	        	return selectedProblemChanged(problem_id, wsd_id);
    2.56 +	        }
    2.57          }
    2.58  
    2.59          return true;
    2.60 @@ -107,17 +93,18 @@
    2.61       * @return true if no exception is thrown
    2.62       */
    2.63      private boolean doTryMatch(ProblemID kestore_id, String wsd_id) {
    2.64 -        System.out.println("ProblemBrowserDialog::doTryMatch()");
    2.65 +        System.out.println("ProblemBrowserDialog::doTryMatch() kestore_id="+ kestore_id+ " wsd_id="+ wsd_id);
    2.66          try {
    2.67 -
    2.68 -        	SessionManager session_manager = SessionManager.getInstance();
    2.69 -        	IBrowserDialogToWorksheetDialog worksheet_dialog = (IBrowserDialogToWorksheetDialog) session_manager.getWorksheetDialog(wsd_id);
    2.70 -        	Match match = worksheet_dialog.tryMatchProblem(kestore_id);
    2.71 -        	if(match == null)
    2.72 -        		System.out.println("ProblemBrowserDialog::doTryMatch() NULL");
    2.73 -        	else
    2.74 -        		System.out.println("ProblemBrowserDialog::doTrymatch() not null");
    2.75 -        	
    2.76 +	        	SessionManager session_manager = SessionManager.getInstance();
    2.77 +	        	IBrowserDialogToWorksheetDialog worksheet_dialog = (IBrowserDialogToWorksheetDialog) session_manager.getWorksheetDialog(wsd_id);
    2.78 +	        	Match match = worksheet_dialog.tryMatchProblem(kestore_id);
    2.79 +	        	if(match == null)
    2.80 +	        		System.out.println("ProblemBrowserDialog::doTryMatch() NULL");
    2.81 +	        	else {
    2.82 +	        		System.out.println("ProblemBrowserDialog::doTrymatch() not null");
    2.83 +	        		System.out.println("Match status= "+ match.getStatus());
    2.84 +	        	}
    2.85 +	        	
    2.86          } catch (Exception e) {
    2.87              e.printStackTrace();
    2.88          }
    2.89 @@ -136,23 +123,46 @@
    2.90      }
    2.91  
    2.92      /**
    2.93 -     * loads the new content into the mini browser of the new selected problem
    2.94 -     * @param kestore_id
    2.95 +     * A new problem is selected. So do something witch this information. 
    2.96 +     * 
    2.97 +     * In some cases there is a need the knowledge of the on-top-worksheets dialog.
    2.98 +     * Therefore the second parameter is needed.
    2.99 +     *
   2.100 +     * @param problem_id The id of the selected problem
   2.101 +     * @param wsd_id The id of the wsd_id of the on-top-worksheed (if exists)
   2.102       */
   2.103 -    private boolean selectedProblemChanged(KEStoreID kestore_id) {
   2.104 -        try {
   2.105 -            //TOOODO JL: sending back a new problem for the browser
   2.106 -            browser_frame_rmi_.doUIAction(new UIActionNewProblemForBrowser(
   2.107 -                    IUIElement.UI_PROBLEMBROWSER_SELECTION_CHANGED,
   2.108 -                    UIAction.UI_CONTEXT_PROBLEM_BROWSER_PANEL, "link"));
   2.109 -        } catch (RemoteException e) {
   2.110 -            // TODO Auto-generated catch block
   2.111 +    private boolean selectedProblemChanged(ProblemID problem_id, String wsd_id) {
   2.112 +
   2.113 +    	System.out.println("ProblemBrowserDialog::selectedproblemChanged()");
   2.114 +
   2.115 +    	try {
   2.116 +
   2.117 +    		if(auto_match_mode_ && wsd_id != null) {
   2.118 +    			doTryMatch(problem_id, wsd_id);
   2.119 +    		}
   2.120 +    		
   2.121 +    		sendLinkOfSelectedProblemToBrowser(problem_id);
   2.122 +
   2.123 +       } catch (RemoteException e) {
   2.124              e.printStackTrace();
   2.125          }
   2.126          return false;
   2.127      }
   2.128  
   2.129      /**
   2.130 +     * Send the browser the information to display the new selected problem
   2.131 +     * 
   2.132 +	 * @param problem_id
   2.133 +     * @throws RemoteException
   2.134 +	 */
   2.135 +	private void sendLinkOfSelectedProblemToBrowser(ProblemID problem_id) throws RemoteException {
   2.136 +   		//TOOODO JL: sending back a new problem for the browser
   2.137 +    	browser_frame_rmi_.doUIAction(new UIActionNewProblemForBrowser(
   2.138 +                IUIElement.UI_PROBLEMBROWSER_SELECTION_CHANGED,
   2.139 +                UIAction.UI_CONTEXT_PROBLEM_BROWSER_PANEL, "link"));
   2.140 +	}
   2.141 +
   2.142 +	/**
   2.143       * Does NOT realy open the problem browser, but does add all buttons after
   2.144       * opening the problem broser. This is necessarry because the opening of the
   2.145       * browser is not done dynamically. But the dialog has to notice that the
     3.1 --- a/src/java/isac/gui/browser/panels/ProblemBrowserPanel.java	Sun Aug 21 13:53:55 2005 +0200
     3.2 +++ b/src/java/isac/gui/browser/panels/ProblemBrowserPanel.java	Sun Aug 21 13:54:25 2005 +0200
     3.3 @@ -80,6 +80,7 @@
     3.4  		UserActionOnKEStoreIDAndWSDID action = new UserActionOnKEStoreIDAndWSDID(
     3.5  				IUIAction.UI_PROBLEMBROWSER_SELECTION_CHANGED,
     3.6  				getSelectedKeStoreId(), getTopWSDId());
     3.7 +		
     3.8  		ui_interface_.notifyUserAction(action);
     3.9  	}
    3.10  
    3.11 @@ -132,46 +133,46 @@
    3.12  	 * @see isac.interfaces.IToGUI#doUIAction(isac.useractions.IUIAction)
    3.13  	 */
    3.14  	public void doUIAction(IUIAction action) throws RemoteException {
    3.15 -		System.out.println("ProblemBrowserPanel::doUIAction() action="+ action.getAction());
    3.16 -		switch(action.getAction()){
    3.17 -			case(IUIElement.UI_PROBLEMBROWSER_SELECTED_ID): {
    3.18 -				sendSelectedId();
    3.19 -				break;
    3.20 -			}
    3.21 -			case(IUIElement.UI_PROBLEMBROWSER_ACTIVE_WORKSHEET): {
    3.22 -				sendActiveWorksheetId();
    3.23 -				break;
    3.24 -			}
    3.25 -		}
    3.26 +//		System.out.println("ProblemBrowserPanel::doUIAction() action="+ action.getAction());
    3.27 +//		switch(action.getAction()){
    3.28 +//			case(IUIElement.UI_PROBLEMBROWSER_SELECTED_ID): {
    3.29 +//				sendSelectedId();
    3.30 +//				break;
    3.31 +//			}
    3.32 +//			case(IUIElement.UI_PROBLEMBROWSER_ACTIVE_WORKSHEET): {
    3.33 +//				sendActiveWorksheetId();
    3.34 +//				break;
    3.35 +//			}
    3.36 +//		}
    3.37  	}
    3.38  
    3.39  
    3.40 -	/**
    3.41 -	 * Sends the active worksheet id to the dialog
    3.42 -	 * 
    3.43 -	 * @TOOODO send the real id
    3.44 -	 */
    3.45 -	private void sendActiveWorksheetId() {
    3.46 -		System.out.println("ProblemBrowserPanel::sendActiveWorksheetId()");
    3.47 -		UserActionOnString action = new UserActionOnString(
    3.48 -				IUIElement.UI_PROBLEMBROWSER_ACTIVE_WORKSHEET,
    3.49 -				"TOOODO: send the WorksheetID");
    3.50 -		ui_interface_.notifyUserAction(action);
    3.51 -	}
    3.52 +//	/**
    3.53 +//	 * Sends the active worksheet id to the dialog
    3.54 +//	 * 
    3.55 +//	 * @TOOODO send the real id
    3.56 +//	 */
    3.57 +//	private void sendActiveWorksheetId() {
    3.58 +//		System.out.println("ProblemBrowserPanel::sendActiveWorksheetId()");
    3.59 +//		UserActionOnString action = new UserActionOnString(
    3.60 +//				IUIElement.UI_PROBLEMBROWSER_ACTIVE_WORKSHEET,
    3.61 +//				"TOOODO: send the WorksheetID");
    3.62 +//		ui_interface_.notifyUserAction(action);
    3.63 +//	}
    3.64  
    3.65  
    3.66 -	/**
    3.67 -	 * sends the ID of the selecte problem
    3.68 -	 */
    3.69 -	private void sendSelectedId() {
    3.70 -		System.out.println("ProblemBrowserpanel::sendSelectedId()");
    3.71 -		UserActionOnKEStoreID action = new UserActionOnKEStoreID(
    3.72 -				IUIElement.UI_PROBLEMBROWSER_SELECTED_ID,
    3.73 -				getSelectedKeStoreId());
    3.74 -		
    3.75 -		ui_interface_.notifyUserAction(action);
    3.76 -		
    3.77 -	}
    3.78 +//	/**
    3.79 +//	 * sends the ID of the selecte problem
    3.80 +//	 */
    3.81 +//	private void sendSelectedId() {
    3.82 +//		System.out.println("ProblemBrowserpanel::sendSelectedId()");
    3.83 +//		UserActionOnKEStoreID action = new UserActionOnKEStoreID(
    3.84 +//				IUIElement.UI_PROBLEMBROWSER_SELECTED_ID,
    3.85 +//				getSelectedKeStoreId());
    3.86 +//		
    3.87 +//		ui_interface_.notifyUserAction(action);
    3.88 +//		
    3.89 +//	}
    3.90  
    3.91  
    3.92  	/* (non-Javadoc)