use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.
the class ModelElementTreeMenuProvider method editUDIndicator.
/**
* DOC yyi Comment method "editUDIndicator" 2009-09-04.
*
* @param tree
*/
private void editUDIndicator(Tree tree) {
TreeItem[] selection = tree.getSelection();
if (selection.length > 0) {
TreeItem treeItem = selection[0];
IndicatorUnit indicatorUnit = (IndicatorUnit) treeItem.getData(AbstractColumnDropTree.INDICATOR_UNIT_KEY);
UserDefIndicator indicator = (UserDefIndicator) indicatorUnit.getIndicator();
IFile file = ResourceFileMap.findCorrespondingFile(indicator.getIndicatorDefinition());
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
activePage.openEditor(new FileEditorInput(file), // $NON-NLS-1$
"org.talend.dataprofiler.core.ui.editor.indicator.IndicatorEditor");
} catch (PartInitException e1) {
log.error(e1, e1);
}
}
}
use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.
the class AbstractColumnDropTree method createOneUnit.
/**
* DOC qzhang Comment method "createOneUnit".
*
* @param treeItem
* @param indicatorUnit
*/
public void createOneUnit(final TreeItem treeItem, IndicatorUnit indicatorUnit) {
final TreeItem indicatorItem = new TreeItem(treeItem, SWT.NONE);
final IndicatorUnit unit = indicatorUnit;
IndicatorEnum indicatorType = indicatorUnit.getType();
indicatorItem.setData(MODELELEMENT_INDICATOR_KEY, treeItem.getData(MODELELEMENT_INDICATOR_KEY));
indicatorItem.setData(INDICATOR_UNIT_KEY, unit);
indicatorItem.setData(viewKey, this);
indicatorItem.setImage(0, getIndicatorImage(unit));
String indicatorName = getIndicatorName(indicatorUnit);
// $NON-NLS-1$
String label = indicatorName == null ? "unknown indicator" : indicatorName;
indicatorItem.setText(0, label);
TreeEditor optionEditor = new TreeEditor(tree);
// $NON-NLS-1$
final Label optionLabel = createTreeItemLabel(tree, ImageLib.OPTION, "AnalysisColumnTreeViewer.options");
optionLabel.setData(indicatorUnit);
optionLabel.addMouseListener(new MouseAdapter() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.MouseAdapter#mouseDown(org.eclipse.swt .events.MouseEvent)
*/
@Override
public void mouseDown(MouseEvent e) {
boolean hasIndicatorParameters = openIndicatorOptionDialog(Display.getCurrent().getActiveShell(), indicatorItem);
if (hasIndicatorParameters) {
optionLabel.setImage(ImageLib.getImage(ImageLib.INDICATOR_OPTION_CHECKED));
}
}
});
optionEditor.minimumWidth = optionLabel.getImage().getBounds().width;
optionEditor.horizontalAlignment = SWT.CENTER;
optionEditor.setEditor(optionLabel, indicatorItem, 1);
// }
TreeEditor delEditor = new TreeEditor(tree);
// $NON-NLS-1$
Label delLabel = createTreeItemLabel(tree, ImageLib.DELETE_ACTION, "AnalysisColumnTreeViewer.delete");
delLabel.addMouseListener(new MouseAdapter() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.MouseAdapter#mouseDown(org.eclipse.swt .events.MouseEvent)
*/
@Override
public void mouseDown(MouseEvent e) {
// current delLabel is behind of one indicator item.
ModelElementIndicator meIndicator = (ModelElementIndicator) treeItem.getData(MODELELEMENT_INDICATOR_KEY);
deleteIndicatorItems(meIndicator, unit);
if (indicatorItem.getParentItem() != null && indicatorItem.getParentItem().getData(INDICATOR_UNIT_KEY) != null) {
setElements(modelElementIndicators);
} else {
removeItemBranch(indicatorItem);
}
}
});
delEditor.minimumWidth = delLabel.getImage().getBounds().width;
delEditor.horizontalAlignment = SWT.CENTER;
// MOD mzhao feature 13040, column analysis have 5 columns, whereas columnset have 4 columns.
if (AnalysisColumnTreeViewer.VIEWER_KEY.equals(viewKey)) {
delEditor.setEditor(delLabel, indicatorItem, 4);
} else if (AnalysisColumnSetTreeViewer.VIEWER_KEY.equals(viewKey)) {
delEditor.setEditor(delLabel, indicatorItem, 3);
}
indicatorItem.setData(ITEM_EDITOR_KEY, new TreeEditor[] { optionEditor, delEditor });
if (indicatorType.hasChildren()) {
indicatorItem.setData(treeItem.getData(MODELELEMENT_INDICATOR_KEY));
createIndicatorItems(indicatorItem, indicatorUnit.getChildren());
}
if (hasIndicatorParameters(indicatorUnit)) {
optionLabel.setImage(ImageLib.getImage(ImageLib.INDICATOR_OPTION_CHECKED));
}
}
use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.
the class PieStatisticsState method getCustomerDataset.
public ICustomerDataset getCustomerDataset() {
CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
for (IndicatorUnit unit : units) {
if (unit.isExcuted()) {
FrequencyExt[] frequencyExt = (FrequencyExt[]) unit.getValue();
int numOfShown = PieStatisticsStateUtil.getNumberOfShown(unit, frequencyExt);
for (int i = 0; i < numOfShown; i++) {
FrequencyExt freqExt = frequencyExt[i];
String keyLabel = PieStatisticsStateUtil.getkeyLabel(freqExt);
customerdataset.addValue(freqExt.getValue(), PluginConstant.EMPTY_STRING, keyLabel);
ChartDataEntity entity = PieStatisticsStateUtil.createDataEntity(unit, freqExt, keyLabel);
customerdataset.addDataEntity(entity);
}
}
}
return customerdataset;
}
use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.
the class SimpleStatisticsState method getCustomerDataset.
public ICustomerDataset getCustomerDataset() {
CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
for (IndicatorUnit unit : units) {
String value = CommonStateUtil.getUnitValue(unit.getValue(), 0);
String label = unit.getIndicatorName();
customerdataset.addValue(Double.parseDouble(value), label, label);
ChartDataEntity entity = CommonStateUtil.createDataEntity(unit, value, label);
customerdataset.addDataEntity(entity);
}
return customerdataset;
}
use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.
the class SimpleTextStatisticsState method getCustomerDataset.
@Override
public ICustomerDataset getCustomerDataset() {
// sort these indicators.
ComparatorsFactory.sort(units, ComparatorsFactory.TEXT_STATISTICS_COMPARATOR_ID);
CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
for (IndicatorUnit unit : units) {
double value = unit.getValue() != null ? Double.parseDouble(unit.getValue().toString()) : Double.NaN;
String label = unit.getIndicatorName();
// $NON-NLS-1$
String type = "";
switch(unit.getType()) {
case MinLengthWithNullIndicatorEnum:
case MinLengthWithBlankIndicatorEnum:
case MinLengthWithBlankNullIndicatorEnum:
// $NON-NLS-1$
type = "Minimal";
break;
case MaxLengthWithBlankIndicatorEnum:
case MaxLengthWithBlankNullIndicatorEnum:
case MaxLengthWithNullIndicatorEnum:
// $NON-NLS-1$
type = "Maximal";
break;
case AverageLengthWithNullIndicatorEnum:
case AverageLengthWithBlankIndicatorEnum:
case AverageLengthWithNullBlankIndicatorEnum:
// $NON-NLS-1$
type = "Average";
break;
default:
type = label;
break;
}
customerdataset.addValue(value, type, label);
ChartDataEntity entity = new ChartDataEntity();
entity.setIndicator(unit.getIndicator());
entity.setLabel(label);
entity.setValue(String.valueOf(value));
entity.setPercent(value / unit.getIndicator().getCount());
customerdataset.addDataEntity(entity);
}
return customerdataset;
}
Aggregations