use of org.netxms.client.objects.DataCollectionTarget in project netxms by netxms.
the class ObjectPopupDialog method createDialogArea.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.PopupDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite dialogArea = (Composite) super.createDialogArea(parent);
statusLabel = new CLabel(dialogArea, SWT.NONE);
statusLabel.setText(StatusDisplayInfo.getStatusText(object.getStatus()).toUpperCase());
statusLabel.setForeground(StatusDisplayInfo.getStatusColor(object.getStatus()));
statusLabel.setFont(boldFont);
StringBuilder sb = new StringBuilder();
if (object instanceof AbstractNode) {
appendText(sb, ((AbstractNode) object).getPrimaryIP().getHostAddress());
appendText(sb, ((AbstractNode) object).getPlatformName());
String sd = ((AbstractNode) object).getSystemDescription();
if (sd.length() > 127)
// $NON-NLS-1$
sd = sd.substring(0, 127) + "...";
appendText(sb, sd);
appendText(sb, ((AbstractNode) object).getSnmpSysName());
appendText(sb, ((AbstractNode) object).getSnmpSysContact());
}
if (sb.length() > 0) {
createSeparator(dialogArea);
if (sb.charAt(sb.length() - 1) == '\n')
sb.deleteCharAt(sb.length() - 1);
CLabel infoText = new CLabel(dialogArea, SWT.MULTI);
infoText.setText(sb.toString());
}
if (object instanceof DataCollectionTarget) {
List<DciValue> values = ((DataCollectionTarget) object).getTooltipDciData();
if (!values.isEmpty()) {
createSeparator(dialogArea);
Composite group = new Composite(dialogArea, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 2;
group.setLayout(layout);
StringBuilder leftColumn = new StringBuilder();
StringBuilder rightColumn = new StringBuilder();
for (DciValue v : values) {
if (leftColumn.length() > 0) {
leftColumn.append('\n');
rightColumn.append('\n');
}
leftColumn.append(v.getDescription());
rightColumn.append(v.getValue());
}
new CLabel(group, SWT.MULTI).setText(leftColumn.toString());
new CLabel(group, SWT.MULTI).setText(rightColumn.toString());
}
}
if (!object.getComments().isEmpty()) {
createSeparator(dialogArea);
new CLabel(dialogArea, SWT.MULTI).setText(object.getComments());
}
return dialogArea;
}
Aggregations