use of org.eclipse.jface.viewers.ColumnWeightData in project yamcs-studio by yamcs.
the class FunctionsView method createPartControl.
@Override
public void createPartControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
TreeColumnLayout tcl_composite = new TreeColumnLayout();
composite.setLayout(tcl_composite);
treeViewer = new TreeViewer(composite, SWT.BORDER);
Tree tree = treeViewer.getTree();
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
TreeViewerColumn treeViewerColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
treeViewerColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public Image getImage(Object element) {
return null;
}
@Override
public String getText(Object element) {
if (element instanceof FormulaFunctionSet) {
return ((FormulaFunctionSet) element).getName();
} else if (element instanceof FormulaFunction) {
return FormulaFunctions.formatSignature((FormulaFunction) element);
}
return "";
}
});
TreeColumn trclmnNewColumn = treeViewerColumn.getColumn();
tcl_composite.setColumnData(trclmnNewColumn, new ColumnWeightData(10, ColumnWeightData.MINIMUM_WIDTH, true));
trclmnNewColumn.setText("Name");
TreeViewerColumn treeViewerColumn_1 = new TreeViewerColumn(treeViewer, SWT.NONE);
treeViewerColumn_1.setLabelProvider(new ColumnLabelProvider() {
@Override
public Image getImage(Object element) {
return null;
}
@Override
public String getText(Object element) {
if (element instanceof FormulaFunction) {
return ((FormulaFunction) element).getDescription();
} else if (element instanceof FormulaFunctionSet) {
return ((FormulaFunctionSet) element).getDescription();
}
return "";
}
});
TreeColumn trclmnNewColumn_1 = treeViewerColumn_1.getColumn();
tcl_composite.setColumnData(trclmnNewColumn_1, new ColumnWeightData(7, ColumnWeightData.MINIMUM_WIDTH, true));
trclmnNewColumn_1.setText("Description");
treeViewer.setContentProvider(new FunctionTreeContentProvider());
List<String> functionSetNames = new ArrayList<>(FormulaRegistry.getDefault().listFunctionSets());
Collections.sort(functionSetNames);
List<FormulaFunctionSet> functionSets = new ArrayList<>();
for (String functionSetName : functionSetNames) {
functionSets.add(FormulaRegistry.getDefault().findFunctionSet(functionSetName));
}
treeViewer.setInput(functionSets);
}
use of org.eclipse.jface.viewers.ColumnWeightData in project yamcs-studio by yamcs.
the class ParameterTableViewer method addFixedColumns.
private void addFixedColumns(TableColumnLayout tcl) {
TableViewerColumn nameColumn = new TableViewerColumn(this, SWT.LEFT);
nameColumn.getColumn().setText(COL_NAME);
tcl.setColumnData(nameColumn.getColumn(), new ColumnWeightData(40));
nameColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
ParameterInfo cnt = (ParameterInfo) element;
return cnt.getQualifiedName();
}
});
TableViewerColumn engValueColumn = new TableViewerColumn(this, SWT.RIGHT);
engValueColumn.getColumn().setText(COL_ENG);
tcl.setColumnData(engValueColumn.getColumn(), new ColumnWeightData(10));
engValueColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
ParameterReader reader = readers.get(element);
if (reader == null || reader.getValue() == null)
return "-";
ParameterValue value = reader.getValue();
return String.valueOf(getValue(value.getEngValue()));
}
});
TableViewerColumn rawValueColumn = new TableViewerColumn(this, SWT.RIGHT);
rawValueColumn.getColumn().setText(COL_RAW);
tcl.setColumnData(rawValueColumn.getColumn(), new ColumnWeightData(10));
rawValueColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
ParameterReader reader = readers.get(element);
if (reader == null || reader.getValue() == null)
return "-";
ParameterValue value = reader.getValue();
return String.valueOf(getValue(value.getRawValue()));
}
});
TableViewerColumn gentimeValueColumn = new TableViewerColumn(this, SWT.LEFT);
gentimeValueColumn.getColumn().setText(COL_TIME);
tcl.setColumnData(gentimeValueColumn.getColumn(), new ColumnWeightData(20));
gentimeValueColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
ParameterReader reader = readers.get(element);
if (reader == null || reader.getValue() == null)
return "-";
ParameterValue value = reader.getValue();
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Date time = new Date(value.getGenerationTime());
String strDate = sdfDate.format(time);
return strDate;
}
});
TableViewerColumn aqutimeValueColumn = new TableViewerColumn(this, SWT.LEFT);
aqutimeValueColumn.getColumn().setText(COL_AQU_TIME);
tcl.setColumnData(aqutimeValueColumn.getColumn(), new ColumnWeightData(20));
aqutimeValueColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
ParameterReader reader = readers.get(element);
if (reader == null || reader.getValue() == null)
return "-";
ParameterValue value = reader.getValue();
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Date time = new Date(value.getAcquisitionTime());
String strDate = sdfDate.format(time);
return strDate;
}
});
// Common properties to all columns
List<TableViewerColumn> columns = new ArrayList<>();
columns.add(nameColumn);
columns.add(engValueColumn);
columns.add(rawValueColumn);
columns.add(gentimeValueColumn);
columns.add(aqutimeValueColumn);
for (TableViewerColumn column : columns) {
// prevent resize to 0
column.getColumn().addControlListener(new ControlListener() {
@Override
public void controlMoved(ControlEvent e) {
}
@Override
public void controlResized(ControlEvent e) {
if (column.getColumn().getWidth() < 5)
column.getColumn().setWidth(5);
}
});
}
}
use of org.eclipse.jface.viewers.ColumnWeightData in project yamcs-studio by yamcs.
the class VerificationStepsTableViewer method addFixedColumns.
private void addFixedColumns(TableLayout tl) {
TableViewerColumn nameColumn = new TableViewerColumn(this, SWT.NONE);
nameColumn.getColumn().setText(COL_NAME);
nameColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
VerificationStep step = (VerificationStep) element;
return step.getName();
}
});
tl.addColumnData(new ColumnWeightData(200));
TableViewerColumn statusColumn = new TableViewerColumn(this, SWT.NONE);
statusColumn.getColumn().setText(COL_STATUS);
statusColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public Image getImage(Object element) {
VerificationStep step = (VerificationStep) element;
if (step.getStatus().contains("OK")) {
return commandHistoryView.greenBubble;
} else {
return commandHistoryView.redBubble;
}
}
@Override
public String getText(Object element) {
VerificationStep step = (VerificationStep) element;
return step.getStatus();
}
});
tl.addColumnData(new ColumnWeightData(200));
TableViewerColumn deltaColumn = new TableViewerColumn(this, SWT.NONE);
deltaColumn.getColumn().setText(COL_DELTA);
deltaColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
VerificationStep step = (VerificationStep) element;
return step.getDelta();
}
});
tl.addColumnData(new ColumnWeightData(200));
TableViewerColumn dateColumn = new TableViewerColumn(this, SWT.NONE);
dateColumn.getColumn().setText(COL_DATE);
dateColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
VerificationStep step = (VerificationStep) element;
return step.getTime();
}
});
tl.addColumnData(new ColumnWeightData(200));
}
use of org.eclipse.jface.viewers.ColumnWeightData in project yamcs-studio by yamcs.
the class CommandQueuesTableViewer method addFixedColumns.
private void addFixedColumns(TableColumnLayout tcl) {
TableViewerColumn nameColumn = new TableViewerColumn(this, SWT.NONE);
nameColumn.getColumn().setText(COL_QUEUE);
tcl.setColumnData(nameColumn.getColumn(), new ColumnWeightData(40));
TableViewerColumn stateColumn = new TableViewerColumn(this, SWT.CENTER);
stateColumn.getColumn().setText(COL_STATE);
stateColumn.getColumn().setWidth(250);
stateColumn.setEditingSupport(new StateEditingSupport(stateColumn.getViewer()));
tcl.setColumnData(stateColumn.getColumn(), new ColumnWeightData(30));
TableViewerColumn commandsColumn = new TableViewerColumn(this, SWT.CENTER);
commandsColumn.getColumn().setText(COL_COMMANDS);
tcl.setColumnData(commandsColumn.getColumn(), new ColumnWeightData(10));
TableViewerColumn sentColumn = new TableViewerColumn(this, SWT.CENTER);
sentColumn.getColumn().setText(COL_SENT);
tcl.setColumnData(sentColumn.getColumn(), new ColumnWeightData(10));
TableViewerColumn rejectedColumn = new TableViewerColumn(this, SWT.CENTER);
rejectedColumn.getColumn().setText(COL_REJECTED);
tcl.setColumnData(rejectedColumn.getColumn(), new ColumnWeightData(10));
// Common properties to all columns
List<TableViewerColumn> columns = new ArrayList<>();
columns.add(nameColumn);
columns.add(stateColumn);
columns.add(commandsColumn);
columns.add(sentColumn);
columns.add(rejectedColumn);
for (TableViewerColumn column : columns) {
// prevent resize to 0
column.getColumn().addControlListener(new ControlListener() {
@Override
public void controlMoved(ControlEvent e) {
}
@Override
public void controlResized(ControlEvent e) {
if (column.getColumn().getWidth() < 5)
column.getColumn().setWidth(5);
}
});
}
}
use of org.eclipse.jface.viewers.ColumnWeightData in project translationstudio8 by heartsome.
the class WebSearchPreferencePage method createTableArea.
private Composite createTableArea(Composite parent) {
Composite tableArea = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout(1, false);
gridLayout.marginWidth = 0;
tableArea.setLayout(gridLayout);
GridData gridData = new GridData(GridData.FILL_BOTH);
tableArea.setLayoutData(gridData);
checkboxTableViewer = CheckboxTableViewer.newCheckList(tableArea, SWT.BORDER | SWT.FULL_SELECTION);
table = checkboxTableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(false);
TableLayout tableLayout = new TableLayout();
tableLayout.addColumnData(new ColumnPixelData(40));
tableLayout.addColumnData(new ColumnWeightData(50, 50, true));
tableLayout.addColumnData(new ColumnWeightData(70, 50, true));
table.setLayout(tableLayout);
GridData tableGridData = new GridData(GridData.FILL_BOTH);
table.setLayoutData(tableGridData);
WebSearchLableProvider webSearchLableProvider = new WebSearchLableProvider();
webSearchLableProvider.createColumns(checkboxTableViewer);
checkboxTableViewer.setContentProvider(new WebSearchContentProvider());
checkboxTableViewer.setLabelProvider(webSearchLableProvider);
checkboxTableViewer.setCheckStateProvider(new CheckProvider());
checkboxTableViewer.addCheckStateListener(new CheckListener());
// checkboxTableViewer.setCellEditors(new CellEditor[] { null, new TextCellEditor(table),
// new TextCellEditor(table) });
// checkboxTableViewer.setCellModifier(new NameModifier());
checkboxTableViewer.setColumnProperties(new String[] { APP_PROP, NAME_PROP, URL_PROP });
cache = WebSearchPreferencStore.getIns().getSearchConfig();
checkboxTableViewer.setInput((Object) cache);
return tableArea;
}
Aggregations