當前位置: 首頁>>代碼示例>>Java>>正文


Java ValueChangeEvent.getComponent方法代碼示例

本文整理匯總了Java中javax.faces.event.ValueChangeEvent.getComponent方法的典型用法代碼示例。如果您正苦於以下問題:Java ValueChangeEvent.getComponent方法的具體用法?Java ValueChangeEvent.getComponent怎麽用?Java ValueChangeEvent.getComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.faces.event.ValueChangeEvent的用法示例。


在下文中一共展示了ValueChangeEvent.getComponent方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: changeSelectedUnit

import javax.faces.event.ValueChangeEvent; //導入方法依賴的package包/類
/**
 * This method is used to handle the value change event on radio buttons 
 * when using the 'Select unit for a subscription' popup.
 * @param event
 */
public void changeSelectedUnit(ValueChangeEvent event) {
    UIComponent uiComponent = event.getComponent();
    if (!(uiComponent instanceof HtmlSelectOneRadio)) {
        return;
    }
    HtmlSelectOneRadio radioBtn = (HtmlSelectOneRadio) uiComponent;
    List<UIComponent> uiComponents = radioBtn.getChildren();
    for (UIComponent component : uiComponents) {
        if (!(component instanceof HtmlInputHidden)) {
            continue;
        }
        HtmlInputHidden hiddenInput = (HtmlInputHidden) component;
        long unitId = ((Long) hiddenInput.getValue()).longValue();
        if (unitId == 0L) { //radio 'The subscription is not assigned...' is selected
            deassignUnit();
            return;
        }
        if (Boolean.valueOf((String) event.getNewValue()).booleanValue()) {
            assignToSelectedUnit(unitId);
            return;
        }
        for (POUserGroup unit : model.getUnits()) {
            if (unit.getKey() == unitId) {
                unit.setUnitSelected(false);
                unit.setUnitChecked(null);
            }
        }

    }
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:36,代碼來源:SubscriptionUnitCtrl.java

示例2: selectedOwnerChanged

import javax.faces.event.ValueChangeEvent; //導入方法依賴的package包/類
/**
 * Invoke when click radio button to select subscription owner in
 * subscription owner selection page
 */
public void selectedOwnerChanged(ValueChangeEvent event) {

    UIComponent uiComponent = event.getComponent();
    if (!(uiComponent instanceof HtmlSelectOneRadio)) {
        return;
    }

    HtmlSelectOneRadio radioBtn = (HtmlSelectOneRadio) uiComponent;
    List<UIComponent> uiComponents = radioBtn.getChildren();

    for (UIComponent component : uiComponents) {

        if (!(component instanceof HtmlInputHidden)) {
            continue;
        }

        HtmlInputHidden hiddenInput = (HtmlInputHidden) component;
        String ownerId = (String) hiddenInput.getValue();
        if (Boolean.valueOf((String) event.getNewValue()).booleanValue()) {
            if (ownerId.trim().isEmpty()) {
                deassignOwner();
                return;
            }
            setOwnerSelectedStatus(ownerId);
            return;
        }
        for (User owner : model.getSubscriptionOwners()) {
            if (owner.getUserId().equals(ownerId)) {
                owner.setOwnerSelected(false);
            }
        }
    }
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:38,代碼來源:ManageSubscriptionCtrl.java

示例3: valueChanged

import javax.faces.event.ValueChangeEvent; //導入方法依賴的package包/類
public void valueChanged(ValueChangeEvent vce)
{
  Object newValue = vce.getNewValue();
  UIComponent component = vce.getComponent();

  String rendererType = component.getRendererType();

  // For these first components the listeners have registered themselves
  // by setting the partialTriggers attribute. So we just update the model.
  if (rendererType.equals("org.apache.myfaces.trinidad.Checkbox"))
  {
    _status.setChecked((Boolean) newValue);
    _status.incrementCheckBoxUpdateCount();
  }
  else if (rendererType.equals("org.apache.myfaces.trinidad.Radio"))
  {
    if (Boolean.TRUE.equals(newValue))
    {
      String text = (String) component.getAttributes().get("text");
      _status.setSelectBooleanState(text);
    }
    else if (newValue instanceof String)
      _status.setSelectOneState((String) newValue);
  }
  else if (rendererType.equals("org.apache.myfaces.trinidad.Text"))
  {
    if (newValue instanceof String)
      _status.setTextValue((String) newValue);
  }
  else if (rendererType.equals("org.apache.myfaces.trinidad.Choice"))
  {
    if (newValue instanceof String)
      _status.setChoiceInt((String) newValue);
  }

  // This component illustrates a method of dynamically adding a
  // partialTarget (i.e. without setting the partialTriggers attribute). It
  // updates a component binding and adds the updated component directly to
  // the list of partial targets.
  else if (rendererType.equals("org.apache.myfaces.trinidad.Listbox"))
  {
    _listUpdate.setValue(component.getAttributes().get("value"));
    _addTarget(_listUpdate);
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:46,代碼來源:PartialDemoUtilBean.java

示例4: processFileUpload

import javax.faces.event.ValueChangeEvent; //導入方法依賴的package包/類
/**
	 * 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 = Validator.getFileName(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);

		}

	}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:53,代碼來源:podHomeBean.java


注:本文中的javax.faces.event.ValueChangeEvent.getComponent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。