use of org.eclipse.jface.viewers.ColumnWeightData in project cubrid-manager by CUBRID.
the class SqlLogAnalyzeResultDialog method createAnalyzeResultTableOptionN.
/**
* This method initializes table when option is no
*
* @param tlayout TableLayout
*/
private void createAnalyzeResultTableOptionN(TableLayout tlayout) {
tlayout.addColumnData(new ColumnWeightData(13, 60, true));
tlayout.addColumnData(new ColumnWeightData(14, 60, true));
tlayout.addColumnData(new ColumnWeightData(14, 60, true));
tlayout.addColumnData(new ColumnWeightData(14, 60, true));
tlayout.addColumnData(new ColumnWeightData(20, 60, true));
tlayout.addColumnData(new ColumnWeightData(20, 60, true));
table.setLayout(tlayout);
table.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (analyzeCasLogResultList == null || analyzeCasLogResultList.getLogFileInfoList() == null) {
return;
}
int selectioncount = table.getSelectionCount();
int resultCount = analyzeCasLogResultList.getLogFileInfoList().size();
StringBuilder queryString = new StringBuilder();
AnalyzeCasLogResultInfo logResult;
for (int j = 0; j < selectioncount; j++) {
String qindex = table.getSelection()[j].getText(0);
for (int i = 0; i < resultCount; i++) {
logResult = (AnalyzeCasLogResultInfo) (analyzeCasLogResultList.getLogFileInfoList().get(i));
if (qindex.equals(logResult.getQindex())) {
currentResultIndex = i;
queryString = connect(logResult.getQindex(), queryString);
queryString.append(logResult.getQueryString());
queryString.append(NEXT_LINE);
buttonRunOriginalQuery.setEnabled(true);
buttonSaveToFile.setEnabled(true);
break;
}
}
}
textQuery.setText(queryString.toString());
}
});
TableColumn qindex = makeQindexColumn();
TableColumn max = makeMaxColumn();
TableColumn min = makeMinColumn();
TableColumn avg = makeAvgColumn();
TableColumn cnt = makeCntColumn();
TableColumn err = makeErrColumn();
qindex.setText(Messages.tableIndex);
max.setText(Messages.tableMax);
max.setAlignment(SWT.RIGHT);
min.setText(Messages.tableMin);
min.setAlignment(SWT.RIGHT);
avg.setText(Messages.tableAvg);
avg.setAlignment(SWT.RIGHT);
cnt.setText(Messages.tableTotalCount);
cnt.setAlignment(SWT.RIGHT);
err.setText(Messages.tableErrCount);
err.setAlignment(SWT.RIGHT);
qindex.setWidth(60);
max.setWidth(60);
min.setWidth(60);
avg.setWidth(60);
cnt.setWidth(50);
err.setWidth(50);
}
use of org.eclipse.jface.viewers.ColumnWeightData in project cubrid-manager by CUBRID.
the class DiagStatusMonitorTemplateDialog method createTableSelectedItem.
/**
* This method initializes tableSelectedItem
*
*/
private void createTableSelectedItem() {
TableLayout tlayout = new TableLayout();
tlayout.addColumnData(new ColumnWeightData(150, 150, true));
tlayout.addColumnData(new ColumnWeightData(150, 150, true));
tagetTbl.setLayout(tlayout);
TableColumn categoryColumn = new TableColumn(tagetTbl, SWT.CENTER);
categoryColumn.setText(DIAG_CATEGORY);
TableColumn nameColumn = new TableColumn(tagetTbl, SWT.CENTER);
nameColumn.setText(DIAG_NAME);
}
use of org.eclipse.jface.viewers.ColumnWeightData in project cubrid-manager by CUBRID.
the class ChartCompositePart method setSeriesTableLayout.
/**
* Set the basic info table layout based on the different column.
*
* @param layout the table layout
*/
private void setSeriesTableLayout(TableLayout layout) {
layout.addColumnData(new ColumnWeightData(0, 0, false));
int count = 0;
for (Map.Entry<String, ShowSetting> entry : settingMap.entrySet()) {
if (entry.getValue().isChecked()) {
layout.addColumnData(new ColumnWeightData(10, 50, true));
} else {
layout.addColumnData(new ColumnWeightData(0, 0, false));
count++;
}
}
if (count == settingMap.size()) {
seriesTableViewer.getTable().setVisible(false);
} else {
seriesTableViewer.getTable().setVisible(true);
}
}
use of org.eclipse.jface.viewers.ColumnWeightData 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.ColumnWeightData in project sling by apache.
the class MVPEditor method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
// now add the node type dropbox-combo
Composite header = new Composite(composite, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
layout.numColumns = 3;
header.setLayout(layout);
Label label = new Label(header, SWT.WRAP);
label.setText("Modify property " + property.getName() + ":");
GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
label.setLayoutData(data);
label.setFont(parent.getFont());
ToolBar buttonBar = new ToolBar(header, SWT.NONE);
ToolItem invisible = new ToolItem(buttonBar, SWT.NONE);
ToolItem plus = new ToolItem(buttonBar, SWT.NONE);
plus.setImage(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_ADD).createImage());
plus.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
plus();
}
});
final ToolItem minus = new ToolItem(buttonBar, SWT.NONE);
minus.setImage(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE).createImage());
minus.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
minus();
}
});
minus.setEnabled(false);
Composite tableParent = new Composite(composite, SWT.NONE);
final GridData layoutData = new GridData(GridData.FILL_BOTH);
layoutData.heightHint = 150;
tableParent.setLayoutData(layoutData);
TableColumnLayout tableLayout = new TableColumnLayout();
tableParent.setLayout(tableLayout);
viewer = new TableViewer(tableParent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
viewer.getTable().setLinesVisible(true);
viewer.getTable().setHeaderVisible(true);
// accessing property here directly, instead of going via (JcrProperty)inputElement;
String[] rawLines = property.getValuesAsString();
// convert raw lines to Line objects for easier editing management
for (int i = 0; i < rawLines.length; i++) {
lines.add(new Line(rawLines[i]));
}
viewer.setContentProvider(new IStructuredContentProvider() {
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
@Override
public void dispose() {
}
@Override
public Object[] getElements(Object inputElement) {
return lines.toArray();
}
});
TableViewerColumn column0 = new TableViewerColumn(viewer, SWT.NONE);
column0.getColumn().setText("Type");
column0.getColumn().setResizable(true);
column0.getColumn().setWidth(100);
tableLayout.setColumnData(column0.getColumn(), new ColumnWeightData(20, 100));
column0.setLabelProvider(new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
try {
cell.setText(property.getTypeAsString());
cell.setForeground(greyColor);
} catch (Exception e) {
cell.setText("n/a");
cell.setForeground(greyColor);
}
}
});
TableViewerColumn column1 = new TableViewerColumn(viewer, SWT.NONE);
column1.getColumn().setText("Value");
column1.getColumn().setResizable(true);
column1.getColumn().setWidth(200);
tableLayout.setColumnData(column1.getColumn(), new ColumnWeightData(80, 200));
column1.setLabelProvider(new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
Line line = (Line) cell.getElement();
cell.setText(line.getValue());
}
});
column1.setEditingSupport(new EditingSupport(viewer) {
@Override
protected void setValue(Object element, Object value) {
Line line = (Line) element;
line.setValue(String.valueOf(value));
// trigger a refresh:
viewer.setInput(property);
}
@Override
protected Object getValue(Object element) {
final Line line = (Line) element;
final String value = line.getValue();
System.out.println("Value=" + value);
return value;
}
@Override
protected CellEditor getCellEditor(Object element) {
return new TextCellEditor(viewer.getTable());
}
@Override
protected boolean canEdit(Object element) {
// all values are editable
return true;
}
});
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
final ISelection selection = event.getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection iss = (IStructuredSelection) selection;
if (iss.isEmpty()) {
minus.setEnabled(false);
} else {
minus.setEnabled(true);
}
} else {
minus.setEnabled(false);
}
}
});
viewer.setInput(property);
return composite;
}
Aggregations