/** * DOC sgandon Comment method "createActionColumn". * * @return */ public TableViewerCreatorColumn<ModuleToInstall, String> createActionColumn() { TableViewerCreatorColumn<ModuleToInstall, String> column = new TableViewerCreatorColumn<ModuleToInstall, String>(tableViewerCreator); column.setTitle( Messages.getString("ExternalModulesInstallDialog_AvailableOnTalendForge")); // $NON-NLS-1$ column.setToolTipHeader( Messages.getString("ExternalModulesInstallDialog_AvailableOnTalendForge")); // $NON-NLS-1$ column.setModifiable(false); column.setSortable(true); column.setWeight(5); // set bean property accessor to allow sort by download type (automatic or manual) column.setBeanPropertyAccessors( new IBeanPropertyAccessors<ModuleToInstall, String>() { @Override public String get(ModuleToInstall bean) { // use 2 invisible different values to allow sorting and have no visual impact when the // button is // selected return bean.getUrl_download() == null ? "" : " "; // $NON-NLS-1$//$NON-NLS-2$ } @Override public void set(ModuleToInstall bean, String value) { // read only } }); return column; }
/** DOC sgandon Comment method "createLicenseColumn". */ public void createLicenseColumn() { TableViewerCreatorColumn<ModuleToInstall, String> column = new TableViewerCreatorColumn<ModuleToInstall, String>(tableViewerCreator); column.setTitle( Messages.getString("ExternalModulesInstallDialog_ColumnLicense")); // $NON-NLS-1$ column.setToolTipHeader( Messages.getString("ExternalModulesInstallDialog_ColumnLicense")); // $NON-NLS-1$ column.setSortable(true); // set bean property accessor to allow sort by license name column.setBeanPropertyAccessors( new IBeanPropertyAccessors<ModuleToInstall, String>() { @Override public String get(ModuleToInstall bean) { return bean.getLicenseType(); } @Override public void set(ModuleToInstall bean, String value) { // read only } }); column.setModifiable(false); column.setWeight(3); }
/** * DOC sgandon Comment method "createMoreInformationColumn". * * @param composite * @return */ public TableViewerCreatorColumn<ModuleToInstall, String> createMoreInformationColumn() { TableViewerCreatorColumn<ModuleToInstall, String> column = new TableViewerCreatorColumn<ModuleToInstall, String>(tableViewerCreator); column.setTitle(Messages.getString("ExternalModulesInstallDialog_ColumnUrl")); // $NON-NLS-1$ column.setToolTipHeader( Messages.getString("ExternalModulesInstallDialog_ColumnUrl")); // $NON-NLS-1$ column.setModifiable(false); column.setSortable(true); column.setWeight(7); // set bean property accessor to allow sort by url name column.setBeanPropertyAccessors( new IBeanPropertyAccessors<ModuleToInstall, String>() { @Override public String get(ModuleToInstall bean) { return bean.getUrl_description() != null ? bean.getUrl_description() : ""; //$NON-NLS-1$ } @Override public void set(ModuleToInstall bean, String value) { // read only } }); return column; }
/** DOC sgandon Comment method "createContextColumn". */ public void createContextColumn() { TableViewerCreatorColumn<ModuleToInstall, String> column = new TableViewerCreatorColumn<ModuleToInstall, String>(tableViewerCreator); column.setSortable(true); column.setTitle( Messages.getString("ExternalModulesInstallDialog_ColumnRequiredBy")); // $NON-NLS-1$ column.setToolTipHeader( Messages.getString("ExternalModulesInstallDialog_ColumnRequiredBy")); // $NON-NLS-1$ column.setBeanPropertyAccessors( new IBeanPropertyAccessors<ModuleToInstall, String>() { @Override public String get(ModuleToInstall bean) { return bean.getContext(); } @Override public void set(ModuleToInstall bean, String value) { // read only column } }); column.setModifiable(false); column.setWeight(5); }
/** DOC sgandon Comment method "createJarNameColumn". */ public void createJarNameColumn() { TableViewerCreatorColumn<ModuleToInstall, String> column = new TableViewerCreatorColumn<ModuleToInstall, String>(tableViewerCreator); column.setTitle( Messages.getString("ExternalModulesInstallDialog_ColumnJarName")); // $NON-NLS-1$ column.setToolTipHeader( Messages.getString("ExternalModulesInstallDialog_ColumnJarName")); // $NON-NLS-1$ column.setBeanPropertyAccessors( new IBeanPropertyAccessors<ModuleToInstall, String>() { @Override public String get(ModuleToInstall bean) { return bean.getName(); } @Override public void set(ModuleToInstall bean, String value) { // read only } }); column.setSortable(true); tableViewerCreator.setDefaultSort(column, SORT.ASC); column.setWeight(5); column.setModifiable(false); }
private TableViewerCreatorColumn createValueColumn( TableViewerCreator<HashMap<String, Object>> tableViewerCreator) { TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator); column.setTitle("Value"); // $NON-NLS-1$ column.setBeanPropertyAccessors( new IBeanPropertyAccessors<HashMap<String, Object>, String>() { @Override public String get(HashMap<String, Object> bean) { return (String) bean.get(VALUE); } @Override public void set(HashMap<String, Object> bean, String value) { bean.put(VALUE, value); } }); column.setCellEditor(new TextCellEditor(tableViewerCreator.getTable())); column.setModifiable(true); column.setWeight(30); column.setMinimumWidth(50); column.setDefaultInternalValue(""); // $NON-NLS-1$ return column; }
private void configureIndexColumn(TableViewerCreator<IMetadataColumn> tableViewerCreator) { TableViewerCreatorColumn<IMetadataColumn, String> column = new TableViewerCreatorColumn<IMetadataColumn, String>(tableViewerCreator); column.setBeanPropertyAccessors( new IBeanPropertyAccessors<IMetadataColumn, String>() { @Override public void set(IMetadataColumn bean, String value) {} @Override public String get(IMetadataColumn bean) { if (bean instanceof MetadataColumnExt) { MetadataColumnExt columnExt = (MetadataColumnExt) bean; boolean indexed = (columnExt.getData().getIndexes() != null && columnExt.getData().getIndexes().size() > 0) || columnExt.getData().isAutoIndexed(); return indexed ? "*" : ""; } return ""; } }); column.setTitle("Indexed"); // TODO: Internationalize this column.setModifiable(false); column.setWidth(70); }
/** DOC sgandon Comment method "createREquiredColumn". */ public void createRequiredColumn() { TableViewerCreatorColumn<ModuleToInstall, Boolean> column = new TableViewerCreatorColumn<ModuleToInstall, Boolean>(tableViewerCreator); column.setTitle( Messages.getString("ExternalModulesInstallDialog_ColumnRequired")); // $NON-NLS-1$ column.setToolTipHeader( Messages.getString("ExternalModulesInstallDialog_ColumnRequired")); // $NON-NLS-1$ column.setDisplayedValue(""); // $NON-NLS-1$ column.setSortable(true); column.setImageProvider( new IColumnImageProvider<ModuleToInstall>() { @Override public Image getImage(ModuleToInstall bean) { if (bean.isRequired()) { return ImageProvider.getImage(EImage.CHECKED_ICON); } else { return ImageProvider.getImage(EImage.UNCHECKED_ICON); } } }); column.setBeanPropertyAccessors( new IBeanPropertyAccessors<ModuleToInstall, Boolean>() { @Override public Boolean get(ModuleToInstall bean) { return bean.isRequired(); } @Override public void set(ModuleToInstall bean, Boolean value) { // read only } }); column.setModifiable(false); column.setWeight(2); }
private void configureAutoIndexColumn( TableViewerCreator<IMetadataColumn> tableViewerCreator, Table table) { TableViewerCreatorColumn<IMetadataColumn, Boolean> column = new TableViewerCreatorColumn<IMetadataColumn, Boolean>(tableViewerCreator); column.setBeanPropertyAccessors( new IBeanPropertyAccessors<IMetadataColumn, Boolean>() { @Override public Boolean get(IMetadataColumn bean) { if (bean instanceof MetadataColumnExt) { MetadataColumnExt columnExt = (MetadataColumnExt) bean; return columnExt.getData().isAutoIndexed(); } return false; } @Override public void set(IMetadataColumn bean, Boolean value) { if (bean instanceof MetadataColumnExt) { MetadataColumnExt columnExt = (MetadataColumnExt) bean; columnExt.getData().setAutoIndexed(value); } } }); String title = "Auto indexed"; // TODO: Internationalize this column.setTitle(title); column.setToolTipHeader(title); column.setModifiable(true); column.setWidth(76); column.setDisplayedValue(""); column.setTableColumnSelectionListener( new CheckColumnSelectionListener(column, tableViewerCreator)); column.setImageHeader(ImageProvider.getImage(EImage.CHECKED_ICON)); CheckboxTableEditorContent checkbox = new CheckboxTableEditorContent(); checkbox.setToolTipText(title); column.setTableEditorContent(checkbox); }
/* * (non-Javadoc) * * @see * org.talend.commons.ui.swt.advanced.macrotable.AbstractExtendedTableViewer#createColumns(org.talend.commons.ui * .swt.tableviewer.TableViewerCreator, org.eclipse.swt.widgets.Table) */ @Override protected void createColumns( TableViewerCreator<ConceptTarget> tableViewerCreator, final Table table) { CellEditorValueAdapter intValueAdapter = new CellEditorValueAdapter() { @Override public Object getOriginalTypedValue(final CellEditor cellEditor, Object value) { try { return new Integer(value.toString()); } catch (Exception ex) { return null; } } @Override public Object getCellEditorTypedValue(final CellEditor cellEditor, Object value) { if (value != null) { return String.valueOf(value); } return ""; //$NON-NLS-1$ } }; // ////////////////////////////////////////////////////////////////////////////////////// // column for mouse selection TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator); column.setTitle(""); // $NON-NLS-1$ column.setDefaultInternalValue(""); // $NON-NLS-1$ column.setWidth(15); // ////////////////////////////////////////////////////////////////////////////////////// // X Path Query column = new TableViewerCreatorColumn(tableViewerCreator); xPathColumn = column; column.setTitle( Messages.getString("ExtractionFieldsWithXPathEditorView.columnTitle.xPath")); // $NON-NLS-1$ column.setBeanPropertyAccessors( new IBeanPropertyAccessors<ConceptTarget, String>() { public String get(ConceptTarget bean) { return bean.getRelativeLoopExpression(); } public void set(ConceptTarget bean, String value) { bean.setRelativeLoopExpression(value); } }); xPathCellEditor = new TextCellEditorWithProposal(tableViewerCreator.getTable(), SWT.NONE, column); column.setCellEditor(xPathCellEditor); xPathCellEditor.addListener( new DialogErrorForCellEditorListener(xPathCellEditor, column) { @Override public void newValidValueTyped( int itemIndex, Object previousValue, Object newValue, CELL_EDITOR_STATE state) { if (state == CELL_EDITOR_STATE.EDITING) { linker.onXPathValueChanged(table, newValue.toString(), itemIndex); } } @Override public String validateValue(String newValue, int beanPosition) { String currentLoopXPath = linker.getCurrentLoopXPath(); String value = null; if (newValue.trim().length() == 0) { return null; } else if (newValue.trim().startsWith("/")) { // $NON-NLS-1$ value = newValue; } else { value = currentLoopXPath + "/" + newValue; // $NON-NLS-1$ } return linker.validateXPathExpression(value); } }); column.setModifiable(true); column.setWeight(30); column.setMinimumWidth(50); column.setDefaultInternalValue(""); // $NON-NLS-1$ // ////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////// // Tag Name column = new TableViewerCreatorColumn(tableViewerCreator); column.setTitle( Messages.getString( "ExtractionFieldsWithXPathEditorView.columnTitle.columnName")); //$NON-NLS-1$ column.setBeanPropertyAccessors( new IBeanPropertyAccessors<ConceptTarget, String>() { public String get(ConceptTarget bean) { return bean.getTargetName(); } public void set(ConceptTarget bean, String value) { bean.setTargetName(value); } }); column.setModifiable(true); column.setWeight(10); column.setMinimumWidth(50); // column.setCellEditor(new TextCellEditor(table)); column.setDefaultInternalValue(""); // $NON-NLS-1$ final TextCellEditorWithProposal tagNameCellEditor = createTagNameEditor(tableViewerCreator, column); column.setCellEditor(tagNameCellEditor); }