Search in sources :

Example 81 with TableViewerColumn

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

the class TermDbManagerDialog method createTableViewerColumn.

/**
	 * 设置TableViewer 列属性
	 * @param viewer
	 * @param title
	 *            列标题
	 * @param bound
	 *            列宽
	 * @param colNumber
	 *            列序号
	 * @return {@link TableViewerColumn};
	 */
private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) {
    final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize);
    final TableColumn column = viewerColumn.getColumn();
    column.setText(title);
    column.setWidth(bound);
    column.setResizable(true);
    column.setMoveable(true);
    return viewerColumn;
}
Also used : TableColumn(org.eclipse.swt.widgets.TableColumn) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 82 with TableViewerColumn

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

the class ProjectSettingTMPage method createColumn.

/**
	 * 创建Table列
	 * @param viewer
	 *            ;
	 */
private void createColumn(final TableViewer viewer) {
    String[] clmnTitles = { Messages.getString("projectsetting.ProjectSettingTMPage.clmnTitles1"), Messages.getString("projectsetting.ProjectSettingTMPage.clmnTitles2"), Messages.getString("projectsetting.ProjectSettingTMPage.clmnTitles3"), Messages.getString("projectsetting.ProjectSettingTMPage.clmnTitles4"), Messages.getString("projectsetting.ProjectSettingTMPage.clmnTitles5") };
    int[] clmnBounds = { 100, 100, 200, 90, 70 };
    TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0);
    col.setLabelProvider(new ColumnLabelProvider() {

        public String getText(Object element) {
            DatabaseModelBean dbModel = (DatabaseModelBean) element;
            return dbModel.getDbName();
        }
    });
    col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1);
    col.setLabelProvider(new ColumnLabelProvider() {

        public String getText(Object element) {
            DatabaseModelBean dbModel = (DatabaseModelBean) element;
            String dbType = dbModel.getDbType();
            if (dbType.equals(Constants.DBTYPE_MYSQL)) {
                dbType = Constants.DBTYPE_MYSQL_FOR_UI;
            } else if (dbType.equals(Constants.DBTYPE_MSSQL2005)) {
                dbType = Constants.DBTYPE_MSSQL2005_FOR_UI;
            } else if (dbType.equals(Constants.DBTYPE_SQLITE)) {
                dbType = Messages.getString("tm.dbtype.sqlite");
            }
            return dbType;
        }
    });
    col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2);
    col.setLabelProvider(new ColumnLabelProvider() {

        public String getText(Object element) {
            DatabaseModelBean dbModel = (DatabaseModelBean) element;
            if (dbModel.getDbType().equals("Internal DB") || dbModel.getDbType().equals("SQLite")) {
                return dbModel.getItlDBLocation();
            }
            return dbModel.getHost();
        }
    });
    col = createTableViewerColumn(viewer, clmnTitles[3], clmnBounds[3], 3);
    col.setLabelProvider(new ColumnLabelProvider() {

        public String getText(Object element) {
            DatabaseModelBean dbModel = (DatabaseModelBean) element;
            if (dbModel.isHasMatch()) {
                return Messages.getString("projectsetting.ProjectSettingTMPage.yes");
            } else {
                return Messages.getString("projectsetting.ProjectSettingTMPage.no");
            }
        }
    });
    col = createTableViewerColumn(viewer, clmnTitles[4], clmnBounds[4], 4);
    col.setLabelProvider(new ColumnLabelProvider() {

        public Image getImage(Object element) {
            DatabaseModelBean dbModel = (DatabaseModelBean) element;
            if (dbModel.isDefault()) {
                return checkedImage;
            } else {
                return uncheckedImage;
            }
        }

        public String getText(Object element) {
            return null;
        }
    });
    col.setEditingSupport(new ReadableEditingSupport(viewer));
}
Also used : ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) DatabaseModelBean(net.heartsome.cat.common.bean.DatabaseModelBean) Image(org.eclipse.swt.graphics.Image) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 83 with TableViewerColumn

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

the class ProjectSettingTMPage method createTableViewerColumn.

/**
	 * 设置TableViewer 列属性
	 * @param viewer
	 * @param title
	 *            列标题
	 * @param bound
	 *            列宽
	 * @param colNumber
	 *            列序号
	 * @return {@link TableViewerColumn};
	 */
private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) {
    final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize);
    final TableColumn column = viewerColumn.getColumn();
    column.setText(title);
    column.setWidth(bound);
    column.setResizable(true);
    column.setMoveable(true);
    return viewerColumn;
}
Also used : TableColumn(org.eclipse.swt.widgets.TableColumn) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 84 with TableViewerColumn

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

