Group dis = getRunBiz(iwc).getDistanceByUserID(Integer.parseInt(userID)); this.f.addParameter(IWMarathonConstants.GROUP_TYPE_RUN_DISTANCE, dis.getPrimaryKey().toString()); if (userID != null && runGroupID != null) { run = getRunBiz(iwc).getRunObjByUserIDandDistanceID(Integer.parseInt(userID), Integer.parseInt(dis.getPrimaryKey().toString())); }
	public void initializeFields() {		IWContext iwc = IWContext.getInstance();		IWResourceBundle iwrb = getResourceBundle(iwc);		String userID = iwc.getParameter("ic_user_id");		String selectedGroupID = iwc.getParameter("selected_ic_group_id");		String runGroupID = iwc.getParameter(IWMarathonConstants.GROUP_TYPE_RUN);		User user = null;		if (userID != null) {			try {				user = getUserBiz().getUser(Integer.parseInt(userID));				if (user != null) {					this.userNameField = new Text(user.getName());				}			}			catch (NumberFormatException e1) {				e1.printStackTrace();			}			catch (RemoteException e1) {				e1.printStackTrace();			}		}		if (runGroupID != null && !runGroupID.equals("")) {			Group runGroup = null;			try {				runGroup = getGroupBiz().getGroupByGroupID(Integer.parseInt(runGroupID));			}			catch (IBOLookupException e) {				e.printStackTrace();			}			catch (NumberFormatException e) {				e.printStackTrace();			}			catch (RemoteException e) {				e.printStackTrace();			}			catch (FinderException e) {				e.printStackTrace();			}			this.runField = new Text(iwrb.getLocalizedString(runGroup.getName(), runGroup.getName()));		}		Participant run = null;		if (userID != null && selectedGroupID != null) {			try {				run = getRunBiz(iwc).getRunObjByUserAndGroup(Integer.parseInt(userID), Integer.parseInt(selectedGroupID));				Group dis = getRunBiz(iwc).getDistanceByUserID(Integer.parseInt(userID));				this.f.addParameter(IWMarathonConstants.GROUP_TYPE_RUN_DISTANCE, dis.getPrimaryKey().toString());				if (userID != null && runGroupID != null) {					run = getRunBiz(iwc).getRunObjByUserIDandDistanceID(Integer.parseInt(userID), Integer.parseInt(dis.getPrimaryKey().toString()));				}			}			catch (Exception re) {				log(re);			}		}		this.participantNumberField = new TextInput(IWMarathonConstants.PARAMETER_PARTICIPANT_NUMBER);		this.chipNumberField = new TextInput(IWMarathonConstants.PARAMETER_CHIP_NUMBER);		this.tShirtField = new DropdownMenu(IWMarathonConstants.PARAMETER_TSHIRT);		SelectOption empty = new SelectOption(iwrb.getLocalizedString("run_reg.select_tee_shirt_size", "Select tee-shirt size"), "-1");		SelectOption selectAdult = new SelectOption(iwrb.getLocalizedString("run_reg.adult_sized", "Adult sizes"), "-1");		this.small = new SelectOption("- " + iwrb.getLocalizedString("run_reg.small", "Small"), IWMarathonConstants.PARAMETER_TSHIRT_S);		this.medium = new SelectOption("- " + iwrb.getLocalizedString("run_reg.medium", "Medium"), IWMarathonConstants.PARAMETER_TSHIRT_M);		this.large = new SelectOption("- " + iwrb.getLocalizedString("run_reg.large", "Large"), IWMarathonConstants.PARAMETER_TSHIRT_L);		this.xlarge = new SelectOption("- " + iwrb.getLocalizedString("run_reg.xlarge", "Larger"), IWMarathonConstants.PARAMETER_TSHIRT_XL);		this.xxlarge = new SelectOption("- " + iwrb.getLocalizedString("run_reg.xxlarge", "Largest"), IWMarathonConstants.PARAMETER_TSHIRT_XXL);		this.tShirtField.addOption(empty);		this.tShirtField.addOption(selectAdult);		this.tShirtField.addOption(this.small);		this.tShirtField.addOption(this.medium);		this.tShirtField.addOption(this.large);		this.tShirtField.addOption(this.xlarge);		this.tShirtField.addOption(this.xxlarge);		this.selectKids = new SelectOption(iwrb.getLocalizedString("run_reg.kids_sized", "Kids sizes"), "-1");		this.smallKids = new SelectOption("- " + iwrb.getLocalizedString("run_reg.small_kids", "Small"), IWMarathonConstants.PARAMETER_TSHIRT_S + "_kids");		this.mediumKids = new SelectOption("- " + iwrb.getLocalizedString("run_reg.medium_kids", "Medium"), IWMarathonConstants.PARAMETER_TSHIRT_M + "_kids");		this.largeKids = new SelectOption("- " + iwrb.getLocalizedString("run_reg.large_kids", "Large"), IWMarathonConstants.PARAMETER_TSHIRT_L + "_kids");		this.xlargeKids = new SelectOption("- " + iwrb.getLocalizedString("run_reg.xlarge_kids", "Larger"), IWMarathonConstants.PARAMETER_TSHIRT_XL + "_kids");		this.tShirtField.addOption(this.selectKids);		this.tShirtField.addOption(this.smallKids);		this.tShirtField.addOption(this.mediumKids);		this.tShirtField.addOption(this.largeKids);		this.tShirtField.addOption(this.xlargeKids);		this.payMethodField = new DropdownMenu(IWMarathonConstants.PARAMETER_PAY_METHOD);		this.notPayed = new SelectOption(iwrb.getLocalizedString("run_tab.not_payed", "Not payed"), "not_payed");		this.credit = new SelectOption(iwrb.getLocalizedString("run_tab.credit", "Credit"), "credit");		this.debet = new SelectOption(iwrb.getLocalizedString("run_tab.debet", "Debet"), "debet");		this.cash = new SelectOption(iwrb.getLocalizedString("run_tab.cash", "Cash"), "cash");		this.payMethodField.addOption(this.notPayed);		this.payMethodField.addOption(this.credit);		this.payMethodField.addOption(this.debet);		this.payMethodField.addOption(this.cash);		this.payedAmountField = new TextInput(IWMarathonConstants.PARAMETER_AMOUNT);		this.teamNameField = new TextInput(IWMarathonConstants.PARAMETER_GROUP_NAME);		this.runTimeField = new TextInput(IWMarathonConstants.PARAMETER_RUN_TIME);		this.chipTimeField = new TextInput(IWMarathonConstants.PARAMETER_CHIP_TIME);		if (run != null) {			int disID = run.getRunDistanceGroupID();			int grID = run.getRunGroupGroupID();			Group dis = null;			Group gr = null;			try {				if (disID != -1) {					dis = getGroupBiz().getGroupByGroupID(disID);				}				if (grID != -1) {					gr = getGroupBiz().getGroupByGroupID(grID);				}			}			catch (IBOLookupException e) {				e.printStackTrace();			}			catch (RemoteException e) {				e.printStackTrace();			}			catch (FinderException e) {				e.printStackTrace();			}			if (dis != null) {				this.distanceField = new Text(iwrb.getLocalizedString(dis.getName(), dis.getName()));			}			if (gr != null) {				this.groupField = new Text(iwrb.getLocalizedString(gr.getName(), gr.getName()));			}			this.participantNumberField.setContent(String.valueOf(run.getParticipantNumber()));			this.chipNumberField.setContent(String.valueOf(run.getChipNumber()));			this.tShirtField.setSelectedElement(run.getTShirtSize());			this.payMethodField.setSelectedElement(run.getPayMethod());			this.payedAmountField.setContent(run.getPayedAmount());			if (run.getPayedAmount() != null && run.getPayMethod() == null) {				this.payMethodField.setSelectedElement("credit");			}			this.teamNameField.setContent(run.getRunGroupName());			this.runTimeField.setContent(String.valueOf(run.getRunTime()));			this.chipTimeField.setContent(String.valueOf(run.getChipTime()));		}		this.submitButton = new SubmitButton(iwrb.getLocalizedString("run_tab.save", "Save"), PARAMETER_ACTION, Integer.toString(ACTION_SAVE));		this.submitButton.setAsImageButton(true);	}