Java Code Examples for javax.faces.event.ValueChangeEvent#getNewValue()

The following examples show how to use javax.faces.event.ValueChangeEvent#getNewValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrivateMessagesTool.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processChangeSelectView(ValueChangeEvent eve)
{
  multiDeleteSuccess = false;
  String currentValue = (String) eve.getNewValue();
	if (!currentValue.equalsIgnoreCase(THREADED_VIEW) && selectView != null && selectView.equals(THREADED_VIEW))
	{
		selectView = "";
		viewChanged = true;
		getDecoratedPvtMsgs();
		return;
  }
	else if (currentValue.equalsIgnoreCase(THREADED_VIEW))
	{
		selectView = THREADED_VIEW;
		if (searchPvtMsgs != null && !searchPvtMsgs.isEmpty())
			this.rearrageTopicMsgsThreaded(true);
		else
			this.rearrageTopicMsgsThreaded(false);
		return;
	}
}
 
Example 2
Source File: SignupMeetingsBean.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * This is a ValueChange Listener to watch the show-all-recurring-events
 * check-box value change by user.
 * 
 * @param vce
 *            a ValuechangeEvent object.
 * @return a outcome string.
 */
public String processExpandAllRcurEvents(ValueChangeEvent vce) {
	Boolean expandAllEvents = (Boolean) vce.getNewValue();
	setShowAllRecurMeetings(expandAllEvents.booleanValue());
	List<SignupMeetingWrapper> smWrappers = getSignupMeetings();
	if (smWrappers != null) {
		if (isShowAllRecurMeetings()) {
			for (SignupMeetingWrapper smWrp : smWrappers) {
				smWrp.setRecurEventsSize(0);
				smWrp.setSubRecurringMeeting(false);
			}
		} else {
			getSignupSorter().setSortAscending(true);
			getSignupSorter().setSortColumn(SignupSorter.DATE_COLUMN);
			getSignupSorter().sort(smWrappers);
			markingRecurMeetings(smWrappers);
			setSignupMeetings(smWrappers);
		}
	}

	return MAIN_EVENTS_LIST_PAGE_URL;

}
 
Example 3
Source File: BrandBean.java    From development with Apache License 2.0 6 votes vote down vote up
/**
 * Marketplace chooser
 * 
 * @param event
 */
public void processValueChange(ValueChangeEvent event) {
    String selectedMarketplaceId = (String) event.getNewValue();
    this.marketplaceBean.processValueChange(event);
    if (selectedMarketplaceId.equals("0")) {
        marketplace = null;
        setBrandingUrl(null);
    } else {
        try {
            marketplace = getMarketplaceService().getMarketplaceById(
                    selectedMarketplaceId);
            setBrandingUrl(getMarketplaceService().getBrandingUrl(
                    selectedMarketplaceId));
        } catch (ObjectNotFoundException e) {
            getMarketplaceBean().checkMarketplaceDropdownAndMenuVisibility(
                    null);
            marketplace = null;
            setBrandingUrl(null);
        }
    }
}
 
Example 4
Source File: participantData.java    From yawl with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void cbbParticipants_processValueChange(ValueChangeEvent event) {
    String pid = (String) event.getNewValue();
    if (pid.length() > 0) {
        try {
            Participant p = _sb.setEditedParticipant(pid);
            populateFields(p) ;
        }
        catch (CloneNotSupportedException cnse) {
            msgPanel.error("Could not change selected Participant: cloning Exception");
        }
    }
    else {
        clearFields();                    // blank (first) option selected
        _sb.setEditedParticipantToNull() ;
    }
    setMode(Mode.edit);
}
 
Example 5
Source File: EventPager.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void handleValueChange (ValueChangeEvent event)
{
    PhaseId
        phaseId = event.getPhaseId();

    String
        oldValue = (String) event.getOldValue(),
        newValue = (String) event.getNewValue();

    if (phaseId.equals(PhaseId.ANY_PHASE))
    {
        event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
        event.queue();
    }
    else if (phaseId.equals(PhaseId.UPDATE_MODEL_VALUES))
    {
    // do you method here
    }
}
 
