use of org.netxms.client.TableColumnDefinition in project netxms by netxms.
the class BaseTableValueViewer method buildInstanceString.
/**
* @param viewerRow
* @return
*/
protected String buildInstanceString(ViewerRow viewerRow) {
StringBuilder instance = new StringBuilder();
boolean first = true;
for (int i = 0; i < currentData.getColumnCount(); i++) {
TableColumnDefinition cd = currentData.getColumnDefinition(i);
if (cd.isInstanceColumn()) {
if (!first)
// $NON-NLS-1$
instance.append("~~~");
instance.append(viewerRow.getText(i));
first = false;
}
}
return instance.toString();
}
use of org.netxms.client.TableColumnDefinition in project netxms by netxms.
the class TableValueViewer method showHistory.
/**
* Show history
*/
private void showHistory() {
if (currentData == null)
return;
ViewerCell[] cells = cellSelectionManager.getSelectedCells();
if (cells.length == 0)
return;
for (int i = 0; i < cells.length; i++) {
TableColumnDefinition column = currentData.getColumnDefinition(cells[i].getColumnIndex());
final String instance = buildInstanceString(cells[i].getViewerRow());
String id = // $NON-NLS-1$ //$NON-NLS-2$
Long.toString(objectId) + "&" + Long.toString(dciId) + "@" + safeEncode(column.getDisplayName() + ": " + instance.replace("~~~", " / ")) + // $NON-NLS-1$
"@" + safeEncode(instance) + "@" + // $NON-NLS-1$ //$NON-NLS-2$
safeEncode(column.getName());
final IWorkbenchPage page = (viewPart != null) ? viewPart.getSite().getPage() : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
page.showView(HistoricalDataView.ID, id, IWorkbenchPage.VIEW_ACTIVATE);
} catch (Exception e) {
MessageDialogHelper.openError(page.getWorkbenchWindow().getShell(), Messages.get().TableValue_Error, String.format(Messages.get().TableValue_ErrorOpeningView, e.getLocalizedMessage()));
}
}
}
use of org.netxms.client.TableColumnDefinition in project netxms by netxms.
the class TableValueViewer method showDataComparisonChart.
/**
* Show line chart
*/
private void showDataComparisonChart(int chartType) {
if (currentData == null)
return;
ViewerCell[] cells = cellSelectionManager.getSelectedCells();
if (cells.length == 0)
return;
// $NON-NLS-1$
String id = Long.toString(uniqueId++) + "&" + Integer.toString(chartType);
for (int i = 0; i < cells.length; i++) {
TableColumnDefinition column = currentData.getColumnDefinition(cells[i].getColumnIndex());
String instance = buildInstanceString(cells[i].getViewerRow());
int source = currentData.getSource();
id += // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
"&" + Long.toString(objectId) + "@" + Long.toString(dciId) + "@" + Integer.toString(source) + "@" + Integer.toString(column.getDataType().getValue()) + "@" + safeEncode(currentData.getTitle()) + // $NON-NLS-1$ //$NON-NLS-2$
"@" + safeEncode(column.getDisplayName() + ": " + instance.replace("~~~", " / ")) + "@" + safeEncode(instance) + // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
"@" + safeEncode(column.getName());
}
final IWorkbenchPage page = (viewPart != null) ? viewPart.getSite().getPage() : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
page.showView(DataComparisonView.ID, id, IWorkbenchPage.VIEW_ACTIVATE);
} catch (Exception e) {
MessageDialogHelper.openError(page.getWorkbenchWindow().getShell(), Messages.get().TableValue_Error, String.format(Messages.get().TableValue_ErrorOpeningView, e.getLocalizedMessage()));
}
}
use of org.netxms.client.TableColumnDefinition in project netxms by netxms.
the class TableValueViewer method showLineChart.
/**
* Show line chart
*/
private void showLineChart() {
if (currentData == null)
return;
ViewerCell[] cells = cellSelectionManager.getSelectedCells();
if (cells.length == 0)
return;
StringBuilder sb = new StringBuilder();
sb.append(uniqueId++);
for (int i = 0; i < cells.length; i++) {
TableColumnDefinition column = currentData.getColumnDefinition(cells[i].getColumnIndex());
final String instance = buildInstanceString(cells[i].getViewerRow());
sb.append("&");
sb.append(ChartDciConfig.TABLE);
sb.append("@");
sb.append(objectId);
sb.append("@");
sb.append(dciId);
sb.append("@");
sb.append(safeEncode(column.getDisplayName() + ": " + instance.replace("~~~", " / ")));
sb.append("@");
sb.append(safeEncode(instance));
sb.append("@");
sb.append(safeEncode(column.getName()));
}
final IWorkbenchPage page = (viewPart != null) ? viewPart.getSite().getPage() : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
page.showView(HistoricalGraphView.ID, sb.toString(), IWorkbenchPage.VIEW_ACTIVATE);
} catch (Exception e) {
MessageDialogHelper.openError(page.getWorkbenchWindow().getShell(), Messages.get().TableValue_Error, String.format(Messages.get().TableValue_ErrorOpeningView, e.getLocalizedMessage()));
}
}
Aggregations