Announcement

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

    No enum const class

    Hi,

    I'm trying out the nightly 3.1d of 30/05/2012, and tried a few times resetting cache and my workspace, but I get these errors which seem to block everything:

    Code:
    java.lang.IllegalArgumentException: No enum const class com.smartgwt.client.util.ObjectFactory$CanvasType.DropShadow
    	at java.lang.Enum.valueOf(Enum.java:196)
    	at com.smartgwt.client.util.ObjectFactory$CanvasType.valueOf(ObjectFactory.java:1)
    	at com.smartgwt.client.util.ObjectFactory.createCanvas(ObjectFactory.java:22)
    	at com.smartgwt.client.widgets.Canvas.convertToCanvasArray(Canvas.java:8057)
    	at com.smartgwt.client.widgets.Canvas.getChildren(Canvas.java:8035)
    	
    java.lang.IllegalArgumentException: No enum const class com.smartgwt.client.util.ObjectFactory$CanvasType.TabBar
    	at java.lang.Enum.valueOf(Enum.java:196)
    	at com.smartgwt.client.util.ObjectFactory$CanvasType.valueOf(ObjectFactory.java:1)
    	at com.smartgwt.client.util.ObjectFactory.createCanvas(ObjectFactory.java:22)
    	at com.smartgwt.client.widgets.Canvas.convertToCanvasArray(Canvas.java:8057)
    	at com.smartgwt.client.widgets.Canvas.getChildren(Canvas.java:8035)

    GWT 2.4 devmode
    FireFox 4.0.1

    #2
    Thanks for reporting this - looks like an unintended consequence of some changes to make Canvas.getById() and Canvas.getChildren() return correct types for components that are indirectly created (like the Window "header" subcomponent).

    Should be fixed in tomorrow's builds.

    Comment


      #3
      Ok thanks, I got over the error from previous message with build 2012/06/03.

      Now I get this error if you don't mind posting in this topic.

      I believe it's the case where button.getMenu() should return null (as expected by my application), but this call gives an error with the build (was OK with build 2012/02/02).

      Code:
      Caught error [-2147483648]:(TypeError): elem is null
      com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:248)
      com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
      com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
      com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
      com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
      com.smartgwt.client.util.JSOHelper.getAttribute(JSOHelper.java)
      com.smartgwt.client.widgets.menu.Menu.setJavaScriptObject(Menu.java:110)
      com.smartgwt.client.widgets.menu.Menu.<init>(Menu.java:119)
      com.smartgwt.client.widgets.menu.Menu.getOrCreateRef(Menu.java:105)
      com.smartgwt.client.widgets.menu.IconMenuButton.getMenu(IconMenuButton.java:152)
      Repro:
      Code:
      		final IconMenuButton choose1 = new IconMenuButton("One");
      		choose1.setID("myButton1");
      		choose1.addClickHandler(new ClickHandler() {
      			
      			public void onClick(ClickEvent event) {
      				if (choose1.getMenu() == null) {
      					//Lazy load this menu
      					
      					Menu menu1 = new Menu();
      					menu1.setID("myMenu1");
      					menu1.setShowShadow(false);
      					MenuItem item11 = new MenuItem("something");
      					menu1.setItems(item11);
      					
      					choose1.setMenu(menu1);
      				}
      				
      				choose1.showMenu();
      			}
      		});
      Last edited by levi; 3 Jun 2012, 05:23.

      Comment


        #4
        Hi,
        is the previous problem checked as being a bug?

        thanks

        Comment


          #5
          Sorry for the lack of update - this should be fixed as well, please confirm.

          Comment


            #6
            Thanks, verified in SNAPSHOT_v8.3d_2012-06-12/Pro Deployment (built 2012-06-12) and the getMenu bug is fixed. OK.


            There are some other problems related to the canEdit flag changes, but I need to examine them a bit more what's causing the problem exactly.

            Also some API changes
            * ListGrid#startEditing(int, int, boolean): Integer instead of int now.
            * The OnSectionHeaderClickHandler events which I needed to change into event.getSection().getSection(), which looks strange, but I get it :)

            Comment


              #7
              1) on the canEdit stuff: I don't know why it's different to our previous build, but it sounded that getting this boolean from the DataClass was going differently. I think when the boolean wasn't set, it returned true, and maybe now this got changed that it returned false? Anyway, fixed in our own app: if the attribute is null, we see it as meaning "canEdit == true".

              2) Here is a repro related to the startEditing API changes.
              Retested on SNAPSHOT_v8.3d_2012-06-23/Pro Deployment (built 2012-06-23)

              error:
              invoke arguments: JS value of type Java Object
              com.google.gwt.dev.shell.JsValueOOPHM$DispatchObjectOOPHM, expected int

              double click on a record in the grid:
              Code:
              private class MyListGrid extends ListGrid {
              	
              	public MyListGrid() {
              		setCanEdit(true);
              		setEditEvent(ListGridEditEvent.NONE);
              		addCellDoubleClickHandler(new CellDoubleClickHandler() {
              
              			public void onCellDoubleClick(CellDoubleClickEvent event) {
              				//do some checks if we can edit this row here
              				
              				
              				//... if ok, start editing for real
              				int colNum = event.getColNum();
              				int rowNum = event.getRowNum();
              				if (colNum < 0) {
              					startEditing(rowNum);
              				} else {
              					startEditing(rowNum, colNum, false);
              				}
              			}
              		});
              	}
              	
              	@Override
              	public Boolean startEditing(Integer rowNum, Integer colNum, Boolean suppressFocus) {
              		//API got changed from ints to Integer, but that seems to throw a JS error down the line
              		Boolean startEditing = super.startEditing(rowNum, colNum, suppressFocus);
              		return startEditing;
              	}
              
              	//method not exposed in SmartGWT, but handy to set a row in edit mode from code
              	public native Boolean startEditing(int rowNum) /*-{
              	    var self = this.@com.smartgwt.client.widgets.BaseWidget::getOrCreateJsObj()();
              	    var retVal = self.startEditing(rowNum, 0, false);
              	    if(retVal == null || retVal === undefined) {
              	        return null;
              	    } else {
              	    	return @com.smartgwt.client.util.JSOHelper::toBoolean(Z)(retVal);
              	    }
              	}-*/;
              }
              
              public Canvas getViewPanel() {
              	
              	MyListGrid grid = new MyListGrid();
              	
              	String fieldName1 = "a";
              	String fieldName2 = "b";
              	ListGridField field1 = new ListGridField(fieldName1);
              	ListGridField field2 = new ListGridField(fieldName2);
              	grid.setFields(field1, field2);
              
              	ListGridRecord [] records = new ListGridRecord[100];
              	for (int i=0; i<records.length; i++) {
              		records[i] = new ListGridRecord();
              		records[i].setAttribute(fieldName1, "aha" + i);
              		records[i].setAttribute(fieldName2, "oho" + i);
              	}
              
              	grid.setRecords(records);
              	
              	VLayout layout = new VLayout();
              	layout.setWidth100();
              	layout.setMembers(grid);
              	return layout;
              }

              Comment


                #8
                Hi,
                any progress on this JS error in the startEditing call?

                I'm hoping this one is the last blocker to try out a newer nightly build (since Feb 2012) to work with our app.

                thanks,

                Comment


                  #9
                  I quickly tried SNAPSHOT_v8.3d_2012-07-03/Pro Deployment (built 2012-07-03) and the previous one seems to be fixed.

                  thanks

                  Comment

                  Working...
                  X