[richfaces-issues] [JBoss JIRA] Reopened: (RF-1289) Getting A4J Undefined though My renderer is properly adding support as child to the component.

Karthik M (JIRA) jira-events at lists.jboss.org
Mon Nov 12 04:11:44 EST 2007


     [ http://jira.jboss.com/jira/browse/RF-1289?page=all ]

Karthik M reopened RF-1289:
---------------------------

             
actually i meant programatically creating child text box components and adding to the parent component (panel)..

see below code

//Delegate from my parent renderer code
private void createAjaxTextBoxComponent(FacesContext context, UIPanel dynamicControlPanel, 
	         Object entity, DynamicControlMetaData contrlMeta, UIDynamicControl dynCtrl)
	   {
	      if(willLogDebug)
	      {
	         IPSLogger.logDebug(CLASS_NAME + "createAjaxTextBoxComponent-start");
	      }

	      UIComponent inputComp;
	      UIComponent outPutTextComp;
	      outPutTextComp = getLocalInstance().createOutputText(
	         contrlMeta.getControlLabel(), context);
	      dynamicControlPanel.getChildren().add(outPutTextComp); 

	         if(contrlMeta.getRequired().equalsIgnoreCase(TRUE))
	      {
	         dynamicControlPanel.getChildren().add(new HtmlBlock(REQD_BLOCK_STRING));
	      }
	      
	      //TODO This will need to change to support left-oriented labels.
	      addHtmlBreak(dynamicControlPanel); 
	     // dynamicControlPanel.getChildren().add(addHtmlSpaces(2)); 

	      String value = "";

	      if(null != entity)
	      {
	         Class entityClass = entity.getClass();
	         value = getControlValuesFromModel(entity, entityClass, contrlMeta);
	      }
	      
	      if(willLogDebug)
	      {
	         IPSLogger.logDebug(CLASS_NAME + "createAjaxTextBoxComponent-value" + value);
	      }

	   	      boolean disableComp = _disabled || contrlMeta.getDisabled().equalsIgnoreCase(TRUE);
	      
//	      inputComp = getLocalInstance().createAjaxInputTextLimitSize(value,
//	         contrlMeta.getControlId()+dynamicId, context, disableComp,contrlMeta.getEvent(),contrlMeta.getAction(),contrlMeta.getOnComplete(),contrlMeta.getReRender(),contrlMeta.getAjaxSupportItem());
	      
	      inputComp = getLocalInstance().createAjaxInputTextLimitSize(value,
	 	         dynamicId, context, disableComp,contrlMeta.getEvent(),contrlMeta.getAction(),contrlMeta.getOnComplete(),contrlMeta.getReRender(),contrlMeta.getAjaxSupportItem());
	 	      
	      
	      //R205 / CR 1414
	      applyJSEvents(dynCtrl, inputComp);

	      dynamicControlPanel.getChildren().add(inputComp);
	      dynamicControlPanel.getChildren().add(addHtmlSpaces(3)); //TODO Make this configurable

	      if(willLogDebug)
	      {
	         IPSLogger.logDebug(CLASS_NAME + "createAjaxTextBoxComponent-end");
	      }
	   }

//Create input text as follows


public UIComponent createAjaxInputTextLimitSize(String value, String id,
			FacesContext context, boolean isDisabled, String event,
			String action, String onComplete, String reRender,
			List ajaxSupportItem)
	  {
		  UIAjaxInputText input = (UIAjaxInputText) context.getApplication().createComponent("ips.component.AjaxInputText");
	      input.setId(id);
	      
	      ValueBinding vb = context.getApplication().createValueBinding("#{ajaxInputBean.textValue}");
	      input.setValueBinding("value",vb);
	      input.setEvent(event);
	      input.setAction(action);
	      input.setOnComplete(onComplete);
	      input.setReRender(reRender);
	      input.setAjaxSupportItem(ajaxSupportItem);
	      
	       
	     if(isDisabled)
	     {
	        input.setOnfocus("this.blur();");
	        input
	           .setStyle("border-style: solid; border-color:darkgray; color:darkgray; padding: .1em; margin: .1em; border-width: 1px; text-align: left;");
	     }
	     return input;
	
	  }

//finally when renderer code is called on my parent it triggers renderer of underling text box..

Note: The text box created here (my custom text box extends JSF tag) programatically adds support on itself..as sown below 

if (inputText.getAction() != null
				&& inputText.getEvent() != null) {
			org.ajax4jsf.ajax.UIAjaxSupport support = null;
			if (inputText.getAjaxSupportId() == null) {
				support = (org.ajax4jsf.ajax.UIAjaxSupport) context
						.getApplication().createComponent(
								"org.ajax4jsf.ajax.Support");
			} else {
				inputText.getChildren().remove(0);
				support = (org.ajax4jsf.ajax.UIAjaxSupport) context
						.getApplication().createComponent(
								"org.ajax4jsf.ajax.Support");
			}
			support.setId(inputText.getId() + "inputTextSupport");
			MethodBinding mb = context.getApplication().createMethodBinding(
					inputText.getAction(), null);
			support.setAction(mb);
			support.setEvent(inputText.getEvent());
			support.setReRender(inputText.getReRender());
			support.setOncomplete(inputText.getOnComplete());
			inputText.getChildren().add(support);
			inputText.setAjaxSupportId(support.getClientId(context));
			
		}
		super.encodeEnd(context, inputText);

Please suggest why this is not working..


> Getting A4J Undefined though My renderer is properly adding support as child to the component.
> ----------------------------------------------------------------------------------------------
>
>                 Key: RF-1289
>                 URL: http://jira.jboss.com/jira/browse/RF-1289
>             Project: RichFaces
>          Issue Type: Bug
>    Affects Versions: 3.2.0
>         Environment: Windows , Tomcat , Java 1.5, ajax4jsf1.1.0 , oscacche2.3.2
>            Reporter: Karthik M
>         Assigned To: Nick Belaevski
>             Fix For: 3.2.0
>
>         Attachments: ajax4jsf Help.zip
>
>   Original Estimate: 4 days
>  Remaining Estimate: 4 days
>
> To replicate this behaviour follow these steps:
> 1) create a custom component and its rendrerer.
> 2) In this parent renderere code try to create 2 child components to this parent component programatically (say 2 input texts..).
> 3) Each of this individual child components has to be ajax aware. So we add support objects to it with neccessary metadata.
> 4) in the xhtml try to verfy whether all the components are rendrered correctly and whether their defined events fire AJAX call.
> There is a thread on this forum where i have staed ths problem...URL is attached..
> I have already set code to sergeysmirnov at dev.java.net with subject Query on ajax4jsf.
> I have noted that till the last line of my renderer code all flow is correct..only whne HTML is generated it has no AJAX script declaration or support objects...but the A4J submit function exists...
> I have tried with several beta as well as stable versions but it did not work.
> Please help with this issue..kindly suggest any ideas to make this work..

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the richfaces-issues mailing list