javax.faces.event.ValueChangeEvent Java Examples

The following examples show how to use javax.faces.event.ValueChangeEvent. 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: MessageForumStatisticsBean.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public String processGradeAssignChange(ValueChangeEvent vce) 
{ 
	String changeAssign = (String) vce.getNewValue(); 
	if (changeAssign == null) 
	{ 
		return null; 
	} 
	else 
	{ 
		gradebookItemChosen = true;
		selectedAssign = changeAssign; 
		if(!DEFAULT_GB_ITEM.equalsIgnoreCase(selectedAssign)) {
			String gradebookUid = toolManager.getCurrentPlacement().getContext();
			selAssignName = ((SelectItem)assignments.get((Integer.valueOf(selectedAssign)).intValue())).getLabel();	
		}

		return null;
	} 
}
 
Example #2
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 #3
Source File: SubmissionStatusListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * Process a value change.
 */
public void processValueChange(ValueChangeEvent event)
{
  log.debug("QuestionScore CHANGE LISTENER.");
  SubmissionStatusBean bean = (SubmissionStatusBean) ContextUtil.lookupBean("submissionStatus");
  TotalScoresBean totalScoresBean = (TotalScoresBean) ContextUtil.lookupBean("totalScores");
  QuestionScoresBean questionbean = (QuestionScoresBean) ContextUtil.lookupBean("questionScores");
  
  // we probably want to change the poster to be consistent
  String publishedId = ContextUtil.lookupParam("publishedId");

  String selectedvalue= (String) event.getNewValue();
  if ((selectedvalue!=null) && (!selectedvalue.equals("")) ){
    if (event.getComponent().getId().indexOf("sectionpicker") >-1 )
    {
      bean.setSelectedSectionFilterValue(selectedvalue);   // changed section pulldown
      totalScoresBean.setSelectedSectionFilterValue(selectedvalue);
      questionbean.setSelectedSectionFilterValue(selectedvalue);
    }
  }

  if (!submissionStatus(publishedId, bean, totalScoresBean, false))
  {
    throw new RuntimeException("failed to call questionScores.");
  }
}
 
Example #4
Source File: ExportBillingDataCtrlTest.java    From development with Apache License 2.0 6 votes vote down vote up
@Test
public void billingTypeChanged() {
    // given
    UIInput input = mock(UIInput.class);
    ValueChangeEvent e = new ValueChangeEvent(input, null,
            BillingDataType.RevenueShare);

    // when
    ctrl.billingTypeChanged(e);

    // then
    assertEquals(BillingDataType.RevenueShare,
            model.getSelectedBillingDataType());
    assertNull(model.getFromDate());
    assertNull(model.getToDate());
    assertNull(model.getSelectedSharesResultType());
}
 
Example #5
Source File: CustomizeLandingpageCtrl.java    From development with Apache License 2.0 6 votes vote down vote up
/**
 * value change listener for landingpage type
 * 
 * @param event
 */
public void landingpageTypeChanged(ValueChangeEvent event) {
    String marketplaceId = model.getSelectedMarketplace();
    String selectedLandingpageType = (String) event.getNewValue();
    try {
        if (!LandingpageType.contains(selectedLandingpageType)) {
            model.setLandingpageType(""); // nothing selected
        } else if (LandingpageType.isDefault(selectedLandingpageType)) {
            Response r = getLandingpageService()
                    .loadPublicLandingpageConfig(marketplaceId);
            switchtToPublicLandingpage(r);
        } else {
            switchToEnterpriseLandingpage();
        }
    } catch (SaaSApplicationException e) {
        ui.handleException(e);
    }
}
 
Example #6
Source File: PartnerServiceViewCtrlTest.java    From development with Apache License 2.0 6 votes vote down vote up
@Test
public void serviceChanged_Error() throws Exception {
    // given
    ctrl.initializePartnerServiceView();
    ctrl.partnerServices = mock(PartnerService.class);
    doThrow(new ServiceStateException()).when(ctrl.partnerServices)
            .getServiceDetails(3L);

    // when
    ctrl.serviceChanged(new ValueChangeEvent(new UIComponentStub(null),
            null, Long.valueOf(3)));

    // then
    assertEquals(0L, ctrl.getModel().getSelectedServiceKey());
    assertEquals(0L, ctrl.getModel().getPartnerServiceDetails()
            .getServiceKey());
    List<RoleSpecificPrice> rolePrices = ctrl.getModel().getRolePrices();
    assertEquals(new ArrayList<RoleSpecificPrice>(), rolePrices);
}
 
