package ca.ualberta.CMPUT301W15T06;

public class ClaimantAddDestinationController {
	private Claim claim=null;
			
	public ClaimantAddDestinationController(Claim claim){
		this.claim=claim;
	}
	

	public void addDestination(String dest, String reason) throws StatusException {
		
		if (AppSingleton.getInstance().getStatus().equals("Submitted")||AppSingleton.getInstance().getStatus().equals("Approved")){
			throw new StatusException();					
		}
		
		Destination destination=new Destination(dest);
		destination.setReason(reason);
		if (dest.equals("")||reason.equals("")){
			destination.setMissValue(true);
		}else{
			destination.setMissValue(false);
		}
		
		destination.addModelListener(new Listener() {
			
			@Override
			public void update() {
				// TODO Auto-generated method stub
				claim.notifyListeners();
			}
		});
		claim.getDestinationList().add(destination);	
		claim.notifyListeners();
	}
}

@@ -1,200 +1,2252 @@
-package ca.ualberta.CMPUT301W15T06;%0A%0Apublic class ClaimantAddDestinationController %7B%0A%09private Claim claim=null;%0A%09%09%09%0A%09public ClaimantAddDestinationController(Claim claim)%7B%0A%09%09this.claim=claim;%0A%09%7D%0A%09%0A
+/*%0AUA CMPUT 301 Project Group: CMPUT301W15T06%0ACopyright %7B2015%7D %7BJingjiao Ni%0A              Tianqi Xiao%0A              Jiafeng Wu%0A              Xinyi Pan %0A              Xinyi Wu%0A              Han Wang%7D%0ALicensed under the Apache License, Version 2.0 (the %22License%22);%0Ayou may not use this file except in compliance with the License.%0AYou may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 %0AUnless required by applicable law or agreed to in writing, software distributed under %0Athe License is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF %0AANY KIND, either express or implied. See the License for the specific language %0Agoverning permissions and limitations under the License.%0A */%0A %0A /**%0A  * This %3Ccode%3EClaimantAddDestinationController%3C/code%3E is a controller class%0A  * of %3Ccode%3EDestination%3C/code%3E and %3Ccode%3EClaim%3C/code%3E. By calling %0A  * this class, user(claimant) can add a %3Ccode%3EClaim%3C/code%3E with its %0A  * detail to the claimList.%0A  * %0A  * @author CMPUT301W15T06%0A  * @version 03/16/2015%0A  * @see java.text.DateFormat%0A  * @see java.text.ParseException%0A  * @see java.text.SimpleDateFormat%0A  * @see java.util.ArrayList%0A  * @see java.util.Date%0A  * @see java.util.Locale%0A  */%0Apackage ca.ualberta.CMPUT301W15T06;%0A%0Apublic class ClaimantAddDestinationController %7B%0A%09%0A%09/**%0A%09 * Set Claim object claim to record the claim detail. The initial%0A%09 * default value is null.%0A%09 */%0A%09private Claim claim=null;%0A%09%0A%09%0A%09/**%0A%09 * General contruction. This method is will create a Claim object %0A%09 * claim for other classes and methods to use.%0A%09 * %0A%09 * @param claim  a Claim object%0A%09 */%0A%09public ClaimantAddDestinationController(Claim claim)%7B%0A%09%09this.claim=claim;%0A%09%7D%0A%09%0A%09/**%0A%09 * This method will create a new String variable destination and reason%0A%09 * to the claim. Then set a bolean variable missValueto to justify%0A%09 * the %3Ccode%3EClaim%3C/code%3E and %3Ccode%3EDestination%3C/code%3E. It also gonna %0A%09 * notify all Listener in listeners list about this update.%0A%09 * %0A%09 * @param dest  a String variable%0A%09 * @param reason  a String variable%0A%09 * @throw StatusException%0A%09 * @see java.text.DateFormat%0A%09 * @see java.text.ParseException%0A%09 * @see java.text.SimpleDateFormat%0A%09 * @see java.util.ArrayList%0A%09 * @see java.util.Date%0A%09 * @see java.util.Locale%0A%09 */
 %0A%09pu

Update ClaimantAddDestinationController.java