コード例 #1
0
  public void testDisposeMasterDisposesDetail() {
    IObservableValue master = new WritableValue();
    WritableListFactory factory = new WritableListFactory();
    master.setValue("");

    IObservableList detailObservable = MasterDetailObservables.detailList(master, factory, null);
    DisposeEventTracker tracker = DisposeEventTracker.observe(detailObservable);

    master.dispose();

    assertEquals(1, tracker.count);
    assertTrue(detailObservable.isDisposed());
  }
コード例 #2
0
  public void testDisposeWhileFiringEvents() {
    IObservableValue master = new WritableValue();
    WritableListFactory factory = new WritableListFactory();
    master.setValue("");

    final IObservableList[] detailObservable = new IObservableList[1];

    master.addValueChangeListener(
        new IValueChangeListener() {
          @Override
          public void handleValueChange(ValueChangeEvent event) {
            detailObservable[0].dispose();
          }
        });

    detailObservable[0] = MasterDetailObservables.detailList(master, factory, null);

    master.setValue("New Value");
  }