Search in sources :

Example 1 with ViewerRow

use of org.eclipse.jface.viewers.ViewerRow in project cubrid-manager by CUBRID.

the class TableFocusCellManager method handleSelection.

/**
	 * 
	 * Handle the selection event
	 * 
	 * @param event Event
	 */
private void handleSelection(Event event) {
    if ((event.detail & SWT.CHECK) == 0 && focusCell != null && focusCell.getItem() != event.item && event.item != null && !event.item.isDisposed()) {
        ViewerRow row = viewer.getViewerRowByItem(event.item);
        ViewerCell tmp = row.getCell(focusCell.getColumnIndex());
        if (!focusCell.equals(tmp)) {
            setFocusCell(tmp);
        }
    }
}
Also used : ViewerRow(org.eclipse.jface.viewers.ViewerRow) ViewerCell(org.eclipse.jface.viewers.ViewerCell)

Example 2 with ViewerRow

use of org.eclipse.jface.viewers.ViewerRow in project cubrid-manager by CUBRID.

the class TableFocusCellManager method getInitialFocusCell.

/**
	 * 
	 * Get the initial focus cell
	 * 
	 * @return ViewerCell
	 */
public ViewerCell getInitialFocusCell() {
    Table table = (Table) getViewer().getControl();
    if (!table.isDisposed() && table.getItemCount() > 0 && !table.getItem(table.getTopIndex()).isDisposed()) {
        final ViewerRow aViewerRow = getViewer().getViewerRowByItem(table.getItem(table.getTopIndex()));
        if (table.getColumnCount() == 0) {
            return aViewerRow.getCell(0);
        }
        Rectangle clientArea = table.getClientArea();
        for (int i = 0; i < table.getColumnCount(); i++) {
            if (aViewerRow.getBounds(i).width > 0 && columnInVisibleArea(clientArea, aViewerRow, i))
                return aViewerRow.getCell(i);
        }
    }
    return null;
}
Also used : Table(org.eclipse.swt.widgets.Table) Rectangle(org.eclipse.swt.graphics.Rectangle) ViewerRow(org.eclipse.jface.viewers.ViewerRow) Point(org.eclipse.swt.graphics.Point)

Example 3 with ViewerRow

use of org.eclipse.jface.viewers.ViewerRow in project translationstudio8 by heartsome.

the class GridTableViewer method editElement.

/**
	 * {@inheritDoc}
	 */
public void editElement(Object element, int column) {
    try {
        getControl().setRedraw(false);
        Widget item = findItem(element);
        if (item != null) {
            ViewerRow row = getViewerRowFromItem(item);
            if (row != null) {
                ViewerCell cell = row.getCell(column);
                if (cell != null) {
                    triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(cell));
                }
            }
        }
    } finally {
        getControl().setRedraw(true);
    }
// }
}
Also used : Widget(org.eclipse.swt.widgets.Widget) ViewerRow(org.eclipse.jface.viewers.ViewerRow) ColumnViewerEditorActivationEvent(org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent) ViewerCell(org.eclipse.jface.viewers.ViewerCell)

Example 4 with ViewerRow

use of org.eclipse.jface.viewers.ViewerRow in project cubrid-manager by CUBRID.

the class TableFocusHighLighter method hookListener.

private void hookListener(final EditableTableViewer viewer) {
    Listener listener = new Listener() {

        public void handleEvent(Event event) {
            if ((event.detail & SWT.SELECTED) > 0) {
                ViewerCell focusCell = getFocusCell();
                ViewerRow row = viewer.getViewerRowByItem(event.item);
                ViewerCell cell = row.getCell(event.index);
                if (focusCell == null || !cell.equals(focusCell)) {
                    removeSelectionInformation(event, cell);
                } else {
                    markFocusedCell(event, cell);
                }
            }
        }
    };
    viewer.getControl().addListener(SWT.EraseItem, listener);
}
Also used : Listener(org.eclipse.swt.widgets.Listener) Event(org.eclipse.swt.widgets.Event) ViewerRow(org.eclipse.jface.viewers.ViewerRow) ViewerCell(org.eclipse.jface.viewers.ViewerCell)

Aggregations

ViewerRow (org.eclipse.jface.viewers.ViewerRow)4 ViewerCell (org.eclipse.jface.viewers.ViewerCell)3 ColumnViewerEditorActivationEvent (org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent)1 Point (org.eclipse.swt.graphics.Point)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1 Event (org.eclipse.swt.widgets.Event)1 Listener (org.eclipse.swt.widgets.Listener)1 Table (org.eclipse.swt.widgets.Table)1 Widget (org.eclipse.swt.widgets.Widget)1