Search in sources :

Example 1 with KTableCellResizeListener

use of de.kupzog.ktable.KTableCellResizeListener in project translationstudio8 by heartsome.

the class QAResultViewPart method createTable.

public void createTable() {
    table = new KTable(parent, SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL | SWTX.FILL_WITH_LASTCOL | SWT.WRAP);
    tableModel = new KtableModel();
    table.setModel(tableModel);
    table.setLayoutData(new GridData(GridData.FILL_BOTH));
    table.setColorRightBorder(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    table.setColorLeftBorder(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    table.setColorTopBorder(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    table.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    table.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(MouseEvent e) {
            locationRow();
        }
    });
    table.addKeyListener(new KeyAdapter() {

        public void keyPressed(KeyEvent e) {
            if (e.keyCode == QAConstant.QA_CENTERKEY_1 || e.keyCode == QAConstant.QA_CENTERKEY_2) {
                locationRow();
            }
        }
    });
    table.addCellResizeListener(new KTableCellResizeListener() {

        public void rowResized(int arg0, int arg1) {
            tableModel.textRenderer.clearRowHeiMap();
            table.redraw();
        }

        public void columnResized(int arg0, int arg1) {
            tableModel.textRenderer.clearRowHeiMap();
            table.redraw();
        }
    });
    table.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            tableModel.textRenderer.clearRowHeiMap();
            table.redraw();
        }
    });
    table.addMouseWheelListener(new MouseWheelListener() {

        public void mouseScrolled(MouseEvent e) {
            tableModel.textRenderer.clearRowHeiMap();
            table.redraw();
        }
    });
    createPropMenu();
}
Also used : MouseEvent(org.eclipse.swt.events.MouseEvent) KTableCellResizeListener(de.kupzog.ktable.KTableCellResizeListener) ControlAdapter(org.eclipse.swt.events.ControlAdapter) KeyAdapter(org.eclipse.swt.events.KeyAdapter) MouseAdapter(org.eclipse.swt.events.MouseAdapter) MouseWheelListener(org.eclipse.swt.events.MouseWheelListener) KTable(de.kupzog.ktable.KTable) Point(org.eclipse.swt.graphics.Point) KeyEvent(org.eclipse.swt.events.KeyEvent) GridData(org.eclipse.swt.layout.GridData) ControlEvent(org.eclipse.swt.events.ControlEvent)

Aggregations

KTable (de.kupzog.ktable.KTable)1 KTableCellResizeListener (de.kupzog.ktable.KTableCellResizeListener)1 ControlAdapter (org.eclipse.swt.events.ControlAdapter)1 ControlEvent (org.eclipse.swt.events.ControlEvent)1 KeyAdapter (org.eclipse.swt.events.KeyAdapter)1 KeyEvent (org.eclipse.swt.events.KeyEvent)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 MouseWheelListener (org.eclipse.swt.events.MouseWheelListener)1 Point (org.eclipse.swt.graphics.Point)1 GridData (org.eclipse.swt.layout.GridData)1