use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.
the class AnalysisColumnTreeViewer method createTree.
/**
* @param parent
*/
private Tree createTree(Composite parent) {
final Tree newTree = new TooltipTree(parent, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION) {
@Override
protected boolean isValidItem(TreeItem item) {
if (item == null) {
return false;
}
Object itemData = item.getData(INDICATOR_UNIT_KEY);
Object columnItemData = item.getData(MODELELEMENT_INDICATOR_KEY);
if (itemData != null) {
IndicatorUnit indicatorUnit = (IndicatorUnit) item.getData(INDICATOR_UNIT_KEY);
if (indicatorUnit != null && !(indicatorUnit.getIndicator() instanceof CompositeIndicator)) {
return true;
}
return false;
} else {
if (columnItemData != null) {
ModelElementIndicator modelElementIndicator = (ModelElementIndicator) columnItemData;
IRepositoryNode modelElementRepositoryNode = modelElementIndicator.getModelElementRepositoryNode();
return modelElementRepositoryNode == null ? false : true;
}
return false;
}
}
@Override
protected String getItemTooltipText(TreeItem item) {
String expCont = isExpressionNull(item);
if (expCont == null) {
// $NON-NLS-1$
return DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.queryNotGen");
}
return expCont;
}
};
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(newTree);
newTree.setHeaderVisible(true);
// $NON-NLS-1$
createTreeItem(newTree, 300, "AnalysisColumnTreeViewer.analyzedColumns");
createTreeDataminingItem(newTree);
// $NON-NLS-1$
createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.pattern");
// $NON-NLS-1$
createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.udi");
// $NON-NLS-1$
createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.operation");
// TDQ-11622 : add a column here, let the width = 1 and text = EMPTY_STRING TODO need to find a better solution!
TreeColumn blankColumn = new TreeColumn(newTree, SWT.CENTER);
blankColumn.setWidth(1);
// ~ TDQ-11622
parent.layout();
AbstractAnalysisActionHandler actionHandler = new AbstractAnalysisActionHandler(parent) {
@Override
protected void handleRemove() {
removeSelectedElements(newTree);
}
};
parent.setData(AbstractMetadataFormPage.ACTION_HANDLER, actionHandler);
ColumnViewerDND.installDND(newTree);
this.addTreeListener(newTree);
newTree.setData(this);
return newTree;
}
use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.
the class ModelElementTreeMenuProvider method editPattern.
private void editPattern(Tree tree) {
TreeItem[] selection = tree.getSelection();
if (selection.length > 0) {
TreeItem treeItem = selection[0];
IndicatorUnit indicatorUnit = (IndicatorUnit) treeItem.getData(AbstractColumnDropTree.INDICATOR_UNIT_KEY);
PatternMatchingIndicator indicator = (PatternMatchingIndicator) indicatorUnit.getIndicator();
Pattern pattern = indicator.getParameters().getDataValidDomain().getPatterns().get(0);
RepositoryNode patternRecursiveFind = RepositoryNodeHelper.recursiveFind(pattern);
PatternItemEditorInput patternItemEditorInput = new PatternItemEditorInput(patternRecursiveFind);
CorePlugin.getDefault().openEditor(patternItemEditorInput, PatternEditor.class.getName());
}
}
use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.
the class PatternMouseAdapter method mouseDown.
@Override
public void mouseDown(MouseEvent e) {
DataManager dm = analysis.getContext().getConnection();
if (dm == null) {
masterPage.doSave(null);
}
// MOD gdbu 2011-8-26 bug : TDQ-2169
IRepositoryNode patternFolderNode = getPatternSelectDialogInputData();
if (patternFolderNode == null) {
return;
}
CheckedTreeSelectionDialog dialog = PatternUtilities.createPatternCheckedTreeSelectionDialog(patternFolderNode);
if (null != filters) {
for (ViewerFilter filter : filters) {
dialog.addFilter(filter);
}
}
// ~TDQ-2169
Object[] selectedRepNodes = PatternUtilities.getPatternRepNodesByIndicator(meIndicator);
dialog.setInitialSelections(selectedRepNodes);
dialog.create();
if (dialog.open() == Window.OK) {
// MOD qiongli 2012-10-17 TDQ-5923,just remove some deselected indicatorUnit,just create new indicatorUnit
// for some new added pattern nodes.
List<PatternRepNode> allSelectedPatternNodes = new ArrayList<PatternRepNode>();
Set<String> allSelectedNodeNames = new HashSet<String>();
for (Object obj : dialog.getResult()) {
if (obj instanceof PatternRepNode) {
PatternRepNode patternNode = (PatternRepNode) obj;
allSelectedPatternNodes.add(patternNode);
allSelectedNodeNames.add(patternNode.getLabel());
}
}
Set<String> oldSelectedNodeNames = new HashSet<String>();
Map<String, IndicatorUnit> oldSelectedUnits = new HashMap<String, IndicatorUnit>();
for (IndicatorUnit indicatorUnit : meIndicator.getIndicatorUnits()) {
Indicator indicator = indicatorUnit.getIndicator();
if (indicator instanceof PatternMatchingIndicator) {
if (!allSelectedNodeNames.contains(indicator.getName())) {
// this method will deal dependency with same time
columnDropTree.deleteIndicatorItems(meIndicator, indicatorUnit);
if (!columnDropTree.isDirty()) {
columnDropTree.setDirty(true);
}
} else {
oldSelectedNodeNames.add(indicator.getName());
oldSelectedUnits.put(indicator.getName(), indicatorUnit);
}
}
}
// Added yyin 20121121 TDQ-6329: after remove all, should also add the old selected patterns
// because the columnset does not have pagination, can not refresh automatically
boolean addOldSelected = false;
if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
addOldSelected = true;
}
if (addOldSelected) {
for (TreeItem child : treeItem.getItems()) {
masterPage.getTreeViewer().removeItemBranch(child);
}
}
// ~
treeItem.removeAll();
for (PatternRepNode patternNode : allSelectedPatternNodes) {
if (oldSelectedNodeNames.contains(patternNode.getLabel()) && !addOldSelected) {
continue;
}
TypedReturnCode<IndicatorUnit> trc = PatternUtilities.createIndicatorUnit(patternNode.getPattern(), meIndicator, analysis);
if (trc.isOk()) {
createOneUnit(trc.getObject());
// TDQ-8860 add msjian 2014-4-30:check whether show allmatchindicator in the indicators section
if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
EventManager.getInstance().publish(analysis, EventEnum.DQ_COLUMNSET_SHOW_MATCH_INDICATORS, null);
}
// TDQ-8860~
}
}
treeItem.setExpanded(true);
if (masterPage instanceof ColumnAnalysisDetailsPage) {
ColumnAnalysisDetailsPage page = (ColumnAnalysisDetailsPage) masterPage;
page.refreshTheTree(page.getCurrentModelElementIndicators());
}
}
}
use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.
the class ModeStatisticsState method getCustomerDataset.
public ICustomerDataset getCustomerDataset() {
CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
for (IndicatorUnit unit : units) {
ChartDataEntity entity = ModeStatisticsStateUtil.createDataEntity(unit, unit.getIndicatorName());
customerdataset.addDataEntity(entity);
}
return customerdataset;
}
use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.
the class PhoneNumbStatisticsState method getCustomerDataset.
/*
* (non-Jsdoc)
*
* @see org.talend.dataprofiler.core.ui.editor.preview.model.states.IChartTypeStates#getCustomerDataset()
*/
public ICustomerDataset getCustomerDataset() {
CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
for (IndicatorUnit unit : units) {
String value = CommonStateUtil.getUnitValue(unit.getValue(), StringFormatUtil.DOUBLE_NUMBER);
String label = unit.getIndicatorName();
customerdataset.addValue(Double.parseDouble(value), label, label);
ChartDataEntity entity = PhoneNumbStatisticsStateUtil.createDataEntity(unit.getIndicator(), value, label);
customerdataset.addDataEntity(entity);
}
return customerdataset;
}
Aggregations