use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class AbstractColumnDropTree method deleteModelElementItems.
/**
* DOC rli Comment method "deleteTreeElements".
*
* @param deleteModelElementIndiciator
*/
public void deleteModelElementItems(ModelElementIndicator deleteModelElementIndiciator) {
ModelElementIndicator[] remainIndicators = new ModelElementIndicator[modelElementIndicators.length - 1];
int i = 0;
for (ModelElementIndicator indicator : modelElementIndicators) {
if (deleteModelElementIndiciator.equals(indicator)) {
continue;
} else {
remainIndicators[i] = indicator;
i++;
}
}
this.modelElementIndicators = remainIndicators;
initializedConnection(this.modelElementIndicators);
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class AbstractColumnDropTree method translateSelectedNodeIntoIndicator.
// translate the selected nodes into related indicators, without set the values to this.modelElementIndicators
// directly
protected ModelElementIndicator[] translateSelectedNodeIntoIndicator(Object[] objs) {
List<IRepositoryNode> reposList = RepNodeUtils.translateSelectedToStandardReposityoryNode(objs);
if (reposList.size() == 0) {
// this.modelElementIndicators = new ModelElementIndicator[0];
return new ModelElementIndicator[0];
}
// MOD qiongli 2011-1-7 feature 16796.
boolean isDelimitedFile = false;
if (objs != null && objs.length != 0) {
// MOD klliu 2011-02-16 feature 15387
isDelimitedFile = RepNodeUtils.isDelimitedFile(objs[0]);
if (!(reposList.get(0) instanceof DBColumnRepNode || isDelimitedFile)) {
return null;
}
}
List<ModelElementIndicator> modelElementIndicatorList = new ArrayList<ModelElementIndicator>();
for (ModelElementIndicator modelElementIndicator : getAllTheElementIndicator()) {
if (reposList.contains(modelElementIndicator.getModelElementRepositoryNode())) {
modelElementIndicatorList.add(modelElementIndicator);
reposList.remove(modelElementIndicator.getModelElementRepositoryNode());
}
}
for (IRepositoryNode repObj : reposList) {
ModelElementIndicator temp = isDelimitedFile ? ModelElementIndicatorHelper.createDFColumnIndicator(repObj) : ModelElementIndicatorHelper.createColumnIndicator(repObj);
modelElementIndicatorList.add(temp);
}
return modelElementIndicatorList.toArray(new ModelElementIndicator[modelElementIndicatorList.size()]);
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class AnalysisColumnSetTreeViewer method addItemElements.
private void addItemElements(final ModelElementIndicator[] elements) {
// MOD qiongli 2011-1-27,change TdColumn to MetadataColumn for supporting delimited file.
for (ModelElementIndicator element2 : elements) {
final ModelElementIndicator meIndicator = element2;
final ModelElement modelElement = RepositoryNodeHelper.getSubModelElement(meIndicator.getModelElementRepositoryNode());
final TreeItem treeItem = new TreeItem(tree, SWT.NONE);
MetadataHelper.setDefaultDataminingType(modelElement);
columnSetMultiValueList.add(meIndicator.getModelElementRepositoryNode());
treeItem.setImage(ImageLib.getImage(ImageLib.TD_COLUMN));
treeItem.setText(0, getModelElemetnDisplayName(meIndicator));
treeItem.setData(COLUMN_INDICATOR_KEY, modelElement);
treeItem.setData(MODELELEMENT_INDICATOR_KEY, meIndicator);
// MOD mzhao feature 13040 , 2010-05-21
TreeEditor comboEditor = new TreeEditor(tree);
final CCombo combo = new CCombo(tree, SWT.BORDER);
for (DataminingType type : DataminingType.values()) {
// MODSCA 2008-04-10 use literal
combo.add(type.getLiteral());
// for presentation
}
DataminingType dataminingType = MetadataHelper.getDataminingType(modelElement);
if (dataminingType == null) {
combo.select(0);
} else {
combo.setText(dataminingType.getLiteral());
}
combo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
MetadataHelper.setDataminingType(DataminingType.get(combo.getText()), modelElement);
setDirty(true);
}
});
combo.setEditable(false);
comboEditor.minimumWidth = WIDTH1_CELL;
comboEditor.setEditor(combo, treeItem, 1);
TreeEditor addPatternEditor = new TreeEditor(tree);
// $NON-NLS-1$
Label addPatternLabl = createTreeItemLabel(tree, ImageLib.ADD_PATTERN, "AnalysisColumnTreeViewer.addPattern");
PatternMouseAdapter mouseAdapter = new PatternMouseAdapter(this, masterPage, meIndicator, treeItem);
mouseAdapter.addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof IFolder) {
IFolder folder = (IFolder) element;
// $NON-NLS-1$
return !folder.getName().endsWith("SQL");
}
return true;
}
});
addPatternLabl.addMouseListener(mouseAdapter);
addPatternEditor.minimumWidth = addPatternLabl.getImage().getBounds().width;
addPatternEditor.setEditor(addPatternLabl, treeItem, 2);
TreeEditor delLabelEditor = new TreeEditor(tree);
// $NON-NLS-1$
Label delLabel = createTreeItemLabel(tree, ImageLib.DELETE_ACTION, "AnalysisColumnTreeViewer.delete");
delLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
deleteColumnItems(meIndicator.getModelElementRepositoryNode());
if (treeItem.getParentItem() != null && treeItem.getParentItem().getData(INDICATOR_UNIT_KEY) != null) {
setElements(modelElementIndicators);
} else {
deleteIndicatorItems(meIndicator);
removeItemBranch(treeItem);
enabledButtons(false);
}
notifyObservers();
}
});
delLabelEditor.minimumWidth = delLabel.getImage().getBounds().width;
delLabelEditor.horizontalAlignment = SWT.CENTER;
delLabelEditor.setEditor(delLabel, treeItem, 3);
treeItem.setData(ITEM_EDITOR_KEY, new TreeEditor[] { comboEditor, addPatternEditor, delLabelEditor });
if (meIndicator.hasIndicators()) {
createIndicatorItems(treeItem, meIndicator.getIndicatorUnits());
}
delLabelEditor.layout();
treeItem.setExpanded(false);
}
tree.layout();
tree.redraw();
this.setDirty(true);
tree.forceFocus();
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class AnalysisColumnSetTreeViewer method createTree.
/**
* @param parent
*/
private Tree createTree(Composite parent) {
final Tree newTree = new TooltipTree(parent, SWT.MULTI | SWT.BORDER) {
@Override
protected String getItemTooltipText(TreeItem item) {
ModelElementIndicator meIndicator = (ModelElementIndicator) item.getData(MODELELEMENT_INDICATOR_KEY);
IRepositoryNode parentNodeForColumnNode = RepositoryNodeHelper.getParentNodeForColumnNode(meIndicator.getModelElementRepositoryNode());
return DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.columnParent", // $NON-NLS-1$ //;
parentNodeForColumnNode.getObject().getLabel());
}
};
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.operation");
parent.layout();
AbstractAnalysisActionHandler actionHandler = new AbstractAnalysisActionHandler(parent) {
@Override
protected void handleRemove() {
removeSelectedElements(newTree);
// MOD mzhao 2005-05-05 bug 6587.
// MOD mzhao 2009-06-8, bug 5887.
updateBindConnection(masterPage, tree);
}
};
parent.setData(AbstractMetadataFormPage.ACTION_HANDLER, actionHandler);
addTargetDND(newTree);
addTreeListener(newTree);
return newTree;
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class AnalysisColumnTreeViewer method addItemElements.
private void addItemElements(final ModelElementIndicator[] elements, boolean isExpandAll) {
for (ModelElementIndicator element : elements) {
final TreeItem treeItem = new TreeItem(tree, SWT.NONE);
treeItem.setImage(ImageLib.getImage(ImageLib.TD_COLUMN));
final ModelElementIndicator meIndicator = element;
treeItem.setText(0, ModelElementIndicatorHelper.getModelElementDisplayName(meIndicator));
treeItem.setData(MODELELEMENT_INDICATOR_KEY, meIndicator);
TreeEditor comboEditor = new TreeEditor(tree);
final CCombo combo = new CCombo(tree, SWT.BORDER);
for (DataminingType type : DataminingType.values()) {
// MODSCA 2008-04-10 use literal
combo.add(type.getLiteral());
// for presentation
}
final ModelElement modelElement = RepositoryNodeHelper.getSubModelElement(meIndicator.getModelElementRepositoryNode());
DataminingType dataminingType = MetadataHelper.getDataminingType(modelElement);
// MOD qiongli 2010-11-15 feature 16796
if (meIndicator instanceof DelimitedFileIndicator) {
dataminingType = MetadataHelper.getDefaultDataminingType(meIndicator.getJavaType());
}
if (dataminingType == null) {
combo.select(0);
} else {
combo.setText(dataminingType.getLiteral());
}
combo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
MetadataHelper.setDataminingType(DataminingType.get(combo.getText()), modelElement);
setDirty(true);
}
});
combo.setEditable(false);
comboEditor.minimumWidth = WIDTH1_CELL;
comboEditor.setEditor(combo, treeItem, 1);
TreeEditor addPatternEditor = new TreeEditor(tree);
// $NON-NLS-1$
Label addPatternLabl = createTreeItemLabel(tree, ImageLib.ADD_PATTERN, "AnalysisColumnTreeViewer.addPattern");
// MOD mzhao feature:13040, 2010-05-21
addPatternLabl.addMouseListener(new PatternMouseAdapter(this, masterPage, meIndicator, treeItem));
addPatternEditor.minimumWidth = addPatternLabl.getImage().getBounds().width;
addPatternEditor.setEditor(addPatternLabl, treeItem, 2);
// ADD xqliu 2010-02-23 feature 11617
TreeEditor addUdiEditor = addColumnUdi(treeItem, meIndicator, 3);
// ~
TreeEditor delLabelEditor = new TreeEditor(tree);
// $NON-NLS-1$
Label delLabel = createTreeItemLabel(tree, ImageLib.DELETE_ACTION, "AnalysisColumnTreeViewer.delete");
delLabel.setData(treeItem);
delLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
// // here is the delLable which is behind of column, so need to remove current column and it's all
// of
TreeItem currentTreeItem = (TreeItem) e.widget.getData();
removeSelectedElements(new TreeItem[] { currentTreeItem });
notifyObservers();
}
});
delLabelEditor.minimumWidth = delLabel.getImage().getBounds().width;
delLabelEditor.horizontalAlignment = SWT.CENTER;
delLabelEditor.setEditor(delLabel, treeItem, 4);
treeItem.setData(ITEM_EDITOR_KEY, new TreeEditor[] { comboEditor, delLabelEditor, addPatternEditor, addUdiEditor });
if (meIndicator.hasIndicators()) {
createIndicatorItems(treeItem, meIndicator.getIndicatorUnits());
}
treeItem.setExpanded(isExpandAll);
}
}
Aggregations