use of org.eclipse.nebula.widgets.grid.GridColumn in project tdq-studio-se by Talend.
the class ColumnPreviewGrid method processNodePrivew.
/**
* DOC talend Comment method "processNodePrivew".
*
* @param object
* @param previewItem
* @throws SQLException
*/
private void processNodePrivew(Object object, GridItem parentItem) throws SQLException {
if (!checkSameTable()) {
return;
}
for (int j = 0; j < limitNumber; j++) {
TalendGridItem currentItem = new TalendGridItem(parentItem, SWT.NONE);
currentItem.setCheckable(0, false);
currentItem.setCheckable(1, false);
for (int i = 2; i < this.getColumnCount(); i++) {
GridColumn column = getColumn(i);
currentItem.setCheckable(i, false);
String columnValue = getColumnValue(i - 2, currentItem);
if (columnValue == null) {
this.remove(this.indexOf(currentItem));
return;
}
int minWith = columnValue.length() * 7 > 100 ? 100 : columnValue.length() * 7;
column.setWidth(COLUMN_WIDTH < minWith ? minWith : COLUMN_WIDTH);
currentItem.setText(i, columnValue);
}
}
}
use of org.eclipse.nebula.widgets.grid.GridColumn in project tdq-studio-se by Talend.
the class ColumnPreviewGrid method notifyhandleColumnHighlight.
@Override
protected void notifyhandleColumnHighlight(MouseEvent e) {
if (observers == null) {
return;
}
for (TDQObserver<ObserverEvent> observer : observers) {
ObserverEvent observerEvent = new ObserverEvent(ObserverEventEnum.ColumnHighlight);
GridColumn currentColumn = this.getColumn(new Point(e.x, e.y));
if (currentColumn != null) {
observerEvent.putData(ObserverEvent.COLUMN_HIGH_LIGHT, this.indexOf(currentColumn));
observer.update(observerEvent);
}
}
}
use of org.eclipse.nebula.widgets.grid.GridColumn in project tdq-studio-se by Talend.
the class ColumnPreviewGrid method notifyObservers.
/*
* (non-Javadoc)
*
* @see
* org.talend.dataprofiler.core.ui.grid.AbstractIndicatorSelectGrid#notifyObservers(org.eclipse.nebula.widgets.grid
* .GridColumn)
*/
@Override
protected void notifyObservers(Event event) {
if (observers == null) {
return;
}
GridColumn sourceColumn = null;
if (GridColumn.class.isInstance(event.item)) {
sourceColumn = (GridColumn) event.item;
} else {
return;
}
for (TDQObserver<ObserverEvent> observer : observers) {
ObserverEvent observerEvent = null;
if (SWT.Resize == event.type) {
observerEvent = new ObserverEvent(ObserverEventEnum.ColumnResize);
observerEvent.putData(ObserverEvent.COLUMN_HEADER_RESIZE, sourceColumn);
} else if (SWT.Move == event.type) {
observerEvent = new ObserverEvent(ObserverEventEnum.MoveColumn);
observerEvent.putData(ObserverEvent.COLUMN_HEADER_MOVE, this.getColumnOrder());
} else {
continue;
}
observer.update(observerEvent);
}
}
use of org.eclipse.nebula.widgets.grid.GridColumn in project tdq-studio-se by Talend.
the class PatternsSelectPage method createControl.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
GridLayout parentGridLayout = new GridLayout();
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
parent.setLayout(parentGridLayout);
List<ModelElement> analysisColumns = this.selectPatternsWizard.getSsIndicator().getAnalyzedColumns();
// add tableView
// MOD msjian TDQ-4631 2012-2-10: add horizontal scroll bar
GridTableViewer tableView = new GridTableViewer(parent, SWT.H_SCROLL);
// TDQ-4631~
this.table = tableView.getGrid();
this.table.setLayoutData(data);
table.setHeaderVisible(true);
table.setLinesVisible(true);
for (ModelElement element : analysisColumns) {
GridColumn tableCum = new GridColumn(table, SWT.CHECK);
String elementName = MetadataConnectionUtils.getMetadataColumnName(element);
if (elementName != null) {
tableCum.setText(elementName);
}
}
tableView.setContentProvider(new PatternSelectContentProvider());
tableView.setLabelProvider(new PatternSelectLabelProvider());
this.tableInputList = organizeTableInput();
tableView.setInput(tableInputList);
for (GridColumn tableCum : table.getColumns()) {
tableCum.pack();
}
// add data filter section.
initDataFilterSection(parent);
inItitemCheck();
this.setControl(parent);
this.setPageComplete(true);
}
use of org.eclipse.nebula.widgets.grid.GridColumn in project tdq-studio-se by Talend.
the class SelectPatternsWizard method performFinish.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
@Override
public boolean performFinish() {
Grid table = patternSelectPage.getTable();
GridColumn[] gridColumns = table.getColumns();
GridItem[] gridItems = table.getItems();
for (GridItem item : gridItems) {
for (GridColumn column : gridColumns) {
int columnIndex = table.indexOf(column);
if (!item.getChecked(columnIndex)) {
// allMatchIndicator.getAllChildIndicators().remove(((Map<?, ?>) item.getData()).get(columnIndex));
patternSelectPage.getTableInputList().get(table.indexOf(item)).put(columnIndex, null);
}
}
}
return true;
}
Aggregations