Example #7
Source File: PartnerServiceViewCtrl.java    From development with Apache License 2.0 6 votes vote down vote up
public void serviceChanged(ValueChangeEvent event) {
    long selectedServiceKey = ((Long) event.getNewValue()).longValue();
    if (selectedServiceKey != model.getSelectedServiceKey()) {
        POPartnerServiceDetails service = new POPartnerServiceDetails();
        boolean isError = false;
        if (selectedServiceKey > 0) {
            try {
                Response response = getPartnerService()
                        .getServiceDetails(selectedServiceKey);
                service = response.getResult(POPartnerServiceDetails.class);
            } catch (SaaSApplicationException e) {
                ui.handleException(e);
                isError = true;
                selectedServiceKey = 0L;
            }
        }
        model.setSelectedServiceKey(selectedServiceKey);
        model.setPartnerServiceDetails(service);
        model.setDisabled(isDisabled());
        model.setRolePrices(new ArrayList<RoleSpecificPrice>());
        initializePriceModel();
        if (isError) {
            initializeServices();
        }
    }
}
 
Example #8
Source File: ExportAuditLogDataCtrlTest.java    From development with Apache License 2.0 6 votes vote down vote up
@Test
public void processValueChange_SelectAll() {
    // given
    availableOperations.clear();
    operationGroups.clear();
    givenGroupedOperations();
    model.setSelectedGroup(null);
    model.setOperationGroups(operationGroups);
    model.setOperations(availableOperations);
    ValueChangeEvent mockedEvent = mock(ValueChangeEvent.class);
    doReturn(OPERATIONS_ALL).when(mockedEvent).getNewValue();

    // when
    ctrl.processValueChange(mockedEvent);

    // then
    assertEquals(16, model.getAvailableOperations().size());
}
 
Example #9
Source File: ManageOperatorRevenueShareCtrlTest.java    From development with Apache License 2.0 6 votes vote down vote up
@Test
public void templateChanged_toSameValue() {
    // given
    ValueChangeEvent event = new ValueChangeEvent(mock(UIComponent.class),
            Long.valueOf(101L), Long.valueOf(101L));
    ManageOperatorRevenueShareModel model = new ManageOperatorRevenueShareModel();
    model.setSelectedTemplateKey(101L);
    ctrl.setModel(spy(model));

    // when
    ctrl.templateChanged(event);

    // then
    assertEquals(101L, ctrl.getModel().getSelectedTemplateKey());
    verify(ctrl.getModel(), times(0)).setSelectedTemplateKey(eq(101L));
}
 
Example #10
Source File: TranslationBean.java    From development with Apache License 2.0 6 votes vote down vote up
/**
 * This methods is used as a callback for value-changed-event of the select
 * marketplace facelet.
 */
public void processValueChange(ValueChangeEvent event)
        throws AbortProcessingException {
	
	String selectedMarketplaceId = (String) event.getNewValue();
	
	if (selectedMarketplaceId.equals("0")) {
		marketplaceBean.setMarketplaceId(null);
	} else{
		marketplaceBean.setMarketplaceId(selectedMarketplaceId);
	}
	
    resetMembers();
    resetStage();
    this.marketplaceBean.processValueChange(event);
}
 
Example #11
Source File: FavoriteColChoiceListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void processValueChange(ValueChangeEvent ae) throws AbortProcessingException
{
  log.debug("FavoriteColChoiceListener: valueChangeLISTENER.");
  ItemAuthorBean itemauthorbean = (ItemAuthorBean) ContextUtil.lookupBean("itemauthor");


  String selectedvalue= (String) ae.getNewValue();
  
  if ((selectedvalue!=null) && (!selectedvalue.equals("")) ){
  	ItemBean curritem = itemauthorbean.getCurrentItem();
  	if(curritem != null){
  		curritem.setCurrentFavorite(selectedvalue);
  		curritem.setColumnChoicesFromFavorite(selectedvalue);
  		curritem.setFavoriteName(selectedvalue);
  	}

  }
}
 
Example #12
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 #13
Source File: BrandBeanTest.java    From development with Apache License 2.0 5 votes vote down vote up
@Test
public void testProcessValueChange_ObjectNotFoundException()
        throws Exception {
    ValueChangeEvent eventMock = mock(ValueChangeEvent.class);
    doReturn("newMarketplaceId").when(eventMock).getNewValue();

    doThrow(new ObjectNotFoundException()).when(marketplaceServiceMock)
            .getBrandingUrl("newMarketplaceId");

    brandBean.processValueChange(eventMock);
    assertEquals(null, brandBean.getBrandingUrl());
    assertEquals(0, facesMessages.size());
}
 
