Announcement

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

    CanvasItem contents missing in print preview

    Hello,

    Please review the test case below. Click the button to see the Label ci2Label missing from the print preview.

    Code:
    package test3.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.widgets.Canvas;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.Label;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.fields.CanvasItem;
    import com.smartgwt.client.widgets.layout.HLayout;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class Test3 implements EntryPoint {
    	public void onModuleLoad() {
    		VLayout mainLayout = new VLayout();
    		mainLayout.setWidth100();
    		
    		Label ciLabel = new Label("This is shown OK.");
    		CanvasItem ci = new CanvasItem("ci","CanvasItem1");
    		ci.setCanvas(ciLabel);
    		
    		Label ci2Label = new Label("This is missing. Why?");
    		HLayout ci2Layout = new HLayout();
    		ci2Layout.setWidth(200);
    		ci2Layout.addMember(ci2Label);
    		CanvasItem ci2 = new CanvasItem("ci2","CanvasItem2");
    		ci2.setCanvas(ci2Layout);
    		
    		final DynamicForm form = new DynamicForm();
    		form.setCellBorder(1);
    		form.setItems(ci, ci2);
    		
    		IButton printButton = new IButton("Print Preview", new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				Canvas.showPrintPreview(form);
    			}
    		});
    		
    		mainLayout.setMembers(form, printButton);
    		mainLayout.draw();
    	}
    }
    Tested in:
    SmartGWT 3.0p; SmartGWT 2.5
    GWT 2.4
    Firefox 8.0.1; Internet Explorer 9 64-bit
    Windows 7 64-bit

    Developer Console output:
    Code:
    12:59:08.529:INFO:Log:initialized
    12:59:08.538:WARN:Log:NOTE: Firebug is enabled. Firebug greatly slows the performance of applications that make heavy use of JavaScript. Isomorphic highly recommends Firebug for troubleshooting, but Firebug and other development tools should be disabled when assessing the real-world performance of SmartClient applications.
    12:59:09.096:WARN:Log:New Class ID: 'EditPane' collides with ID of existing Class object '[DataSource ID:EditPane]'.  Existing object will be replaced.
    This conflict would be avoided by disabling ISC Simple Names mode.  See documentation for further information.
    12:59:11.965:INFO:Log:isc.Page is loaded

    #2
    Version: SmartGWT 3.0p; SmartGWT 2.5
    Firefox 8.0.1; Internet Explorer 9 64-bit
    Windows 7 64-bit

    I'm having the same issue. It would be nice to get a fix.

    Comment


      #3
      To further dig into the problem, it seems like the contents of a CanvasItem only disappear, if they are wrapped by a Canvas, HLayout or VLayout.

      Workaround: Putting a Label, or even a ListGrid directly into a CanvasItem resolves the issue. However, this makes CanvasItems a lot less flexible (as you can't use a layout).

      The bug might be in Canvas.getPrintHTML(), but since it is a JavaScript method that has been shrunk and obfuscated, it is not exactly obvious how one can debug it. Overriding it from Java does not seem to be the right solution (not sure how to handle callbacks; it may not even be possible in Java).

      Would you kindly give us some pointers on this, Isomorphic?

      Here is what I've been attempting, but it returns null when it encounters a layout:

      Code:
      VLayout labelContainer = new VLayout() {
      					@Override
      					public String getPrintHTML(PrintProperties printProperties,
      							PrintHTMLCallback callback) {
      						String result = "";
      						
      						for (Canvas member : getMembers()) {
      							result += member.getPrintHTML(printProperties, callback);
      						}
      						
      						return result;
      					}
      				};

      Comment


        #4
        I just encountered this issue, and it is a significant issue for us as we are missing content when printing.

        I have CanvasItem with its Canvas layout set to an HLayout. The HLayout contains a Label and then an Img.

        Has this been fixed? Please advise.

        My version of SmartGWT is:

        v8.3p_2013-06-21/Enterprise Deployment (built 2013-06-21)

        Thanks,
        Chris

        Comment


          #5
          We see the problem and are looking into it. We'll follow up when we have more information

          Regards
          Isomorphic Software

          Comment


            #6
            We have made a change to address this issue on the 4.0p and 4.1d branches. Please pick up the next nightly build to see the change.
            If moving to 4.x is not an option for you at this time, please let us know. The fix may be able to be backported to the older branch.

            Regards
            Isomorphic Software

            Comment

            Working...
            X