Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • jan.swaelens
    replied
    Thanks, works like a charm.

    Leave a comment:


  • Isomorphic
    replied
    This was applied to 4.0 as well, was previously just 4.1. You should see it tonight in the 4.0 release.

    Leave a comment:


  • ex70375
    replied
    same result with Isomorphic SmartClient/SmartGWT Framework (v9.0p_2013-10-05/PowerEdition Deployment 2013-10-05)

    :-(

    Leave a comment:


  • ex70375
    replied
    the problem is still exists.

    i used: Isomorphic SmartClient/SmartGWT Framework (v9.0p_2013-10-04/PowerEdition Deployment 2013-10-04

    maybe tomorrow? 2013-10-05?

    Leave a comment:


  • Isomorphic
    replied
    You should see a fix for this in tonight's nightly build.

    Leave a comment:


  • ex70375
    replied
    any news on this bug?

    Leave a comment:


  • jan.swaelens
    replied
    For your information, this is how we fixed it:

    Code:
    	public void showErrors() {
    		// Find forms (vm.getMembers() call gives us classcast error as it does not check on ListGrids
    		DynamicForm[] forms = null;
    		{
    			// START HACK
    			forms = getAllForms(this, true);
    			// END HACK
    		}
    		
        	for(DynamicForm dynamicForm : forms) {
        		dynamicForm.showErrors();
        	}
        }
    and

    Code:
    	public static DynamicForm[] getAllForms(ValuesManager vm, boolean skipValidationErrors) {
    		
    		JavaScriptObject nativeArray = vm.getAttributeAsJavaScriptObject("members");
    		if (nativeArray == null) {
    			return new DynamicForm[0];
    		
    		} else {
    			
    			ArrayList<DynamicForm> forms = new ArrayList<DynamicForm>();
    		    JavaScriptObject[] componentsj = JSOHelper.toArray(nativeArray);		    
    		    for (int i = 0; i < componentsj.length; i++) {
    		        
    		        try {
    		        	
    					DynamicForm obj = getOrCreateRefCustom(componentsj[i]);
    					if(obj instanceof DynamicForm) {						
    						
    						forms.add((DynamicForm)form);
    					}
    
    				} catch (ClassCastException e) {
    					Logger.error("Failed to cast to form", e);
    				}
    		    }
    		    return forms.toArray(new DynamicForm[forms.size()]);
    		}
    	}
    This works but it doesn't feel that performant...

    Leave a comment:


  • ex70375
    replied
    hi,

    i get the same error.
    Below is an executable code for your example buildinds.


    Code:
    22:36:42.326 [ERROR] [builtinds] Uncaught exception escaped
    java.lang.ClassCastException: com.smartgwt.client.widgets.layout.VLayout cannot be cast to com.smartgwt.client.widgets.form.DynamicForm
        at com.smartgwt.client.util.ConvertTo.arrayOfDynamicForm(ConvertTo.java:7696)
        at com.smartgwt.client.widgets.form.ValuesManager.getMembers(ValuesManager.java:1101)
        at com.smartgwt.client.widgets.form.ValuesManager.showErrors(ValuesManager.java:812)
    Code:
    final ValuesManager valuesManager = new ValuesManager();
    final DynamicForm dynamicForm = new DynamicForm();
    
    
    VLayout vLayout = new VLayout();
    vLayout.setValuesManager(valuesManager);
    
    
    IntegerItem textItemNumber = new IntegerItem("number", "Number");
    TextItem textItemName = new TextItem("name", "Name");
    TextItem textItemReason = new TextItem("reason", "Reason");
    ButtonItem buttonItem = new ButtonItem("check", "check");
    
    buttonItem.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
    
    	@Override
    	public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
    		valuesManager.validate();
    
    	}
    });
    
    dynamicForm.setFields(textItemNumber, textItemName, textItemReason, buttonItem);
    valuesManager.addMember(dynamicForm);
    
    
    
    RequiredIfValidator ifValidator = new RequiredIfValidator();
    ifValidator.setExpression(new RequiredIfFunction() {
    	@Override
    	public boolean execute(FormItem formItem, Object value) {
    
    		if (formItem.getForm() == null) {
    			return false;
    		}
    
    		if ((formItem.getForm().getField("number").getValue() != null) || 
    				(formItem.getForm().getField("name").getValue() != null)) {
    			return true;
    		} else {
    			return false;
    		}
    	}
    });
    
    ifValidator.setErrorMessage("Please provide a Number or Name");
    dynamicForm.getField("reason").setValidators(ifValidator);
    
    vLayout.addMember(dynamicForm);
    vStack.addMember(vLayout);
    i used: Isomorphic SmartClient/SmartGWT Framework (v9.0p_2013-09-25/PowerEdition Deployment 2013-09-25)

    Leave a comment:


  • jan.swaelens
    replied
    Hi,

    I was just testing the latest build (v9.0p_2013-09-30/Pro Deployment (built 2013-09-30) and hit this error again, this is the full trace (starting from our code):

    Code:
    com.smartgwt.client.util.ConvertTo.arrayOfDynamicForm(ConvertTo.java:7696)
    com.smartgwt.client.widgets.form.ValuesManager.getMembers(ValuesManager.java:1102)
    com.smartgwt.client.widgets.form.ValuesManager.showErrors(ValuesManager.java:813)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
    com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
    com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
    com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
    com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242)
    sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
    com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
    com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
    com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:299)
    com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
    com.smartgwt.client.widgets.form.ValuesManager.clearErrors(ValuesManager.java)
    Looking at the values manager code I can't see any change to the code which leads to the error. Was the fix not included?

    thanks!

    Leave a comment:


  • Isomorphic
    replied
    You are correct, changes were made, but what we still don't have is a demonstration of how this failed for you. Can you please send the code that worked previously and now does not, along with a full stack trace of the failure.

    Thank you

    Leave a comment:


  • jan.swaelens
    replied
    Can we have an ETA on this fix please, or would you advise to keep a local fix for this on our end. Thanks.

    Leave a comment:


  • jan.swaelens
    replied
    Hello,

    Well I compared the two versions and it seems that the logic is quote different:

    Working version of com.smartgwt.client.widgets.form.ValuesManager.showErrors():

    Code:
        public native void showErrors() /*-{
            var self = this.@com.smartgwt.client.core.BaseClass::getOrCreateJsObj()();
            self.showErrors();
        }-*/;
    No longer working version:

    Code:
        public void showErrors() {
        	for(DynamicForm dynamicForm : getMembers()) {
        		dynamicForm.showErrors();
        	}
        }
    The new version will clearly give a classcast error because not all members are forms.

    Hope this helps.

    Leave a comment:


  • Isomorphic
    replied
    We have done some initial checking on our side and nothing has been changed recently. Could you please send the code that worked previously and now does not, along with a full stack trace.

    Thanks

    Leave a comment:


  • Isomorphic
    replied
    We're taking a look at this. We'll follow up when we have more information

    Thanks
    Isomorphic Software

    Leave a comment:


  • jan.swaelens
    started a topic ClassCast error on ValuesManager.showErrors

    ClassCast error on ValuesManager.showErrors

    Hi,

    We are upgrading from v9.0p_2013-07-17/Pro Deployment to v9.0p_2013-09-02/Pro Deployment 2013-09-02 and are hitting a classcast exception after using the new version.

    Code:
    com.smartgwt.client.util.ConvertTo.arrayOfDynamicForm(ConvertTo.java:7643)
    com.smartgwt.client.widgets.form.ValuesManager.getMembers(ValuesManager.java:1101)
    com.smartgwt.client.widgets.form.ValuesManager.showErrors(ValuesManager.java:812)
    Not all members of the ValuesManager are forms, there are also ListGrids. The showErrors method should cope with this (we had similar issues in the past).

    thanks for looking into this.
Working...
X