Example #14
Source File: MarketableServicePublishCtrlTest.java    From development with Apache License 2.0 5 votes vote down vote up
@Test
public void marketplaceChanged_Error() {
    // given
    ms.getModel().setServiceDetails(new POServiceForPublish());
    returnError = true;

    // when
    ms.marketplaceChanged(
            new ValueChangeEvent(new UIComponentStub(null), null, "123"));

    // then
    assertEquals(0, ms.getModel().getCategorySelection().size());
    assertTrue(ms.ui.hasErrors());
}
 
Example #15
Source File: MarketableServicePublishCtrlTest.java    From development with Apache License 2.0 5 votes vote down vote up
@Test
public void marketplaceChanged() {
    // given
    ms.getModel().setServiceDetails(new POServiceForPublish());

    // when
    ms.marketplaceChanged(
            new ValueChangeEvent(new UIComponentStub(null), null, "123"));

    // then
    assertEquals(2, ms.getModel().getCategorySelection().size());
}
 
Example #16
Source File: ManageRevenueShareCtrlTest.java    From development with Apache License 2.0 5 votes vote down vote up
private ValueChangeEvent getMockValueChangeEventForTemplate(
        long selectedServiceKey) {
    ValueChangeEvent eventMock = mock(ValueChangeEvent.class);
    when(eventMock.getNewValue()).thenReturn(
            Long.valueOf(selectedServiceKey));
    return eventMock;
}
 
Example #17
Source File: PrivateMessagesTool.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void processPvtMsgParentFolderMove(ValueChangeEvent event)
{
  log.debug("processPvtMsgSettingsRevise()"); 
  if ((String)event.getNewValue() != null)
  {
    moveToNewTopic= (String)event.getNewValue();
  }
}
 
Example #18
Source File: ManageRevenueShareCtrlTest.java    From development with Apache License 2.0 5 votes vote down vote up
@Test
public void templateChanged_SameKey() {
    // given
    ValueChangeEvent eventMock = getMockValueChangeEventForTemplate(1);

    ManageRevenueShareModel model = new ManageRevenueShareModel();
    model.setSelectedTemplateKey(1);
    ctrl.setModel(model);

    // when
    ctrl.templateChanged(eventMock);

    // then
    assertEquals(1, model.getSelectedTemplateKey());
}
 
Example #19
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 #20
Source File: MyListener.java    From tutorials with MIT License 5 votes vote down vote up
@Override
public void processValueChange(ValueChangeEvent event) throws AbortProcessingException {
       if (event.getNewValue() != null) {
           LOG.log(Level.INFO, "\tNew Value:{0}", event.getNewValue());
       }

}
 
Example #21
Source File: SubscriptionUnitCtrlTest.java    From development with Apache License 2.0 5 votes vote down vote up
@Test
public void deassignUnit() {
    // given
    setUnitsList();
    ValueChangeEvent valueChangeEvent =
            initChangeSelectedUnitEvent(new Long(0));
    // when
    subscriptionUnitCtrl.changeSelectedUnit(valueChangeEvent);
    // then
    for (POUserGroup unit : subscriptionUnitModel.getUnits()) {
        assertEquals(Boolean.FALSE, Boolean.valueOf(unit.isUnitSelected()));
    }
}
 
Example #22
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 the meeting type selection by
 * user.
 *
 * @param vce a ValuechangeEvent object.
 * @return a outcome string.
 */
public String processSelectedType(ValueChangeEvent vce) {
    String newMeetingType = (String) vce.getNewValue();
    signupMeeting.setMeetingType(newMeetingType);
    if (!INDIVIDUAL.equals(newMeetingType)) {
        setUserDefinedTS(false);
    }

    return "";

}
 
Example #23
Source File: LanguageBean.java    From oxTrust with MIT License 5 votes vote down vote up
public void countryLocaleCodeChanged(ValueChangeEvent e) {
	String newLocaleValue = e.getNewValue().toString();
	for (Map.Entry<String, Object> entry : countries.entrySet()) {
		if (entry.getValue().toString().equals(newLocaleValue)) {
			FacesContext.getCurrentInstance().getViewRoot().setLocale((Locale) entry.getValue());
		}
	}
	homeAction.init();
}
 
Example #24
Source File: PriceModelBeanTest.java    From development with Apache License 2.0 5 votes vote down vote up
private ValueChangeEvent prepareForReloadPriceModel() {
    doNothing().when(bean).updatePriceModel();
    ValueChangeEvent event = mock(ValueChangeEvent.class);
    doReturn(new Long("11000")).when(event).getNewValue();
    bean.setServices(this.selectedServiceList);
    return event;
}
 
