use of org.eclipse.jface.viewers.TableViewerColumn in project yamcs-studio by yamcs.
the class SpreadSheetTable method insertColumn.
/**
* Insert a column. Default values for the new column are empty strings.
*
* @param index
* index of the column.
*/
public void insertColumn(int index) {
for (List<String> row : input) {
// $NON-NLS-1$
row.add(index, "");
}
final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE, index);
viewerColumn.getColumn().setMoveable(false);
viewerColumn.getColumn().setWidth(DEFAULT_COLUMN_WIDTH);
TextEditingSupport textEditingSupport = new TextEditingSupport(tableViewer);
viewerColumn.setEditingSupport(textEditingSupport);
viewerColumn.getColumn().setData(TEXT_EDITING_SUPPORT_KEY, textEditingSupport);
tableViewer.setLabelProvider(new TextTableLableProvider());
fireTableModified();
}
use of org.eclipse.jface.viewers.TableViewerColumn in project yamcs-studio by yamcs.
the class ActionsInputDialog method createPropertiesViewer.
private TableViewer createPropertiesViewer(Composite parent) {
TableViewer viewer = new TableViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
viewer.getTable().setLinesVisible(true);
viewer.getTable().setHeaderVisible(true);
TableViewerColumn tvColumn = new TableViewerColumn(viewer, SWT.NONE);
tvColumn.getColumn().setText("Property");
tvColumn.getColumn().setMoveable(false);
tvColumn.getColumn().setWidth(100);
tvColumn = new TableViewerColumn(viewer, SWT.NONE);
tvColumn.getColumn().setText("Value");
tvColumn.getColumn().setMoveable(false);
tvColumn.getColumn().setWidth(300);
EditingSupport editingSupport = new PropertiesEditingSupport(viewer, viewer.getTable());
tvColumn.setEditingSupport(editingSupport);
viewer.setContentProvider(new WidgetPropertiesContentProvider());
viewer.setLabelProvider(new PropertiesLabelProvider());
viewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
viewer.getTable().setEnabled(false);
return viewer;
}
use of org.eclipse.jface.viewers.TableViewerColumn in project yamcs-studio by yamcs.
the class RuleDataEditDialog method createExpressionsTableViewer.
/**
* Creates and configures a {@link TableViewer}.
*
* @param parent
* The parent for the table
* @return The {@link TableViewer}
*/
private TableViewer createExpressionsTableViewer(final Composite parent) {
final TableViewer viewer = new TableViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
viewer.getTable().setLinesVisible(true);
viewer.getTable().setHeaderVisible(true);
TableViewerColumn expressionColumn = new TableViewerColumn(viewer, SWT.NONE);
expressionColumn.getColumn().setText("Boolean Expression");
expressionColumn.getColumn().setMoveable(false);
expressionColumn.getColumn().setWidth(200);
expressionColumn.setEditingSupport(new EditingSupport(viewer) {
@Override
protected void setValue(Object element, Object value) {
if (element instanceof Expression)
((Expression) element).setBooleanExpression(value.toString());
viewer.refresh();
}
@Override
protected Object getValue(Object element) {
if (element instanceof Expression)
return ((Expression) element).getBooleanExpression();
return null;
}
@Override
protected CellEditor getCellEditor(Object element) {
return new TextCellEditor(viewer.getTable());
}
@Override
protected boolean canEdit(Object element) {
return true;
}
});
valueColumn = new TableViewerColumn(viewer, SWT.NONE);
valueColumn.getColumn().setText(ruleData.isOutputExpValue() ? "Output Expression" : "Output Value");
valueColumn.getColumn().setMoveable(false);
valueColumn.getColumn().setWidth(200);
EditingSupport editingSupport = new EditingSupport(viewer) {
@Override
protected void setValue(Object element, Object value) {
if (element instanceof Expression) {
((Expression) element).setValue(value);
}
viewer.refresh();
}
@Override
protected Object getValue(Object element) {
if (element instanceof Expression) {
if (((Expression) element).getValue() == null)
// $NON-NLS-1$
return "";
return ((Expression) element).getValue();
}
return null;
}
@Override
protected CellEditor getCellEditor(Object element) {
if (element instanceof Expression) {
if (ruleData.isOutputExpValue() || ruleData.getProperty().getPropertyDescriptor() == null)
return new TextCellEditor(viewer.getTable());
else
return ruleData.getProperty().getPropertyDescriptor().createPropertyEditor(viewer.getTable());
}
return null;
}
@Override
protected boolean canEdit(Object element) {
return true;
}
};
valueColumn.setEditingSupport(editingSupport);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new ExpressionLabelProvider());
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
viewer.getTable().setLayoutData(gd);
return viewer;
}
use of org.eclipse.jface.viewers.TableViewerColumn in project yamcs-studio by yamcs.
the class PropertyDataLabelProvider method createPropertiesViewer.
private TableViewer createPropertiesViewer(Composite parent) {
TableViewer viewer = new TableViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
viewer.getTable().setLinesVisible(true);
viewer.getTable().setHeaderVisible(true);
TableViewerColumn tvColumn = new TableViewerColumn(viewer, SWT.NONE);
tvColumn.getColumn().setText("Property");
tvColumn.getColumn().setMoveable(false);
tvColumn.getColumn().setWidth(150);
tvColumn = new TableViewerColumn(viewer, SWT.NONE);
tvColumn.getColumn().setText("Value");
tvColumn.getColumn().setMoveable(false);
tvColumn.getColumn().setWidth(200);
EditingSupport editingSupport = new PropertyDataEditingSupport(viewer, viewer.getTable());
tvColumn.setEditingSupport(editingSupport);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new PropertyDataLabelProvider());
viewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
return viewer;
}
use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.
the class BrokerConfigEditComposite method createCubridBrokerConfPropTable.
/**
* Create property table
*
* @param cubridBrokerConfTabFolder
*/
public void createCubridBrokerConfPropTable(CTabFolder cubridBrokerConfTabFolder) {
final Composite comp = new Composite(cubridBrokerConfTabFolder, SWT.NONE);
comp.setLayoutData(new GridData(FILL_HORIZONTAL));
comp.setLayout(new GridLayout(1, false));
tableCTabItem = new CTabItem(cubridBrokerConfTabFolder, SWT.NONE);
tableCTabItem.setText(inputName);
confTableViewer = new TableViewer(comp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
final Table confTable = confTableViewer.getTable();
confTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
confTable.setHeaderVisible(true);
confTable.setLinesVisible(true);
confTableViewer.setUseHashlookup(true);
CommonUITool.hackForYosemite(confTable);
// create column
final TableViewerColumn column = new TableViewerColumn(confTableViewer, SWT.LEFT);
column.getColumn().setWidth(0);
column.getColumn().setText("");
confTableViewer.setContentProvider(confTableContentProvider);
confTableViewer.setLabelProvider(confTableLabelProvider);
confTableViewer.setSorter(new BrokerConfTableViewerSorter());
// use to mark click point, the right click menu use this point
confTable.addListener(SWT.MouseDown, new Listener() {
public void handleEvent(Event event) {
clickPoint = new Point(event.x, event.y);
clickPointTiming = System.currentTimeMillis();
}
});
registerContextMenu();
tableCTabItem.setControl(comp);
}
Aggregations