use of org.eclipse.jface.viewers.TableLayout in project cubrid-manager by CUBRID.
the class ChartCompositePart method createSeriesTable.
/**
* Create basic info table
*
* @param parent the parent composite
*
*/
private void createSeriesTable(Composite parent) {
final Composite comp = new Composite(parent, SWT.NONE);
GridData gdBasic = new GridData(SWT.FILL, SWT.NONE, false, false);
comp.setLayoutData(gdBasic);
GridLayout layout = new GridLayout();
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
layout.marginLeft = 0;
layout.marginRight = 0;
layout.marginTop = 0;
layout.marginBottom = 0;
comp.setLayout(layout);
final Label label = new Label(comp, SWT.CENTER);
label.setText(Messages.tblSeriesTtl);
seriesTableViewer = new TableViewer(comp, SWT.NO_SCROLL | SWT.BORDER);
Table seriesTable = seriesTableViewer.getTable();
seriesTable.setHeaderVisible(true);
seriesTable.setLinesVisible(true);
GridData tblSeries = new GridData(SWT.FILL, SWT.TOP, true, false);
tblSeries.heightHint = CommonUITool.getHeightHintOfTable(seriesTable);
seriesTable.setLayoutData(tblSeries);
TableLayout seriesLayout = new TableLayout();
setSeriesTableLayout(seriesLayout);
seriesTable.setLayout(seriesLayout);
TableColumn tblColumn = new TableColumn(seriesTable, SWT.CENTER);
tblColumn.setText("");
tblColumn.setResizable(false);
for (Map.Entry<String, ShowSetting> entry : settingMap.entrySet()) {
tblColumn = new TableColumn(seriesTable, SWT.CENTER);
tblColumn.setText(entry.getKey());
tblColumn.setToolTipText(entry.getKey());
tblColumn.setResizable(false);
}
List<String[]> chartTblLst = new ArrayList<String[]>();
String[] arrays = valueMap.values().toArray(new String[valueMap.size()]);
String[] arrays2 = new String[arrays.length + 1];
arrays2[0] = "";
System.arraycopy(arrays, 0, arrays2, 1, arrays.length);
chartTblLst.add(arrays2);
ChartTableContentProvider chartTableContentProvider = new ChartTableContentProvider();
seriesTableViewer.setContentProvider(chartTableContentProvider);
seriesTableViewer.setLabelProvider(new ChartTableLabelProvider());
seriesTableViewer.setInput(chartTblLst);
int index = 0;
for (Map.Entry<String, ShowSetting> entry : settingMap.entrySet()) {
org.eclipse.swt.graphics.Color color = new org.eclipse.swt.graphics.Color(comp.getDisplay(), entry.getValue().getSeriesRgb());
seriesTableViewer.getTable().getItem(0).setBackground(index + 1, color);
index++;
}
seriesTable.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent event) {
updateTableLayout();
}
});
}
use of org.eclipse.jface.viewers.TableLayout in project cubrid-manager by CUBRID.
the class ChartCompositePart method updateSettingSeries.
/**
* Update setting series
*
*/
public void updateSettingSeries() {
int index = 0;
for (Map.Entry<String, ShowSetting> entry : settingMap.entrySet()) {
String item = entry.getKey();
ShowSetting showSetting = entry.getValue();
boolean checked = showSetting.isChecked();
RGB rgb = showSetting.getSeriesRgb();
float width = showSetting.getWidth();
org.eclipse.swt.graphics.Color color = new org.eclipse.swt.graphics.Color(composite.getDisplay(), rgb);
seriesTableViewer.getTable().getItem(0).setBackground(index + 1, color);
updateSettingChart(item, checked, rgb, width);
index++;
}
TableLayout seriesLayout = new TableLayout();
setSeriesTableLayout(seriesLayout);
seriesTableViewer.getTable().setLayout(seriesLayout);
seriesTableViewer.getTable().layout(true);
}
use of org.eclipse.jface.viewers.TableLayout in project cubrid-manager by CUBRID.
the class ShardEnvStatusView method createTable.
/**
* This method initializes table
*
*/
private void createTable() {
tableViewer = new TableViewer(composite, SWT.FULL_SELECTION);
tableViewer.getTable().setHeaderVisible(true);
tableViewer.getTable().setLinesVisible(true);
// ShardStatusSettingHelp sssh = ShardStatusSettingHelp.getInstance();
// Map<String, Boolean> data = sssh.loadSetting(ShardsStatus.class);
TableLayout tlayout = new TableLayout();
// }
for (int i = 0; i < 7; i++) {
tlayout.addColumnData(new ColumnWeightData(0, 0, true));
}
makeTableColumn();
tableViewer.setContentProvider(new SimpleContentProvider<ShardsStatus>());
ShardEnvStatusLabelProvider shardEnvStatusLabelProvider = new ShardEnvStatusLabelProvider();
tableViewer.setLabelProvider(shardEnvStatusLabelProvider);
tableViewer.getTable().setLayout(tlayout);
}
use of org.eclipse.jface.viewers.TableLayout in project linuxtools by eclipse.
the class AbstractSTTreeViewer method createColumns.
/**
* Create the columns in the tree.
*/
@Override
protected void createColumns() {
Tree tree = getViewer().getTree();
TableLayout layout = new TableLayout();
tree.setLayout(layout);
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
for (int i = 0; i < getAllFields().length; i++) {
ISTDataViewersField field = getAllFields()[i];
TreeColumn tc = new TreeColumn(tree, field.getAlignment(), i);
tc.setText(field.getColumnHeaderText());
tc.setToolTipText(field.getColumnHeaderTooltip());
tc.setImage(field.getColumnHeaderImage());
tc.setWidth(field.getPreferredWidth());
tc.setResizable(true);
tc.setMoveable(true);
tc.addSelectionListener(createHeaderListener());
tc.setData(field);
// defining the column label provider.
// this has to be done after setting the column's data.
TreeViewerColumn viewerColumn = new TreeViewerColumn(getViewer(), tc);
viewerColumn.setLabelProvider(createColumnLabelProvider(tc));
}
tree.addMouseMoveListener(e -> {
Tree tree1 = (Tree) e.widget;
TreeItem item = tree1.getItem(new Point(e.x, e.y));
if (item == null) {
return;
}
tree1.setCursor(e.display.getSystemCursor(SWT.CURSOR_ARROW));
});
}
use of org.eclipse.jface.viewers.TableLayout in project yamcs-studio by yamcs.
the class CommandHistoryView method createPartControl.
@Override
public void createPartControl(Composite parent) {
resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
greenBubble = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/ok.png"));
redBubble = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/nok.png"));
grayBubble = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/undef.png"));
waitingImage = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/waiting.png"));
headerCompleteImage = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/header_complete.png"));
checkmarkImage = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/checkmark.gif"));
errorImage = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/error_tsk.png"));
prevImage = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/event_prev.png"));
nextImage = resourceManager.createImage(RCPUtils.getImageDescriptor(CommandHistoryView.class, "icons/obj16/event_next.png"));
createActions();
tableLayout = new TableLayout();
tableViewer = new TableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
tableViewer.getTable().setLayout(tableLayout);
tableViewer.getTable().setHeaderVisible(true);
tableViewer.getTable().setLinesVisible(true);
addFixedColumns();
tableContentProvider = new CommandHistoryRecordContentProvider(tableViewer);
tableViewer.setContentProvider(tableContentProvider);
// ! otherwise refresh() deletes everything...
tableViewer.setInput(tableContentProvider);
tableViewerComparator = new CommandHistoryViewerComparator();
tableViewer.setComparator(tableViewerComparator);
// Register context menu. Commands are added in plugin.xml
MenuManager menuManager = new MenuManager();
Menu menu = menuManager.createContextMenu(tableViewer.getTable());
tableViewer.getTable().setMenu(menu);
getSite().registerContextMenu(menuManager, tableViewer);
// Default action is to open Command properties
tableViewer.getTable().addListener(SWT.MouseDoubleClick, evt -> {
RCPUtils.runCommand(CommandHistory.CMD_COMMAND_PROPERTIES);
});
updateSummaryLine();
getViewSite().setSelectionProvider(tableViewer);
CommandingCatalogue.getInstance().addCommandHistoryListener(cmdhistEntry -> {
Display.getDefault().asyncExec(() -> processCommandHistoryEntry(cmdhistEntry));
});
}
Aggregations