Example #25
Source File: TagUtil.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public static void setValueChangeListener(UIComponent component,
  String attributeValue)
{
  setMethodBinding(component, "valueChangeListener", attributeValue,
    new Class[]
    {
    ValueChangeEvent.class});
}
 
Example #26
Source File: ConverterBean.java    From sailfish-core with Apache License 2.0 5 votes vote down vote up
public void updateServicesNames(ValueChangeEvent event) {
    envServices.clear();
    if(event != null){
        environment = (String) event.getNewValue();
    }

    for (ServiceName serviceName : serviceNames) {
        if (serviceName.getEnvironment().equals(environment)) {
            envServices.add(serviceName.getServiceName());
        }
    }
}
 
Example #27
Source File: PassportProvidersAction.java    From oxTrust with MIT License 5 votes vote down vote up
public void handleRequiredOptions(ValueChangeEvent e) {
	String type = e.getNewValue().toString();
	if (!this.update && type != null) {
		if (type.equalsIgnoreCase(providerTypes[0])) {
			this.options = new ArrayList<>();
			this.options.add(new OptionEntry("entryPoint", "https://idp.example.com/idp/profile/SAML2/POST/SSO"));
			this.options.add(
					new OptionEntry("identifierFormat", "urn:oasis:names:tc:SAML:2.0:nameid-format:transient"));
			this.options.add(new OptionEntry("authnRequestBinding", "HTTP-POST"));
			this.options.add(new OptionEntry(ISSUER, DEFAULT_ISSUER));
			this.options.add(new OptionEntry("cert", ""));
		}
		if (type.equalsIgnoreCase(providerTypes[1])) {
			this.options = new ArrayList<>();
			this.options.add(new OptionEntry(CLIENT_ID, ""));
			this.options.add(new OptionEntry(CLIENT_SECRET, ""));
			this.options.add(new OptionEntry(ISSUER, "https://server.example.com"));
			this.options.add(new OptionEntry("authorizationURL", "https://server.example.com/authorize"));
			this.options.add(new OptionEntry("tokenURL", "https://server.example.com/token"));
			this.options.add(new OptionEntry("userInfoURL", "https://server.example.com/userinfo"));
			this.options.add(new OptionEntry("scope", "openid"));
		}
		if (type.equalsIgnoreCase(providerTypes[2])) {
			this.options = new ArrayList<>();
			this.options.add(new OptionEntry(CLIENT_ID, ""));
			this.options.add(new OptionEntry(CLIENT_SECRET, ""));
			this.options.add(new OptionEntry("oxdID", ""));
			this.options.add(new OptionEntry(ISSUER, "https://server.example.com"));
			this.options.add(new OptionEntry("oxdServer", "https://oxd-server.acme.com:8443"));
		}
		if (type.equalsIgnoreCase(providerTypes[3])) {
			this.options = new ArrayList<>();
			this.options.add(new OptionEntry(CLIENT_ID, ""));
			this.options.add(new OptionEntry(CLIENT_SECRET, ""));
		}
	}

}
 
Example #28
Source File: PrivateMessagesTool.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void processActionAddHiddenGroup(ValueChangeEvent event){
 String selectedGroup = (String) event.getNewValue();
 if(!DEFAULT_NON_HIDDEN_GROUP_ID.equals(selectedGroup) && !isGroupHidden(selectedGroup)){
  getHiddenGroups().add(new HiddenGroupImpl(selectedGroup));
  selectedNonHiddenGroup = DEFAULT_NON_HIDDEN_GROUP_ID;
 }
}
 
Example #29
Source File: PriceModelBeanTest.java    From development with Apache License 2.0 5 votes vote down vote up
@Test
public void reloadPriceModel_Null() throws Exception {
    // given
    ValueChangeEvent event = prepareForReloadPriceModel();
    doReturn(null).when(event).getNewValue();
    doNothing().when(externalCustomerPriceModelCtrl).reloadPriceModel(any(VOServiceDetails.class));
    // when
    bean.reloadPriceModel(event);

    // then
    assertNull(bean.getSelectedServiceKey());
    assertNull(sessionBean.getSelectedServiceKeyForSupplier());
}
 
Example #30
Source File: ManageSubscriptionCtrlTest.java    From development with Apache License 2.0 5 votes vote down vote up
@Test
public void selectedOwnerChanged() {
    // given
    setSubscriptionOwners(false, true);
    ValueChangeEvent event = initChangeOwnerEvent("owner1");
    // when
    ctrl.selectedOwnerChanged(event);

    // then
    checkSubscriptionOwner("owner1");
    assertEquals(Boolean.TRUE, Boolean.valueOf(ctrl.isOwnerSelected()));
}