Search in sources :

Example 1 with DefaultBorderConfiguration

use of de.jaret.util.ui.table.renderer.DefaultBorderConfiguration in project translationstudio8 by heartsome.

the class MultiLineListExample method createControls.

/**
     * Create the controls that compose the console test.
     * 
     */
protected void createControls() {
    GridLayout gl = new GridLayout();
    gl.numColumns = 1;
    _shell.setLayout(gl);
    GridData gd = new GridData(GridData.FILL_BOTH);
    _jt = new JaretTable(_shell, SWT.V_SCROLL);
    _jt.setLayoutData(gd);
    if (_tableModel == null) {
        DefaultJaretTableModel model = new PropListeningTableModel();
        model.addRow(new DummyRow("r1", "line 1", "line 2 adds more text", true, new Date(), MultiLineListExample.getImageRegistry().get("icon")));
        model.addRow(new DummyRow("r2", "another first line", "line 2 adds more text", true, new Date(), MultiLineListExample.getImageRegistry().get("icon")));
        model.addRow(new DummyRow("r3", "and yet another one", "line 2 adds more text", true, new Date(), MultiLineListExample.getImageRegistry().get("icon")));
        model.addRow(new DummyRow("r5", "4444444444", "line 2 adds more text", true, new Date(), MultiLineListExample.getImageRegistry().get("icon")));
        model.addRow(new DummyRow("r6", "555555555", "line 2 adds more text", true, new Date(), MultiLineListExample.getImageRegistry().get("icon")));
        model.addRow(new DummyRow("r7", "6666666666", "line 2 adds more text", true, new Date(), MultiLineListExample.getImageRegistry().get("icon")));
        model.addRow(new DummyRow("r8", "7777777777", "line 2 adds more text", true, new Date(), MultiLineListExample.getImageRegistry().get("icon")));
        model.addRow(new DummyRow("r9", "88888888888", "line 2 adds more text", true, new Date(), MultiLineListExample.getImageRegistry().get("icon")));
        PropCol ct1 = new PropCol("t1", "column 1", "T1");
        ct1.setEditable(false);
        model.addColumn(ct1);
        _tableModel = model;
    }
    DefaultCellStyle cs = (DefaultCellStyle) _jt.getTableViewState().getCellStyleProvider().getDefaultCellStyle().copy();
    cs.setBorderConfiguration(new DefaultBorderConfiguration(0, 0, 0, 0));
    _jt.getTableViewState().getCellStyleProvider().setColumnCellStyle(_tableModel.getColumn(0), cs);
    _jt.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.FIXED);
    // has to be replaced
    for (int i = 0; i < _tableModel.getRowCount(); i++) {
        _jt.getTableViewState().setRowHeight(_tableModel.getRow(i), 60);
    }
    // _jt.getTableViewState().setColumnResizeMode(ITableViewState.ColumnResizeMode.ALL);
    _jt.setHeaderHeight(0);
    _jt.registerCellRenderer(_tableModel.getColumn(0), new MultilineListCellRenderer());
    _jt.setTableModel(_tableModel);
    _jt.getTableViewState().setColumnWidth(_tableModel.getColumn(0), 230);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) DummyRow(de.jaret.examples.table.DummyRow) DefaultCellStyle(de.jaret.util.ui.table.renderer.DefaultCellStyle) PropCol(de.jaret.util.ui.table.model.PropCol) JaretTable(de.jaret.util.ui.table.JaretTable) DefaultJaretTableModel(de.jaret.util.ui.table.model.DefaultJaretTableModel) GridData(org.eclipse.swt.layout.GridData) PropListeningTableModel(de.jaret.util.ui.table.model.PropListeningTableModel) DefaultBorderConfiguration(de.jaret.util.ui.table.renderer.DefaultBorderConfiguration) Date(java.util.Date)

Aggregations

DummyRow (de.jaret.examples.table.DummyRow)1 JaretTable (de.jaret.util.ui.table.JaretTable)1 DefaultJaretTableModel (de.jaret.util.ui.table.model.DefaultJaretTableModel)1 PropCol (de.jaret.util.ui.table.model.PropCol)1 PropListeningTableModel (de.jaret.util.ui.table.model.PropListeningTableModel)1 DefaultBorderConfiguration (de.jaret.util.ui.table.renderer.DefaultBorderConfiguration)1 DefaultCellStyle (de.jaret.util.ui.table.renderer.DefaultCellStyle)1 Date (java.util.Date)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1