Search in sources :

Example 1 with FormEnum

use of org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum in project tdq-studio-se by Talend.

the class InidcatorUnitTest method testGetFormsCase1.

/**
 * Test method for {@link org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit#getForms()}.
 *
 * test case 1: Get Forms from ColumnSetIndicatorUnit
 */
@Test
public void testGetFormsCase1() {
    RowCountIndicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
    IRepositoryViewObject rowCountRepositoryViewObject = null;
    try {
        List<IRepositoryViewObject> all = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.SYSTEM_INDICATORS_SIMPLE_STATISTICS);
        Assert.assertEquals(10, all.size());
        rowCountRepositoryViewObject = all.get(7);
    } catch (PersistenceException e) {
        Assert.fail(e.getMessage());
    }
    Assert.assertNotNull(rowCountRepositoryViewObject);
    TDQIndicatorDefinitionItem rowCountItem = (TDQIndicatorDefinitionItem) rowCountRepositoryViewObject.getProperty().getItem();
    rowCountIndicator.setIndicatorDefinition(rowCountItem.getIndicatorDefinition());
    ColumnSetIndicatorUnit columnSetIndicatorUnit = new ColumnSetIndicatorUnit(IndicatorEnum.RowCountIndicatorEnum, rowCountIndicator);
    FormEnum[] forms = new FormEnum[] { FormEnum.IndicatorThresholdsForm };
    FormEnum[] resultforms = columnSetIndicatorUnit.getForms();
    Assert.assertEquals(forms.length, resultforms.length);
    for (int index = 0; index < forms.length; index++) {
        Assert.assertEquals(forms[index], resultforms[index]);
    }
}
Also used : TDQIndicatorDefinitionItem(org.talend.dataquality.properties.TDQIndicatorDefinitionItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) FormEnum(org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum) Test(org.junit.Test)

Example 2 with FormEnum

use of org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum in project tdq-studio-se by Talend.

the class DynamicIndicatorOptionsPage method createControl.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
     */
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new FillLayout());
    tabFolder = new TabFolder(container, SWT.FLAT);
    tabFolder.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Object formObject = e.item.getData();
            if (formObject != null && getCurrentDialog() != null) {
                AbstractIndicatorForm form = (AbstractIndicatorForm) formObject;
                String helpHref = form.getFormEnum().getHelpHref();
                getCurrentDialog().setHref(helpHref);
                getCurrentDialog().showHelp();
            }
        }
    });
    FormEnum[] forms = FormEnum.getForms(indicatorUnit);
    if (forms != null) {
        validFroms = createForm(tabFolder, listener, forms);
        setControl(createView(validFroms));
    }
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) AbstractIndicatorForm(org.talend.dataprofiler.core.ui.wizard.indicator.forms.AbstractIndicatorForm) TabFolder(org.eclipse.swt.widgets.TabFolder) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormEnum(org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 3 with FormEnum

use of org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum in project tdq-studio-se by Talend.

the class DynamicTableIndicatorOptionsPage method createControl.

public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new FillLayout());
    tabFolder = new TabFolder(container, SWT.FLAT);
    tabFolder.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Object formObject = e.item.getData();
            if (formObject != null && getCurrentDialog() != null) {
                AbstractIndicatorForm form = (AbstractIndicatorForm) formObject;
                String helpHref = form.getFormEnum().getHelpHref();
                getCurrentDialog().setHref(helpHref);
                getCurrentDialog().showHelp();
            }
        }
    });
    FormEnum[] forms = FormEnum.getForms(indicatorUnit);
    if (forms != null) {
        validFroms = createForm(tabFolder, listener, forms);
        setControl(createView(validFroms));
    }
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) AbstractIndicatorForm(org.talend.dataprofiler.core.ui.wizard.indicator.forms.AbstractIndicatorForm) TabFolder(org.eclipse.swt.widgets.TabFolder) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormEnum(org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 4 with FormEnum

use of org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum in project tdq-studio-se by Talend.

the class InidcatorUnitTest method testGetFormsCase2.

/**
 * Test method for {@link org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit#getForms()}.
 *
 * test case 2: Get Forms from TableIndicatorUnit
 */
@Test
public void testGetFormsCase2() {
    RowCountIndicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
    IRepositoryViewObject rowCountRepositoryViewObject = null;
    try {
        List<IRepositoryViewObject> all = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.SYSTEM_INDICATORS_SIMPLE_STATISTICS);
        Assert.assertEquals(10, all.size());
        rowCountRepositoryViewObject = all.get(7);
    } catch (PersistenceException e) {
        Assert.fail(e.getMessage());
    }
    Assert.assertNotNull(rowCountRepositoryViewObject);
    TDQIndicatorDefinitionItem rowCountItem = (TDQIndicatorDefinitionItem) rowCountRepositoryViewObject.getProperty().getItem();
    rowCountIndicator.setIndicatorDefinition(rowCountItem.getIndicatorDefinition());
    ColumnIndicatorUnit columnIndicatorUnit = new ColumnIndicatorUnit(IndicatorEnum.RowCountIndicatorEnum, rowCountIndicator, null);
    FormEnum[] forms = new FormEnum[] { FormEnum.IndicatorThresholdsForm };
    FormEnum[] resultforms = columnIndicatorUnit.getForms();
    Assert.assertEquals(forms.length, resultforms.length);
    for (int index = 0; index < forms.length; index++) {
        Assert.assertEquals(forms[index], resultforms[index]);
    }
}
Also used : TDQIndicatorDefinitionItem(org.talend.dataquality.properties.TDQIndicatorDefinitionItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) FormEnum(org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum) Test(org.junit.Test)

