private void checkSelection(final Table table) { TableItem[] items = table.getSelection(); if (items != null && items.length > 0) { for (TableItem item: items) { Plugin plugin = (Plugin) item.getData(); if (plugin != null) { if (source.stream().anyMatch(p -> p.equals(plugin))) { btnSelect.setEnabled(true); } else if (target.stream().anyMatch(p -> p.equals(plugin))) { btnDeselect.setEnabled(true); } return; } } } btnSelect.setEnabled(false); btnDeselect.setEnabled(false); }
/** * Gets the conditional operator modify listener. * * @param conditionsList * the conditions list * @param fieldsAndTypes * the fields and types * @param fieldNames * the field names * @param saveButton * the save button * @param displayButton * the display button * @return the conditional operator modify listener */ public ModifyListener getConditionalOperatorModifyListener(final List<Condition> conditionsList, final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) { ModifyListener listener = new ModifyListener() { @Override public void modifyText(ModifyEvent e) { CCombo source = (CCombo) e.getSource(); TableItem tableItem = getTableItem(source); Condition condition = (Condition) tableItem.getData(); if (tableItem.getData(FilterConstants.VALUE2TEXTBOX) != null) { Text text = (Text) tableItem.getData(FilterConstants.VALUE2TEXTBOX); enableAndDisableValue2TextBox(condition.getConditionalOperator(), text); } processConditionalOperator(source, conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton); } }; return listener; }
public List<ACL> getZnodeAclFromTable() { Table table = getTable(); TableItem[] items = table.getItems(); Set<ACL> aclSet = new HashSet<ACL>(items.length); for (TableItem item : items) { int perms = getItemPerms(item); Id id = getItemId(item); ACL acl = new ACL(perms, id); aclSet.add(acl); } return new ArrayList<ACL>(aclSet); }
private void tableSelectionChanged(TableItem item) { Button setIdButton = getSetIdButton(); setIdButton.setEnabled(SCHEME_DIGEST.equals(item.getText(TABLE_COLUMN_SCHEME))); Button removeButton = getRemoveButton(); removeButton.setEnabled(item != null); initSchemeTableEditor(item); initIdTableEditor(item); Control idEditor = _IdTableEditor.getEditor(); if (idEditor != null && !idEditor.isDisposed()) { idEditor.setFocus(); } }
private int getItemPerms(TableItem item) { int perms = 0; Button allCheckBox = getItemPermCheckBox(item, ZooDefs.Perms.ALL); if (allCheckBox.getSelection()) { perms = ZooDefs.Perms.ALL; } else { for (int perm : PERMS) { Button permCheckBox = getItemPermCheckBox(item, perm); if (permCheckBox.getSelection()) { perms |= perm; } } } return perms; }
/** * TODO: Comment. * */ protected void initPropertiesSectionFromModel() { Table table = getPropertiesSectionTable(); table.removeAll(); Map<String, String> properties = getZooKeeperConnectionProperties(); for (String key : properties.keySet()) { TableItem item = new TableItem(table, SWT.NONE); String value = properties.get(key); item.setText(0, key); item.setText(1, value); } packTable(table, PROPERTIES_COLUMN_WIDTHS); }
protected void initDescriptorSectionFromModel() { Descriptor descriptor = getJmxDescriptor(); if (descriptor == null) { return; } Table table = getDescriptorTable(); if (table == null) { return; } table.removeAll(); for (String fieldName : descriptor.getFieldNames()) { TableItem item = new TableItem(table, SWT.NONE); Object value = descriptor.getFieldValue(fieldName); item.setText(0, fieldName); item.setText(1, String.valueOf(value)); } packTable(table, DEFAULT_NAME_VALUE_COLUMN_WIDTHS); }
@Override protected void initPrimarySectionFromModel() { Table table = getPrimaryTable(); table.removeAll(); MBeanAttributeModel model = getModel(); MBeanAttribute attribute = model.getData(); String valueString = attribute.getValueAsString(); String valueError = attribute.getValueRetrievalErrorMessage(); TableItem item = new TableItem(table, SWT.NONE); item.setText(0, attribute.getName()); if (valueError != null) { item.setText(1, valueError); item.setForeground(1, table.getDisplay().getSystemColor(SWT.COLOR_RED)); } else { item.setText(1, valueString); } packTable(table, DEFAULT_NAME_VALUE_COLUMN_WIDTHS); }
@Override protected void initInfoSectionFromModel() { Table table = getInfoTable(); table.removeAll(); MBeanFeatureInfo featureInfo = getFeatureInfo(); TableItem nameItem = new TableItem(table, SWT.NONE); nameItem.setText(0, FEATURE_INFO_PROPERTY_NAME_NAME); nameItem.setText(1, featureInfo.getName()); TableItem descriptionItem = new TableItem(table, SWT.NONE); descriptionItem.setText(0, FEATURE_INFO_PROPERTY_NAME_DESCRIPTION); descriptionItem.setText(1, featureInfo.getDescription()); }
@Override public void setVisible ( final boolean visible ) { super.setVisible ( visible ); if ( visible ) { final Object[] data = this.mergeController.makeKnownFactories ().toArray (); this.factoriesViewer.setInput ( data ); final Set<String> factories = this.mergeController.getIgnoreFactories (); // select all for ( final TableItem item : this.factoriesViewer.getTable ().getItems () ) { item.setChecked ( factories.contains ( item.getData () ) ); } // set ignore fields this.fieldsViewer.setInput ( this.mergeController.getIgnoreFields () ); } }
public List<DecoratedMonitor> selectedMonitors () { if ( this.tableRef.get ().getTable ().getSelectionCount () == 0 ) { return new ArrayList<DecoratedMonitor> (); } final List<DecoratedMonitor> result = new ArrayList<DecoratedMonitor> (); for ( final TableItem row : this.tableRef.get ().getTable ().getSelection () ) { if ( row.getData () instanceof DecoratedMonitor ) { result.add ( (DecoratedMonitor)row.getData () ); } } return result; }
/** * Delete the currently selected files. */ protected void deleteFile() { TableItem[] selection = fileTable.getSelection(); String message = (selection.length > 1) ? textBundle.get("DeletePromptMultipleFiles") : //$NON-NLS-1$ textBundle.get("DeletePromptSingleFile") //$NON-NLS-1$ + textBundle.get("DeletePromptTrailer"); //$NON-NLS-1$ int answer = SwtUtil.showYesNoDialog(shell, textBundle.get("DeletePromptTitle"), //$NON-NLS-1$ message); if (answer == SWT.YES) { for (int i=0; i<selection.length; i++) { TableItem tableItem = selection[i]; FileEntry fileEntry = (FileEntry) tableItem.getData(); fileEntry.delete(); } fillFileTable(currentFileList); saveToolItem.setEnabled(true); } }
/** * Refresh the table of information. */ protected void refreshTable() { fileTable.removeAll(); Iterator specs = wizard.getImportSpecifications().iterator(); boolean canFinish = specs.hasNext(); while (specs.hasNext()) { ImportSpecification spec = (ImportSpecification) specs.next(); File file = new File(spec.getSourceFilename()); TableItem item = new TableItem(fileTable, SWT.NULL); item.setText(new String[] { file.getName(), spec.getTargetFilename(), spec.getFiletype() }); item.setData(spec); canFinish &= spec.hasFiletype(); } fileTable.redraw(); wizard.enableFinishButton(canFinish); }
/** * @param context * @return * @throws CoreException */ public OffLinePostConversionImpl createConvertor(ResourceContext context) throws CoreException { List<BuildPolicy> selected = new ArrayList<BuildPolicy>(); TableItem[] items = buildPoliciesViewer.getTable().getItems(); for (TableItem tableItem : items) { if (tableItem.getChecked()) { selected.add((BuildPolicy) tableItem.getData()); } } BuildPolicy[] policies = new BuildPolicy[selected.size()]; selected.toArray(policies); ResourceContext ctx = new ResourceContext( context.getContainerFullPath(), gcc.getRoot(), gcc.getPackageFragment(), gcc.getClassName(), gcc.getExtendedClassName(), context.getSelectedFile(), gcc.getMode(), context.getClassExtension()); return new OffLinePostConversionImpl(ctx, policies, Integer.parseInt(timeoutText.getText())); }
private void addButtonInTable(TableViewer tableViewer, TableItem tableItem, String columnName, String buttonPaneName, String editorName, int columnIndex, SelectionListener buttonSelectionListener, ImagePathConstant imagePath) { final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE); buttonPane.setLayout(new FillLayout()); final Button button = new Button(buttonPane, SWT.NONE); //button.setText(columnName); button.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem)); tableItem.setData(columnName, button); tableItem.setData(buttonPaneName, buttonPane); button.addSelectionListener(buttonSelectionListener); button.setImage(imagePath.getImageFromRegistry()); final TableEditor editor = new TableEditor(tableViewer.getTable()); editor.grabHorizontal = true; editor.grabVertical = true; editor.setEditor(buttonPane, tableItem, columnIndex); editor.layout(); button.setData(editorName, editor); }
private void addListnersToSearchTextBox() { searchTextBox.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { if(!StringUtils.equals(Constants.DEFAULT_SEARCH_TEXT, searchTextBox.getText())){ table.removeAll(); for(String field:inputFields){ if(StringUtils.containsIgnoreCase(field,searchTextBox.getText())){ TableItem tableItem = new TableItem(table, SWT.NONE); tableItem.setText(0,field); tableItem.setText(1, fieldMap.get(field).getSimpleName()); } } if(table.getItemCount()==0 && StringUtils.isNotBlank(searchTextBox.getText())){ new TableItem(table, SWT.NONE).setText(Messages.CANNOT_SEARCH_INPUT_STRING+searchTextBox.getText()); } } } }); }
private CCombo addComboInTable(TableViewer tableViewer, TableItem tableItem, String comboName, String comboPaneName, String editorName, int columnIndex, String[] relationalOperators, SelectionListener dropDownSelectionListener, ModifyListener modifyListener,FocusListener focusListener) { final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE); buttonPane.setLayout(new FillLayout()); final CCombo combo = new CCombo(buttonPane, SWT.NONE); combo.setItems(relationalOperators); combo.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem)); tableItem.setData(comboName, combo); tableItem.setData(comboPaneName, buttonPane); combo.addSelectionListener(dropDownSelectionListener); combo.addModifyListener(modifyListener); combo.addFocusListener(focusListener); new AutoCompleteField(combo, new CComboContentAdapter(), combo.getItems()); final TableEditor editor = new TableEditor(tableViewer.getTable()); editor.grabHorizontal = true; editor.grabVertical = true; editor.setEditor(buttonPane, tableItem, columnIndex); editor.layout(); combo.setData(editorName, editor); return combo; }
private void setRedColorOnTableRowBasedOnInvalidData(GridRow gridRow, String componentType, TableItem tableItem){ if(!gridRow.getFieldName().matches(Constants.REGEX)){ setRedColor(tableItem); } else if(gridRow instanceof FixedWidthGridRow){ if(gridRow instanceof GenerateRecordSchemaGridRow){ executeIfObjectIsGenerateRecordRow(gridRow, componentType, tableItem); }else{ executeIfObjectIsFixedWidthRow(gridRow, componentType, tableItem); } } else if(gridRow instanceof GridRow){ validationCheckForBigDecimalAndDateDatatype(gridRow, componentType, tableItem); if(!isRowInvalid) { if(gridRow instanceof XPathGridRow){ validationCheckForXpathGridRow(gridRow,tableItem); } } } }
private void checkIfXPathIsDuplicate( ) { Text loopXpathQueryTextBox=(Text)table.getData(); String loopXPathQuery=loopXpathQueryTextBox.getText(); Set<Path> setToCheckDuplicates= new HashSet<Path>(); Set<String> uniqueName=new HashSet<>(); for(TableItem tableItem:table.getItems()){ Path xPathColumn=makeXPathAbsoluteIfNot(tableItem.getText(2), loopXPathQuery); if(!uniqueName.add(tableItem.getText(0))){ tableItem.setData(Constants.ERROR_MESSAGE,FIELD_IS_DUPLICATE); setRedColor(tableItem); } else if(!setToCheckDuplicates.add(xPathColumn)){ tableItem.setData(Constants.ERROR_MESSAGE,Messages.X_PATH_IS_DUPLICATE); setRedColor(tableItem); } else{ tableItem.setData(Constants.ERROR_MESSAGE,""); setBlackColor(tableItem); } } }
@Override public void update(ViewerCell cell) { TableItem item = (TableItem) cell.getItem(); Pattern pattern = Pattern.compile("^[a-zA-Z0-9 _]*$"); if (!pattern.matcher(((InputField)cell.getElement()).getFieldName()).matches()) { item.setBackground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); item.setForeground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_RED)); ((InputField)cell.getElement()).getErrorObject().setErrorMessage("Input field should match regular expression- \"^[a-zA-Z0-9_]*$\" "); ((InputField)cell.getElement()).getErrorObject().setHasError(true); }else{ if(((InputField)cell.getElement()).getFieldName().trim().equalsIgnoreCase("")){ item.setBackground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_RED)); ((InputField)cell.getElement()).getErrorObject().setErrorMessage("Input field should not be empty"); ((InputField)cell.getElement()).getErrorObject().setHasError(true); }else{ ((InputField)cell.getElement()).getErrorObject().setHasError(false); } } super.update(cell); }
private void addCheckButtonInTable(TableViewer tableViewer, TableItem tableItem, String columnName, String groupPaneName, String editorName, int columnIndex, SelectionListener buttonSelectionListener) { final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE); buttonPane.setLayout(new FillLayout()); final Button button = new Button(buttonPane, SWT.CHECK); button.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem)); if(null != buttonSelectionListener){ button.addSelectionListener(buttonSelectionListener); } tableItem.setData(columnName, button); tableItem.setData(groupPaneName, buttonPane); final TableEditor editor = new TableEditor(tableViewer.getTable()); editor.grabHorizontal = true; editor.grabVertical = true; editor.setEditor(buttonPane, tableItem, columnIndex); editor.layout(); button.setData(editorName, editor); }
private void deleteToolItem(ToolBar toolBar) { ToolItem tltmDelete = new ToolItem(toolBar, SWT.NONE); tltmDelete.setWidth(5); tltmDelete.setImage(ImagePathConstant.DELETE_BUTTON.getImageFromRegistry()); tltmDelete.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { for (TableItem tableItem : inputFieldTable.getSelection()) { inputFields.remove(String.valueOf(tableItem.getData())); } inputFieldTableViewer.refresh(); dialog.refreshErrorLogs(); addCusrsorToLastRow(); } }); }
public void updateList() { ArrayList list = new ArrayList(); TableItem[] items = pluginList.getItems(); for(int i = 0 ; i < items.length ; i++) { if(items[i].getChecked()) list.add(items[i].getData()); } ((UnInstallPluginWizard)wizard).setPluginList(list); ((UnInstallPluginWizard)wizard).setFinishEnabled( isFinishEnabled() ); }
private void addNewItem() { ACL acl = new ACL(); acl.setId(ZooDefs.Ids.ANYONE_ID_UNSAFE); acl.setPerms(ZooDefs.Perms.ALL); TableItem newItem = addAclTableItem(acl); Table table = getTable(); table.setSelection(newItem); tableSelectionChanged(newItem); fireOrchestrationChange(); }
/** * The Function will set Table column values * @param tableViewer * @param jobDetails */ private void setTableColumnValues(TableViewer tableViewer, List<Job> jobDetails){ jobDetails.sort((job1, job2)-> job2.getUniqueJobId().compareTo(job1.getUniqueJobId())); jobDetails.forEach(job -> { String timeStamp = getTimeStamp(job.getUniqueJobId()); TableItem items = new TableItem(table, SWT.None); items.setText(0, job.getUniqueJobId()); items.setText(1, timeStamp); String mode = getJobExecutionMode(job.isRemoteMode()); items.setText(2, mode); items.setText(3, job.getJobStatus()); }); }
private void initIdTableEditor(TableItem item) { Control oldEditor = _IdTableEditor.getEditor(); if (oldEditor != null) { oldEditor.dispose(); } if (item == null) { return; } Table table = getTable(); Text newEditor = new Text(table, SWT.SINGLE); newEditor.setText(item.getText(TABLE_COLUMN_ID)); newEditor.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { Text editor = (Text) _IdTableEditor.getEditor(); _IdTableEditor.getItem().setText(TABLE_COLUMN_ID, editor.getText()); fireOrchestrationChange(); } }); _IdTableEditor.setEditor(newEditor, item, TABLE_COLUMN_ID); }
private void removeItems(TableItem[] items) { Table table = getTable(); table.setRedraw(false); try { for (TableItem item : items) { Control schemeTableEditorControl = _SchemeTableEditor.getEditor(); if (schemeTableEditorControl != null) { schemeTableEditorControl.dispose(); } _SchemeTableEditor.setEditor(null, item, 0); Control idTableEditorControl = _IdTableEditor.getEditor(); if (idTableEditorControl != null) { idTableEditorControl.dispose(); } _IdTableEditor.setEditor(null, item, 1); for (int perm : PERMS) { TableEditor tableEditor = getItemPermTableEditor(item, perm); Button checkBox = (Button) tableEditor.getEditor(); tableEditor.dispose(); checkBox.dispose(); } item.dispose(); } } finally { table.setRedraw(true); } }
@Override public void modify(Object element, String property, Object value) { SubprocessParameter p=(SubprocessParameter)((TableItem)element).getData(); if(property.equals("var")){ p.setVar((String)value); } if(property.equals("subvar")){ p.setSubvar((String)value); } viewer.refresh(); }
private void addStatValueTableItem(Table table, String name, String value, String description) { TableItem item = new TableItem(table, SWT.NONE); item.setText(0, name); item.setText(1, value); item.setText(2, description); }
@Override public void modify ( final Object element, final String property, final Object value ) { logger.debug ( "Modify Value: {}:{}:{}", new Object[] { element, property, value } ); final TableItem tableItem = (TableItem)element; if ( tableItem.getData () instanceof AttributeEntry ) { final AttributeEntry entry = (AttributeEntry)tableItem.getData (); if ( property.equals ( "value" ) ) { entry.setValue ( value.toString () ); } else if ( property.equals ( "name" ) ) { entry.setName ( value.toString () ); } else if ( property.equals ( "value-type" ) ) { final Integer i = (Integer)value; final String valueType = WriteAttributesOperationWizardValuePage.this.valueTypeEditor.getItems ()[i]; for ( final ValueType vt : ValueType.values () ) { if ( vt.label ().equals ( valueType ) ) { entry.setValueType ( vt ); } } } this.viewer.update ( entry, WriteAttributesOperationWizardValuePage.this.PROPERTIES ); dialogChanged (); } }
/** * Gets the field name modify listener. * * @param tableViewer * the table viewer * @param conditionsList * the conditions list * @param fieldsAndTypes * the fields and types * @param fieldNames * the field names * @param saveButton * the save button * @param displayButton * the display button * @return the field name modify listener */ public ModifyListener getFieldNameModifyListener(final TableViewer tableViewer, final List<Condition> conditionsList, final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) { ModifyListener listener = new ModifyListener() { @Override public void modifyText(ModifyEvent e) { CCombo source = (CCombo) e.getSource(); int index = (int) source.getData(FilterConstants.ROW_INDEX); Condition filterConditions = conditionsList.get(index); String fieldName = source.getText(); filterConditions.setFieldName(fieldName); if(StringUtils.isNotBlank(fieldName)){ String fieldType = fieldsAndTypes.get(fieldName); TableItem item = tableViewer.getTable().getItem(index); CCombo conditionalCombo = (CCombo) item.getData(FilterConditionsDialog.CONDITIONAL_OPERATORS); if(conditionalCombo != null && StringUtils.isNotBlank(fieldType)){ conditionalCombo.setText(filterConditions.getConditionalOperator()); conditionalCombo.setItems(FilterHelper.INSTANCE.getTypeBasedOperatorMap().get(fieldType)); new AutoCompleteField(conditionalCombo, new CComboContentAdapter(), conditionalCombo.getItems()); } } validateCombo(source); toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton); } }; return listener; }
protected Set<String> gatherIgnoredFactories () { final Set<String> result = new HashSet<String> (); for ( final TableItem item : this.factoriesViewer.getTable ().getItems () ) { if ( item.getChecked () ) { final String data = (String)item.getData (); result.add ( data ); } } return result; }
private void handleUpdateData ( final int index, final Map<String, List<Double>> values, final List<ValueInformation> valueInformation ) { // FIXME: implement faster final int len = valueInformation.size (); for ( int i = 0; i < len; i++ ) { final TableItem item = this.table.getItem ( i + index ); final double quality = valueInformation.get ( i ).getQuality (); final double manual = valueInformation.get ( i ).getManualPercentage (); item.setText ( 0, String.format ( Messages.QueryDataView_Format_Index, index + i ) ); item.setText ( 1, String.format ( Messages.QueryDataView_Format_Quality, quality ) ); item.setText ( 2, String.format ( Messages.QueryDataView_Format_Manual, manual ) ); for ( int j = 0; j < this.colNames.length; j++ ) { final List<Double> value = values.get ( this.colNames[j] ); item.setText ( j + FIX_FRONT_COLS, getValueString ( value.get ( i ) ) ); } item.setText ( this.colNames.length + FIX_FRONT_COLS, "" + valueInformation.get ( i ).getSourceValues () ); //$NON-NLS-1$ item.setText ( this.colNames.length + FIX_FRONT_COLS + 1, String.format ( Messages.QueryDataView_InfoFormat, valueInformation.get ( i ).getStartTimestamp (), valueInformation.get ( i ).getEndTimestamp () ) ); if ( quality < 0.33 ) { item.setBackground ( this.invalidColor ); } else { item.setBackground ( null ); } } }
private void setDataSize ( final int entries, final Set<String> valueTypes ) { clearDataSize (); this.colNames = valueTypes.toArray ( new String[0] ); for ( final String valueType : valueTypes ) { final TableColumn col = new TableColumn ( this.table, SWT.NONE ); col.setText ( valueType ); col.setWidth ( 100 ); col.setAlignment ( SWT.RIGHT ); this.columns.put ( valueType, col ); } this.countCol = new TableColumn ( this.table, SWT.NONE ); this.countCol.setText ( Messages.QueryDataView_ColValues ); this.countCol.setWidth ( 40 ); this.infoCol = new TableColumn ( this.table, SWT.NONE ); this.infoCol.setText ( Messages.QueryDataView_ColInfo ); this.infoCol.setWidth ( 150 ); this.table.clearAll (); this.table.setItemCount ( entries ); for ( int i = 0; i < entries; i++ ) { final TableItem item = this.table.getItem ( i ); item.setBackground ( this.invalidColor ); item.setText ( 0, String.format ( Messages.QueryDataView_Format_Index, i ) ); } }
public void initialize(Composite composite, int defaultOrientation) { display = composite.getDisplay(); composite.addDisposeListener((DisposeListener) this::dispose); tableViewer = new TableViewer(composite, SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL | SWT.NO_BACKGROUND | SWT.DOUBLE_BUFFERED ); table = tableViewer.getTable(); GridData gridData = new GridData(); gridData.verticalAlignment = GridData.FILL; gridData.horizontalSpan = 2; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalAlignment = GridData.FILL; tableViewer.getControl().setLayoutData(gridData); tableViewer.setContentProvider((ILazyContentProvider) rowIndex -> tableViewer.replace(contentProvider().getTableEntries().get(rowIndex), rowIndex)); table.addListener(SWT.Selection, event-> { TableItem item = (TableItem) event.item; contentProvider().setCursorIndex(contentProvider().getRowIndex((RankedItem<T>) item.getData())); handleSelection(); }); composite.getShell().addListener(SWT.Resize, event -> autoAdjustColumnWidths(composite)); // TODO try throttleLast or custom scheduler //subjectFilter.debounce(0, TimeUnit.MILLISECONDS).subscribe( filter -> handleRefresh(filter)); }
private void moveRowCursorUp() { Composite composite = table.getParent(); composite.getShell().setRedraw(false); final int cursorIndex = contentProvider().moveCursorUp().getCursorIndex(); if (cursorIndex >= 0) { TableItem cursoredTableItem = tableViewer.getTable().getItem(cursorIndex); tableViewer.getTable().showItem(cursoredTableItem); } tableViewer.refresh(); composite.getShell().setRedraw(true); }
private void moveRowCursorDown() { Composite composite = table.getParent(); composite.getShell().setRedraw(false); final int cursorIndex = contentProvider().moveCursorDown().getCursorIndex(); if (cursorIndex >= 0) { TableItem cursoredTableItem = tableViewer.getTable().getItem(cursorIndex); tableViewer.getTable().showItem(cursoredTableItem); } tableViewer.refresh(); composite.getShell().setRedraw(true); }
public List<StepDetail> getStepDetails() { TableItem[] items = table.getItems(); List<StepDetail> details = new ArrayList<StepDetail>(); for (TableItem tableItem : items) { StepDetail sd = (StepDetail) tableItem.getData(); details.add(sd); } return details; }