Search in sources :

Example 21 with GridColumn

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);
        }
    }
}
Also used : TalendGridItem(org.eclipse.nebula.widgets.grid.TalendGridItem) GridColumn(org.eclipse.nebula.widgets.grid.GridColumn) Point(org.eclipse.swt.graphics.Point)

Example 22 with GridColumn

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);
        }
    }
}
Also used : GridColumn(org.eclipse.nebula.widgets.grid.GridColumn) Point(org.eclipse.swt.graphics.Point) ObserverEvent(org.talend.dataprofiler.core.ui.grid.utils.events.ObserverEvent)

Example 23 with GridColumn

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);
    }
}
Also used : GridColumn(org.eclipse.nebula.widgets.grid.GridColumn) ObserverEvent(org.talend.dataprofiler.core.ui.grid.utils.events.ObserverEvent)

Example 24 with GridColumn

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);
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) GridLayout(org.eclipse.swt.layout.GridLayout) GridTableViewer(org.eclipse.nebula.jface.gridviewer.GridTableViewer) GridData(org.eclipse.swt.layout.GridData) GridColumn(org.eclipse.nebula.widgets.grid.GridColumn)

Example 25 with GridColumn

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;
}
Also used : GridItem(org.eclipse.nebula.widgets.grid.GridItem) Grid(org.eclipse.nebula.widgets.grid.Grid) GridColumn(org.eclipse.nebula.widgets.grid.GridColumn)

Aggregations

GridColumn (org.eclipse.nebula.widgets.grid.GridColumn)45 Point (org.eclipse.swt.graphics.Point)38 GridItem (org.eclipse.nebula.widgets.grid.GridItem)16 Rectangle (org.eclipse.swt.graphics.Rectangle)14 TalendGridColumn (org.eclipse.nebula.widgets.grid.TalendGridColumn)7 GC (org.eclipse.swt.graphics.GC)7 TalendGridItem (org.eclipse.nebula.widgets.grid.TalendGridItem)6 GridData (org.eclipse.swt.layout.GridData)6 Color (org.eclipse.swt.graphics.Color)5 Image (org.eclipse.swt.graphics.Image)5 GridLayout (org.eclipse.swt.layout.GridLayout)5 Grid (org.eclipse.nebula.widgets.grid.Grid)4 DisposeEvent (org.eclipse.swt.events.DisposeEvent)4 DisposeListener (org.eclipse.swt.events.DisposeListener)4 TextLayout (org.eclipse.swt.graphics.TextLayout)4 Composite (org.eclipse.swt.widgets.Composite)4 Event (org.eclipse.swt.widgets.Event)4 Listener (org.eclipse.swt.widgets.Listener)4 GridCellRenderer (org.eclipse.nebula.widgets.grid.GridCellRenderer)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3