Search in sources :

Example 6 with Index

use of org.talend.designer.neo4j.data.Index in project tbd-studio-se by Talend.

the class IndexTableView method createIndexUniqueColumn.

private void createIndexUniqueColumn(TableViewerCreator<Index> tableViewerCreator, Table table) {
    TableViewerCreatorColumn<Index, Boolean> column = new TableViewerCreatorColumn<Index, Boolean>(tableViewerCreator);
    column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Index, Boolean>() {

        @Override
        public Boolean get(Index bean) {
            return bean.isUnique();
        }

        @Override
        public void set(Index bean, Boolean value) {
            bean.setUnique(value);
        }
    });
    column.setTitle("Unique");
    column.setModifiable(true);
    column.setWidth(60);
    column.setImageProvider(new IColumnImageProvider<Index>() {

        @Override
        public Image getImage(Index bean) {
            if (bean.isUnique()) {
                return ImageProvider.getImage(EImage.CHECKED_ICON);
            } else {
                return ImageProvider.getImage(EImage.UNCHECKED_ICON);
            }
        }
    });
    column.setDisplayedValue("");
    column.setCellEditor(new CheckboxCellEditor(table));
}
Also used : CheckboxCellEditor(org.eclipse.jface.viewers.CheckboxCellEditor) Index(org.talend.designer.neo4j.data.Index) TableViewerCreatorColumn(org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn) EImage(org.talend.commons.ui.runtime.image.EImage) Image(org.eclipse.swt.graphics.Image)

Example 7 with Index

use of org.talend.designer.neo4j.data.Index in project tbd-studio-se by Talend.

the class IndexTableView method createIndexKeyColumn.

private void createIndexKeyColumn(TableViewerCreator<Index> tableViewerCreator, final Table table) {
    TableViewerCreatorColumn<Index, String> column = new TableViewerCreatorColumn<Index, String>(tableViewerCreator);
    // TODO: Internationalize this
    column.setTitle("Key");
    column.setModifiable(true);
    column.setWidth(115);
    column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Index, String>() {

        @Override
        public String get(Index bean) {
            return bean.getKey() == null ? "" : bean.getKey();
        }

        @Override
        public void set(Index bean, String value) {
            bean.setKey(value);
        }
    });
    column.setCellEditor(new TextCellEditor(table));
}
Also used : Index(org.talend.designer.neo4j.data.Index) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewerCreatorColumn(org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn)

Aggregations

Index (org.talend.designer.neo4j.data.Index)7 TableViewerCreatorColumn (org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn)4 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)3 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)2 Relationship (org.talend.designer.neo4j.data.Relationship)2 MetadataColumnExt (org.talend.designer.neo4j.ui.editor.MetadataColumnExt)2 HashMap (java.util.HashMap)1 List (java.util.List)1 CheckboxCellEditor (org.eclipse.jface.viewers.CheckboxCellEditor)1 Image (org.eclipse.swt.graphics.Image)1 TableItem (org.eclipse.swt.widgets.TableItem)1 EImage (org.talend.commons.ui.runtime.image.EImage)1 MetadataColumn (org.talend.core.model.metadata.MetadataColumn)1 MetadataTable (org.talend.core.model.metadata.MetadataTable)1 Neo4jData (org.talend.designer.neo4j.data.Neo4jData)1