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

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

Introduction

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

Prototype

public boolean isGrayed(Object element);

Source Link

Document

Indicates whether the check box associated with an element, when checked as indicated by the ICheckStateProvider#isChecked(Object) method, should display the gray (boxed) state instead of the check mark.

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 .  co 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_a_widget_not_grayed_if_a_leaf() throws Exception {
    final SimpleField modelElement = new SimpleField();
    modelElement.setType(FieldType.BOOLEAN);
    final WidgetMapping mapping1 = new WidgetMapping(modelElement);
    when(checkboxTreeViewer.getChecked(mapping1)).thenReturn(true);
    final ICheckStateProvider checkStateProvider = selectGeneratedWidgetsWizardPage
            .getCheckStateProvider(checkboxTreeViewer);

    assertThat(checkStateProvider.isGrayed(mapping1)).isFalse();
}