the class NewProjectTmPage method createTableViewerColumn.

/**
	 * 设置TableViewer 列属性
	 * @param viewer
	 * @param title
	 *            列标题
	 * @param bound
	 *            列宽
	 * @param colNumber
	 *            列序号
	 * @return {@link TableViewerColumn};
	 */
private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) {
    final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize);
    final TableColumn column = viewerColumn.getColumn();
    column.setText(title);
    column.setWidth(bound);
    column.setResizable(true);
    column.setMoveable(true);
    return viewerColumn;
}
Also used : TableColumn(org.eclipse.swt.widgets.TableColumn) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 85 with TableViewerColumn

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

the class NewProjectTmPage method createColumn.

/**
	 * 创建Table列
	 * @param viewer
	 *            ;
	 */
private void createColumn(final TableViewer viewer) {
    String[] clmnTitles = { Messages.getString("newproject.NewProjectTmPage.clmnTitles1"), Messages.getString("newproject.NewProjectTmPage.clmnTitles2"), Messages.getString("newproject.NewProjectTmPage.clmnTitles3"), Messages.getString("newproject.NewProjectTmPage.clmnTitles4"), Messages.getString("newproject.NewProjectTmPage.clmnTitles5") };
    int[] clmnBounds = { 100, 100, 200, 90, 70 };
    TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0);
    col.setLabelProvider(new ColumnLabelProvider() {

        public String getText(Object element) {
            DatabaseModelBean dbModel = (DatabaseModelBean) element;
            return dbModel.getDbName();
        }
    });
    col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1);
    col.setLabelProvider(new ColumnLabelProvider() {

        public String getText(Object element) {
            DatabaseModelBean dbModel = (DatabaseModelBean) element;
            if (dbModel.getDbType().equals(Constants.DBTYPE_SQLITE)) {
                return Messages.getString("tm.dbtype.sqlite");
            }
            return dbModel.getDbType();
        }
    });
    col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2);
    col.setLabelProvider(new ColumnLabelProvider() {

        public String getText(Object element) {
            DatabaseModelBean dbModel = (DatabaseModelBean) element;
            if (dbModel.getDbType().equals(Constants.DBTYPE_INTERNALDB) || dbModel.getDbType().equals(Constants.DBTYPE_SQLITE)) {
                return dbModel.getItlDBLocation();
            }
            return dbModel.getHost();
        }
    });
    col = createTableViewerColumn(viewer, clmnTitles[3], clmnBounds[3], 3);
    col.setLabelProvider(new ColumnLabelProvider() {

        public String getText(Object element) {
            DatabaseModelBean dbModel = (DatabaseModelBean) element;
            if (dbModel.isHasMatch()) {
                return Messages.getString("newproject.NewProjectTmPage.yes");
            } else {
                return Messages.getString("newproject.NewProjectTmPage.no");
            }
        }
    });
    col = createTableViewerColumn(viewer, clmnTitles[4], clmnBounds[4], 4);
    col.setLabelProvider(new ColumnLabelProvider() {

        public Image getImage(Object element) {
            DatabaseModelBean dbModel = (DatabaseModelBean) element;
            if (dbModel.isDefault()) {
                return checkedImage;
            } else {
                return uncheckedImage;
            }
        }

        public String getText(Object element) {
            return null;
        }
    });
    col.setEditingSupport(new ReadableEditingSupport(viewer));
}
Also used : ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) DatabaseModelBean(net.heartsome.cat.common.bean.DatabaseModelBean) Image(org.eclipse.swt.graphics.Image) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Aggregations

TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)134 TableViewer (org.eclipse.jface.viewers.TableViewer)72 Composite (org.eclipse.swt.widgets.Composite)53 GridData (org.eclipse.swt.layout.GridData)52 SelectionEvent (org.eclipse.swt.events.SelectionEvent)45 TableColumn (org.eclipse.swt.widgets.TableColumn)41 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)36 GridLayout (org.eclipse.swt.layout.GridLayout)32 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)28 Table (org.eclipse.swt.widgets.Table)25 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)19 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)16 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)16 Point (org.eclipse.swt.graphics.Point)15 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)14 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)14 FillLayout (org.eclipse.swt.layout.FillLayout)14 Button (org.eclipse.swt.widgets.Button)14 Image (org.eclipse.swt.graphics.Image)13 Text (org.eclipse.swt.widgets.Text)11