Search in sources :

Example 1 with TalendGridColumn

use of org.eclipse.nebula.widgets.grid.TalendGridColumn in project tdq-studio-se by Talend.

the class AbstractIndicatorSelectGrid method createIndicatorLabelColumn.

/**
 * This column just used to take in space so that visible is false
 */
protected void createIndicatorLabelColumn() {
    GridColumn indicatorLabelColumn = new TalendGridColumn(this, SWT.NONE);
    indicatorLabelColumn.setHeaderRenderer(getColumnHeaderRenderer());
    indicatorLabelColumn.setTree(true);
    indicatorLabelColumn.setWidth(200);
    // $NON-NLS-1$
    indicatorLabelColumn.setText("Indicators");
    // hide the label column, but it is actually visible in the fixed
    indicatorLabelColumn.setVisible(false);
}
Also used : TalendGridColumn(org.eclipse.nebula.widgets.grid.TalendGridColumn) GridColumn(org.eclipse.nebula.widgets.grid.GridColumn) TalendGridColumn(org.eclipse.nebula.widgets.grid.TalendGridColumn)

Example 2 with TalendGridColumn

use of org.eclipse.nebula.widgets.grid.TalendGridColumn in project tdq-studio-se by Talend.

the class AbstractIndicatorSelectGrid method initializeGrid.

protected void initializeGrid() {
    // first column is for indicator labels, it is hided from the cells but shown as row header.
    createIndicatorLabelColumn();
    // column
    // select all column
    createRowSelectColumn();
    // database columns
    for (int index = 0; index < _modelElementIndicators.length; index++) {
        ModelElementIndicator _modelElementIndicator = _modelElementIndicators[index];
        final GridColumn newCol = new TalendGridColumn(this, SWT.CHECK);
        AbstractColumnHerderRenderer headerRenderer = getColumnHeaderRenderer();
        headerRenderer.setRotation(COLUMN_HEADER_ROTATION);
        newCol.setHeaderRenderer(headerRenderer);
        newCol.setCellRenderer(getCellRenderer());
        newCol.setText(ModelElementIndicatorHelper.getModelElementDisplayName(_modelElementIndicator));
        newCol.setWidth(getPreferWidth(index));
        newCol.setData(_modelElementIndicator);
        newCol.setMoveable(true);
        newCol.setResizeable(true);
        newCol.setHeaderFont(headerFont);
        IRepositoryNode repNode = _modelElementIndicator.getModelElementRepositoryNode();
        if (repNode instanceof DBColumnRepNode && ((DBColumnRepNode) repNode).isKey()) {
            newCol.setImage(ImageLib.getImage(ImageLib.PK_ICON));
        }
        newCol.addListener(SWT.Resize, new Listener() {

            public void handleEvent(Event event) {
                notifyObservers(event);
            }
        });
        newCol.addListener(SWT.Move, new Listener() {

            public void handleEvent(Event event) {
                notifyObservers(event);
                isColumnMoved = true;
            }
        });
    }
    recalculateHeader();
    // initialize grid contents
    createTableContent();
    // show fixed column header
    setHeaderVisible(true);
    setTopLeftRenderer(new TdTopLeftRenderer());
    // setCellHeaderSelectionBackground(IndicatorSelectGrid.standardYellow);
    setEmptyColumnHeaderRenderer(new TdEmptyColumnHeaderRenderer());
    setEmptyRowHeaderRenderer(new TdEmptyCellRenderer());
    setEmptyCellRenderer(new TdEmptyCellRenderer());
    // show fixed row header
    TdRowHeaderRenderer rowHeaderRenderer = new TdRowHeaderRenderer();
    setRowHeaderRenderer(rowHeaderRenderer);
    rowHeaderRenderer.setTree(true);
    rowHeaderRenderer.setWordWrap(false);
    setRowHeaderVisible(true);
    setLinesVisible(true);
    setColumnScrolling(true);
    setSelectionEnabled(false);
    setCellSelectionEnabled(false);
    setRowsResizeable(false);
    setItemHeight(21);
    setLineColor(lineColor);
    setFont(itemFont);
    setFocusRenderer(null);
    for (GridItem gridItem : getItems()) {
        gridItem.setBackground(0, gray);
    }
}
Also used : MouseMoveListener(org.eclipse.swt.events.MouseMoveListener) Listener(org.eclipse.swt.widgets.Listener) MouseListener(org.eclipse.swt.events.MouseListener) IRepositoryNode(org.talend.repository.model.IRepositoryNode) TalendGridColumn(org.eclipse.nebula.widgets.grid.TalendGridColumn) DBColumnRepNode(org.talend.dq.nodes.DBColumnRepNode) Point(org.eclipse.swt.graphics.Point) TalendGridItem(org.eclipse.nebula.widgets.grid.TalendGridItem) GridItem(org.eclipse.nebula.widgets.grid.GridItem) Event(org.eclipse.swt.widgets.Event) MouseEvent(org.eclipse.swt.events.MouseEvent) TalendGridColumn(org.eclipse.nebula.widgets.grid.TalendGridColumn) GridColumn(org.eclipse.nebula.widgets.grid.GridColumn) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 3 with TalendGridColumn

use of org.eclipse.nebula.widgets.grid.TalendGridColumn in project tdq-studio-se by Talend.

the class AbstractIndicatorSelectGrid method createRowSelectColumn.

/**
 * This column just used to take in space so that visible is false
 */
protected void createRowSelectColumn() {
    GridColumn rowSelectCol = new TalendGridColumn(this, SWT.CHECK);
    rowSelectCol.setHeaderRenderer(getColumnHeaderRenderer());
    rowSelectCol.setCellRenderer(getCellRenderer());
    // $NON-NLS-1$
    rowSelectCol.setText("Select All");
    rowSelectCol.setWidth(COLUMN_WIDTH);
    rowSelectCol.setWordWrap(true);
    rowSelectCol.setCellSelectionEnabled(true);
    // hide the row select column, it is also visible in the fixed column.
    rowSelectCol.setVisible(false);
}
Also used : TalendGridColumn(org.eclipse.nebula.widgets.grid.TalendGridColumn) GridColumn(org.eclipse.nebula.widgets.grid.GridColumn) TalendGridColumn(org.eclipse.nebula.widgets.grid.TalendGridColumn)

Aggregations

GridColumn (org.eclipse.nebula.widgets.grid.GridColumn)3 TalendGridColumn (org.eclipse.nebula.widgets.grid.TalendGridColumn)3 GridItem (org.eclipse.nebula.widgets.grid.GridItem)1 TalendGridItem (org.eclipse.nebula.widgets.grid.TalendGridItem)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 MouseListener (org.eclipse.swt.events.MouseListener)1 MouseMoveListener (org.eclipse.swt.events.MouseMoveListener)1 Point (org.eclipse.swt.graphics.Point)1 Event (org.eclipse.swt.widgets.Event)1 Listener (org.eclipse.swt.widgets.Listener)1 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)1 DBColumnRepNode (org.talend.dq.nodes.DBColumnRepNode)1 IRepositoryNode (org.talend.repository.model.IRepositoryNode)1