use of org.netxms.client.datacollection.DciSummaryTableDescriptor in project netxms by netxms.
the class SummaryTableManager method createSummaryTable.
/**
* Create new loyalty program
*/
private void createSummaryTable(boolean isTableSource) {
// $NON-NLS-1$ //$NON-NLS-2$
DciSummaryTable t = new DciSummaryTable("", "", isTableSource);
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, t);
if (dlg != null) {
dlg.getShell().setText(Messages.get().SummaryTableManager_TitleCreate);
dlg.open();
if (t.getId() != 0) {
// was saved to server
DciSummaryTableDescriptor d = new DciSummaryTableDescriptor(t);
descriptors.put(d.getId(), d);
viewer.setInput(descriptors.values().toArray());
viewer.setSelection(new StructuredSelection(d));
}
}
}
use of org.netxms.client.datacollection.DciSummaryTableDescriptor in project netxms by netxms.
the class SummaryTablesCache method reload.
/**
* Reload tables from server
*/
private void reload() {
try {
List<DciSummaryTableDescriptor> list = session.listDciSummaryTables();
synchronized (tables) {
tables.clear();
for (DciSummaryTableDescriptor d : list) {
tables.put(d.getId(), d);
}
}
SourceProvider p = SourceProvider.getInstance(display);
if (p != null) {
p.update();
}
} catch (Exception e) {
Activator.logError("Exception in SummaryTablesCache.reload()", e);
}
}
use of org.netxms.client.datacollection.DciSummaryTableDescriptor in project netxms by netxms.
the class SelectSummaryTableDialog method createDialogArea.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite dialogArea = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout();
layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
dialogArea.setLayout(layout);
new Label(dialogArea, SWT.NONE).setText(Messages.get().SelectSummaryTableDialog_Label);
viewer = new TableViewer(dialogArea, SWT.BORDER | SWT.FULL_SELECTION);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
return ((DciSummaryTableDescriptor) element).getTitle();
}
});
viewer.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
DciSummaryTableDescriptor s1 = (DciSummaryTableDescriptor) e1;
DciSummaryTableDescriptor s2 = (DciSummaryTableDescriptor) e2;
return s1.getTitle().compareToIgnoreCase(s2.getTitle());
}
});
viewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
SelectSummaryTableDialog.this.okPressed();
}
});
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
gd.heightHint = 300;
gd.widthHint = 400;
viewer.getControl().setLayoutData(gd);
viewer.setInput(SummaryTablesCache.getInstance().getTables());
return dialogArea;
}
Aggregations