Example 6
Source File: NewSignupMeetingBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * This is a ValueChange Listener to watch changes on the selection of
 * 'unlimited attendee' choice by user.
 *
 * @param vce a ValuechangeEvent object.
 * @return a outcome string.
 */
public String processGroup(ValueChangeEvent vce) {
    Boolean changeValue = (Boolean) vce.getNewValue();
    if (changeValue != null) {
        unlimited = changeValue;
        if (unlimited) maxOfAttendees = 10;
    }

    return "";
}
 
Example 7
Source File: OperatorOrgBean.java    From development with Apache License 2.0 5 votes vote down vote up
public void processValueChange(ValueChangeEvent e) {

        if (e.getNewValue() == null) {
            setSelectedTenant(null);
            return;
        }

        setSelectedTenant(e.getNewValue().toString());
        selectedMarketplace = null;
    }
 
Example 8
Source File: EvaluationManagementBackingBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void changePosition(ValueChangeEvent valueChangeEvent) {
    final Integer roomToChangeNewPosition = (Integer) valueChangeEvent.getNewValue();
    if (roomToChangeNewPosition != 0) {
        final Integer roomToChangeOldPosition = getEvaluationRoomsPositions().get(getRoomToChangeID());
        final String elementKey = getElementKeyFor(getEvaluationRoomsPositions(), roomToChangeNewPosition);
        getEvaluationRoomsPositions().put(elementKey, roomToChangeOldPosition);
        getEvaluationRoomsPositions().put(getRoomToChangeID(), roomToChangeNewPosition);
    }
}
 
Example 9
Source File: ItemBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void toggleChoiceTypes(ValueChangeEvent event) {

	String type = (String) event.getNewValue();
	if ((type == null) || type.equals(TypeFacade.MULTIPLE_CHOICE.toString())) {
	  setItemType(TypeFacade.MULTIPLE_CHOICE.toString());
	}
	else if (type.equals(TypeFacade.MULTIPLE_CORRECT_SINGLE_SELECTION.toString())) {
	  setItemType(TypeFacade.MULTIPLE_CORRECT_SINGLE_SELECTION.toString());
	}
	else {
	  setItemType(TypeFacade.MULTIPLE_CORRECT.toString());
	}

  }
 
Example 10
Source File: SignupMeetingsBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * This is a ValueChange Listener to watch the category filter selection by user.
 * 
 * @param vce a ValuechangeEvent object.
 * @return a outcome string.
 */
public String processSelectedCategory(ValueChangeEvent vce) {
	String selectedCategory = (String) vce.getNewValue();
	//note that blank values are allowed
	if(!categoryFilter.equals(selectedCategory)){
		setCategoryFilter(selectedCategory);
		setSignupMeetings(null);// reset
	}
	
	return "";
}
 
Example 11
Source File: CategoryBean.java    From development with Apache License 2.0 5 votes vote down vote up
public void processValueChange(final ValueChangeEvent event) {
    final String selectedMarketplaceId = (String) event.getNewValue();
    this.resetCategoriesLists();

    if (this.isMarketplaceValid(selectedMarketplaceId)) {
        this.setMarketplaceId(selectedMarketplaceId);
        this.getCategoriesRows();
    } else {
        this.setMarketplaceId(null);
    }

    this.marketplaceBean.processValueChange(event);
}
 
Example 12
Source File: podHomeBean.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
/**
	 * Creates a BufferedInputStream to get ready to upload file selected. Used
	 * by Add Podcast and Revise Podcast pages.
	 * 
	 * @param event
	 *            ValueChangeEvent object generated by selecting a file to
	 *            upload.
	 *            
	 * @throws AbortProcessingException
	 * 			Internal processing error attempting to set up BufferedInputStream
	 */
	public void processFileUpload(ValueChangeEvent event)
			throws AbortProcessingException {
		UIComponent component = event.getComponent();

		Object newValue = event.getNewValue();
		Object oldValue = event.getOldValue();
		PhaseId phaseId = event.getPhaseId();
		Object source = event.getSource();
//		log.info("processFileUpload() event: " + event
//				+ " component: " + component + " newValue: " + newValue
//				+ " oldValue: " + oldValue + " phaseId: " + phaseId
//				+ " source: " + source);

		if (newValue instanceof String)
			return;
		if (newValue == null)
			return;

		FileItem item = (FileItem) event.getNewValue();
		String fieldName = item.getFieldName();
		filename = FilenameUtils.getName(item.getName());
		fileSize = item.getSize();
		fileContentType = item.getContentType();
//		log.info("processFileUpload(): item: " + item
//				+ " fieldname: " + fieldName + " filename: " + filename
//				+ " length: " + fileSize);

		// Read the file as a stream (may be more memory-efficient)
		try {
			fileAsStream = new BufferedInputStream(item.getInputStream());
			
		} 
		catch (IOException e) {
			log.warn("IOException while attempting to set BufferedInputStream to upload "
							+ filename + " from site " + podcastService.getSiteId() + ". "
									 + e.getMessage(), e);
			setErrorMessage(INTERNAL_ERROR_ALERT);

		}

	}
 
