Announcement

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

    Strange observation with Development Mode and Breakpoints

    Hi Isomorphic,

    I don't know if such a behavior is expected, for me it seems very strange (no bug though). Using current 5.1p (v10.1p_2016-03-07).
    Please try the testcase in FF26 Dev Mode.
    For me, without breakpoints everything is as expected.
    But with breakpoints in the event handler, the event handler gets called in an infinite loop.
    I made a video of it:

    Click image for larger version

Name:	Animation.gif
Views:	33
Size:	1.32 MB
ID:	235836

    Testcase BuiltInDS.java:
    Code:
    package com.smartgwt.sample.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.data.AdvancedCriteria;
    import com.smartgwt.client.data.Criterion;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.types.OperatorId;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.Window;
    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.events.ItemChangedEvent;
    import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
    import com.smartgwt.client.widgets.form.fields.FormItem;
    import com.smartgwt.client.widgets.form.fields.SpinnerItem;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS implements EntryPoint {
        private VLayout mainLayout;
        private IButton recreateBtn;
        private Integer i = 0;
    
        public void onModuleLoad() {
            KeyIdentifier debugKey = new KeyIdentifier();
            debugKey.setCtrlKey(true);
            debugKey.setKeyName("D");
    
            Page.registerKey(debugKey, new PageKeyHandler() {
                public void execute(String keyName) {
                    SC.showConsole();
                }
            });
    
            mainLayout = new VLayout(20);
            mainLayout.setWidth100();
            mainLayout.setHeight100();
    
            recreateBtn = new IButton("Recreate");
            recreateBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    recreate();
                }
            });
            mainLayout.addMember(recreateBtn);
            recreate();
            mainLayout.draw();
        }
    
        private void recreate() {
            Window w = new Window();
            w.setWidth("95%");
            w.setHeight("95%");
            w.setMembersMargin(0);
            w.setModalMaskOpacity(70);
            w.setTitle("Strange effect when debugging.");
            w.setShowMinimizeButton(false);
            w.setIsModal(true);
            w.setShowModalMask(true);
            w.centerInPage();
    
            i = 0;
    
            final DynamicForm employeeForm = new DynamicForm();
    
            employeeForm.setHeight100();
            employeeForm.setAutoFetchData(false);
            employeeForm.setDataSource(DataSource.get("employees"));
    
            FormItem employeeId = new FormItem("EmployeeId");
            FormItem name = new FormItem("Name");
            FormItem gender = new FormItem("Gender");
            FormItem reportsTo = new FormItem("ReportsTo");
            FormItem job = new FormItem("Job");
            SpinnerItem salary = new SpinnerItem("Salary");
    
            employeeForm.setFields(employeeId, name, gender, reportsTo, job, salary);
            employeeForm.fetchData(new AdvancedCriteria(new Criterion(employeeId.getName(), OperatorId.EQUALS, 4)));
            employeeForm.addItemChangedHandler(new ItemChangedHandler() {
                @Override
                public void onItemChanged(ItemChangedEvent event) {
                    i++;
                    SC.logWarn("ItemChangedEvent: " + i);
                    SC.say("ItemChangedEvent: " + i);
                }
            });
            w.addItem(employeeForm);
            w.show();
        }
    }
    I don't think there is an issue here, but perhaps you don't know about this behavior (then its a FYI) , or if you do, you can explain it.

    Best regards
    Blama

    #2
    Don't use SC.say() in any kind of debugging scenario - since it renders widgets, moves focus, etc, it can alter the behavior you are trying to troubleshoot.

    The fact that yet further problems appear when you try to combine SC.say() for debugging with breakpoint features in GWT classic Dev Mode is not especially surprising. It's not something that it makes sense for us to look more deeply into.

    Comment


      #3
      Ok, thank you.

      Best regards
      Blama

      Comment

      Working...
      X