Announcement

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

    Error: Too much recursion

    I am trying to create a window that includes around 100 - 5,000 "cells" of various colors. All cells are the same size (30,30), have a different background color, and an integer centered in the cell.

    I first tried to build the cells by including a Label in a Layout and assigning a background color to the Layout. But this rendered too slowly for 200 cells (15 seconds)

    I then switched to building the cells with just an HTMLPane with a specified background color. This noticably sped up the rendering in FireFox to around 2.5 seconds for 200 cells (although it didn't speed up IE). One issue with this is that I can't figure out how to center the text vertically in the HTMLPane.

    When I tried to stress test this window with 5,000 cells it fails with the following javascript error:

    Code:
    Uncaught exception escaped : com.google.gwt.core.client.JavaScriptException
    (InternalError): too much recursion
     fileName: .../sc/modules/ISC_Core.js
     lineNumber: 2772
    Is there a lighter weight method to drawing these cells?
    Smart GWT 2.1, Firefox, Internet Explorer

    Thanks
    Last edited by rkumsher; 20 Oct 2010, 03:28.

    #2
    Stand alone test case:

    Code:
    	public void onModuleLoad() {
    		IButton startButton = new IButton("Start");
    		startButton.addClickHandler(new ClickHandler() {
    			
    			@Override
    			public void onClick(ClickEvent event) {
    				drawWindow();		
    			}
    		});
    		startButton.draw();
    	}
    	private void drawWindow()
    	{
    		Window window = new Window();
    		window.setMembersMargin(5);
    		window.setHeight100();
    		window.setWidth100();
    		window.setShowMinimizeButton(false);
    		window.setCanDragReposition(false);
    		
    		VLayout vLayout = new VLayout(5);
    		for (int i=1; i<=320; i++)
    		{
    			HLayout rowLayout = new HLayout(2);
    			rowLayout.setAutoHeight();
    			for (int j=1; j<=15; j++)
    			{
    				HTMLPane cell = new HTMLPane();
    				cell.setContents("" + (j*i));
    				cell.setWidth(30);
    				cell.setHeight(30);
    				cell.setBackgroundColor("red");
    				rowLayout.addMember(cell);
    			}
    			vLayout.addMember(rowLayout);
    		}
    		window.addItem(vLayout);
    		window.show();
    		//vLayout.draw();
    	}
    This results in the "Too much recursion" error. Although switching from window.show() to vLayout.draw() will atleast draw the cells, just not in a window.

    Comment


      #3
      You can just use 1 HTMLPane and put a regular old html table in it.

      Comment

      Working...
      X