Example 13
Source File: QuestionScoreListener.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
/**
 * Process a value change.
 */
public void processValueChange(ValueChangeEvent event) {
	log.debug("QuestionScore CHANGE LISTENER.");
	ResetQuestionScoreListener reset = new ResetQuestionScoreListener();
	reset.processAction(null);

	QuestionScoresBean bean = (QuestionScoresBean) ContextUtil.lookupBean("questionScores");
	TotalScoresBean totalBean = (TotalScoresBean) ContextUtil.lookupBean("totalScores");
	HistogramScoresBean histogramBean = (HistogramScoresBean) ContextUtil.lookupBean("histogramScores");
	SubmissionStatusBean submissionbean = (SubmissionStatusBean) ContextUtil.lookupBean("submissionStatus");
    

	// we probably want to change the poster to be consistent
	String publishedId = ContextUtil.lookupParam("publishedId");
	boolean toggleSubmissionSelection = false;

	String selectedvalue = (String) event.getNewValue();
	if ((selectedvalue != null) && (!selectedvalue.equals(""))) {
		if (event.getComponent().getId().indexOf("sectionpicker") > -1) {
			bean.setSelectedSectionFilterValue(selectedvalue); // changed
			totalBean.setSelectedSectionFilterValue(selectedvalue);
			submissionbean.setSelectedSectionFilterValue(selectedvalue);
		} else if (event.getComponent().getId().indexOf("allSubmissions") > -1) {
			bean.setAllSubmissions(selectedvalue); // changed submission
			// pulldown
			totalBean.setAllSubmissions(selectedvalue); // changed for total
			// score bean
			histogramBean.setAllSubmissions(selectedvalue); // changed for
			// histogram
			// score bean
			toggleSubmissionSelection = true;
		} else // inline or popup
		{
			bean.setSelectedSARationaleView(selectedvalue); // changed
			// submission
			// pulldown
		}
	}

	if (!questionScores(publishedId, bean, toggleSubmissionSelection)) {
		throw new RuntimeException("failed to call questionScores.");
	}

	FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation(FacesContext.getCurrentInstance(), null, "questionScores");

}
 
Example 14
Source File: OperatorOrgBean.java    From development with Apache License 2.0 4 votes vote down vote up
/**
 * value change listener for technology provider role check-box
 */
public void technologyProviderRoleChanged(ValueChangeEvent event) {
    Boolean checkBoxChecked = (Boolean) event.getNewValue();
    setTechnologyProvider(checkBoxChecked.booleanValue());
}
 
Example 15
Source File: XMLImportBean.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public void importAssessment(ValueChangeEvent e)
{
 String sourceType = ContextUtil.lookupParam("sourceType");
 String uploadFile = (String) e.getNewValue();

 if (uploadFile!= null && uploadFile.startsWith("SizeTooBig:")) {
  Long sizeMax = Long.valueOf(ServerConfigurationService.getString("samigo.sizeMax", "40960"));
  ResourceLoader rb =new ResourceLoader("org.sakaiproject.tool.assessment.bundle.AuthorImportExport");
  String sizeTooBigMessage = MessageFormat.format(rb.getString("import_size_too_big"), uploadFile.substring(11), Math.round(sizeMax.floatValue()/1024));
     FacesMessage message = new FacesMessage(sizeTooBigMessage);
     FacesContext.getCurrentInstance().addMessage(null, message);
     // remove unsuccessful file
     log.debug("****Clean up file:"+uploadFile);
     File upload = new File(uploadFile);
     upload.delete();
     authorBean.setImportOutcome("importAssessment");
     return;
 }
 authorBean.setImportOutcome("author");

 if ("2".equals(sourceType)) {
   if(uploadFile.toLowerCase().endsWith(".zip")) {
  isCP = true;
  importAssessment(uploadFile, true, true);
   }
   else {
  isCP = false;
  importAssessment(uploadFile, false, true);
   }
 }
 else {
  if(uploadFile.toLowerCase().endsWith(".zip")) {
	  isCP = true;
	  importAssessment(uploadFile,true, false);
  }
  else {
	  isCP = false;
	  importAssessment(uploadFile, false, false);
  }
 }
}
 
