Example usage for org.eclipse.jface.viewers ICheckStateProvider isChecked

List of usage examples for org.eclipse.jface.viewers ICheckStateProvider isChecked

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers ICheckStateProvider isChecked.

Prototype

public boolean isChecked(Object element);

Source Link

Document

Indicates if an element's representation should appear as checked or gray instead of unchecked.

Usage

From source file:org.bonitasoft.studio.properties.sections.forms.wizard.SelectGeneratedWidgetsWizardPageTest.java

License:Open Source License

@Test
public void should_a_widget_container_be_grayed_if_not_all_of_its_children_is_selected() throws Exception {
    final WidgetMapping parent = new WidgetMapping(BusinessObjectDataBuilder.aBusinessData()
            .havingDataType(BusinessObjectDataTypeBuilder.aBusinessObjectDataType()).build());
    final SimpleField modelElement = new SimpleField();
    modelElement.setType(FieldType.BOOLEAN);
    final WidgetMapping mapping1 = new WidgetMapping(modelElement);
    when(checkboxTreeViewer.getChecked(mapping1)).thenReturn(true);
    final WidgetMapping mapping2 = new WidgetMapping(modelElement);
    when(checkboxTreeViewer.getChecked(mapping2)).thenReturn(false);
    parent.addChild(mapping1);/* ww w .j a v  a  2s .  c o  m*/
    parent.addChild(mapping2);

    final ICheckStateProvider checkStateProvider = selectGeneratedWidgetsWizardPage
            .getCheckStateProvider(checkboxTreeViewer);

    assertThat(checkStateProvider.isGrayed(parent)).isTrue();
    assertThat(checkStateProvider.isChecked(parent)).isFalse();
}

From source file:org.bonitasoft.studio.properties.sections.forms.wizard.SelectGeneratedWidgetsWizardPageTest.java

License:Open Source License

@Test
public void should_element_in_tree_be_checked_if_generated() throws Exception {
    final ICheckStateProvider checkStateProvider = selectGeneratedWidgetsWizardPage
            .getCheckStateProvider(checkboxTreeViewer);

    final SimpleField modelElement = new SimpleField();
    modelElement.setType(FieldType.BOOLEAN);
    final WidgetMapping mapping = new WidgetMapping(modelElement);
    mapping.setGenerated(true);//  w  w  w  . j  a  v  a2  s.  c  om

    assertThat(checkStateProvider.isChecked(mapping)).isTrue();
}

From source file:org.bonitasoft.studio.properties.sections.forms.wizard.SelectGeneratedWidgetsWizardPageTest.java

License:Open Source License

@Test
public void should_element_in_tree_be_unchecked_if_not_generated() throws Exception {
    final ICheckStateProvider checkStateProvider = selectGeneratedWidgetsWizardPage
            .getCheckStateProvider(checkboxTreeViewer);

    final SimpleField modelElement = new SimpleField();
    modelElement.setType(FieldType.BOOLEAN);
    final WidgetMapping mapping = new WidgetMapping(modelElement);
    mapping.setGenerated(false);// ww w  .jav  a2 s .  c o  m

    assertThat(checkStateProvider.isChecked(mapping)).isFalse();
}