Example 5 with FormEnum

use of org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum in project tdq-studio-se by Talend.

the class InidcatorUnitTest method testGetFormsCase3.

/**
 * Test method for {@link org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit#getForms()}.
 *
 * test case 3: Get Forms from ColumnIndicatorUnit
 */
@Test
public void testGetFormsCase3() {
    RowCountIndicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
    IRepositoryViewObject rowCountRepositoryViewObject = null;
    try {
        List<IRepositoryViewObject> all = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.SYSTEM_INDICATORS_SIMPLE_STATISTICS);
        Assert.assertEquals(10, all.size());
        rowCountRepositoryViewObject = all.get(7);
    } catch (PersistenceException e) {
        Assert.fail(e.getMessage());
    }
    Assert.assertNotNull(rowCountRepositoryViewObject);
    TDQIndicatorDefinitionItem rowCountItem = (TDQIndicatorDefinitionItem) rowCountRepositoryViewObject.getProperty().getItem();
    rowCountIndicator.setIndicatorDefinition(rowCountItem.getIndicatorDefinition());
    TableIndicatorUnit TableIndicatorUnit = new TableIndicatorUnit(IndicatorEnum.RowCountIndicatorEnum, rowCountIndicator, null);
    FormEnum[] forms = new FormEnum[] { FormEnum.IndicatorThresholdsForm };
    FormEnum[] resultforms = TableIndicatorUnit.getForms();
    Assert.assertEquals(forms.length, resultforms.length);
    for (int index = 0; index < forms.length; index++) {
        Assert.assertEquals(forms[index], resultforms[index]);
    }
}
Also used : TDQIndicatorDefinitionItem(org.talend.dataquality.properties.TDQIndicatorDefinitionItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) FormEnum(org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum) Test(org.junit.Test)

Aggregations

FormEnum (org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum)5 Test (org.junit.Test)3 PersistenceException (org.talend.commons.exception.PersistenceException)3 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)3 RowCountIndicator (org.talend.dataquality.indicators.RowCountIndicator)3 TDQIndicatorDefinitionItem (org.talend.dataquality.properties.TDQIndicatorDefinitionItem)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 TabFolder (org.eclipse.swt.widgets.TabFolder)2 AbstractIndicatorForm (org.talend.dataprofiler.core.ui.wizard.indicator.forms.AbstractIndicatorForm)2