Example 16
Source File: TotalScoreListener.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
/**
 * Process a value change.
 */
public void processValueChange(ValueChangeEvent event)
{
  // this is called when you change the section or submission pulldown. 
  // need reset assessmentGrading list
  ResetTotalScoreListener reset = new ResetTotalScoreListener();
  reset.processAction(null);

  TotalScoresBean bean = (TotalScoresBean) ContextUtil.lookupBean("totalScores");
  QuestionScoresBean questionbean = (QuestionScoresBean) ContextUtil.lookupBean("questionScores");
  HistogramScoresBean histobean = (HistogramScoresBean) ContextUtil.lookupBean("histogramScores");
  SubmissionStatusBean submissionbean = (SubmissionStatusBean) ContextUtil.lookupBean("submissionStatus");
  
  // we probably want to change the poster to be consistent
  String publishedId = ContextUtil.lookupParam("publishedId");
  PublishedAssessmentService pubAssessmentService = new PublishedAssessmentService();
  PublishedAssessmentFacade pubAssessment = pubAssessmentService.
                                            getPublishedAssessment(publishedId);

  String selectedvalue= (String) event.getNewValue();
  if ((selectedvalue!=null) && (!selectedvalue.equals("")) ){
    if (event.getComponent().getId().indexOf("sectionpicker") >-1 ) 
    {
      log.debug("changed section picker");
      bean.setSelectedSectionFilterValue(selectedvalue);   // changed section pulldown
      questionbean.setSelectedSectionFilterValue(selectedvalue);
      submissionbean.setSelectedSectionFilterValue(selectedvalue);
    }
    else 
    {
      log.debug("changed submission pulldown ");
      bean.setAllSubmissions(selectedvalue);    // changed for total score bean
      histobean.setAllSubmissions(selectedvalue);    // changed for histogram score bean
      questionbean.setAllSubmissions(selectedvalue); // changed for Question score bean
    }
  }

  if (!totalScores(pubAssessment, bean, true))
  {
    throw new RuntimeException("failed to call totalScores.");
  }
  // http://stackoverflow.com/questions/1590484/updating-jsf-datatable-based-on-selectonemenu-values
  FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation(
          FacesContext.getCurrentInstance(), null, "totalScores");
}
 
Example 17
Source File: OperatorOrgBean.java    From development with Apache License 2.0 4 votes vote down vote up
public void newBrokerRoleChanged(ValueChangeEvent event) {
    Boolean checkBoxChecked = (Boolean) event.getNewValue();
    this.setNewBroker(((checkBoxChecked.booleanValue())));
}
 
Example 18
Source File: OperatorOrgBean.java    From development with Apache License 2.0 4 votes vote down vote up
public void newTechnologyProviderRoleChanged(ValueChangeEvent event) {
    Boolean checkBoxChecked = (Boolean) event.getNewValue();
    this.setNewTechnologyProvider(((checkBoxChecked.booleanValue())));
}
 
Example 19
Source File: UserBean.java    From tutorials with MIT License 4 votes vote down vote up
public void nameChanged(ValueChangeEvent event) {
    this.proposedLogin = event.getNewValue() + "-" + lastName;
}
 
Example 20
Source File: ItemAuthorBean.java    From sakai with Educational Community License v2.0 3 votes vote down vote up
public void selectItemType(ValueChangeEvent event) {

        //FacesContext context = FacesContext.getCurrentInstance();
        String type = (String) event.getNewValue();
          setItemType(type);

  }