use of org.netxms.ui.eclipse.dashboard.widgets.DashboardControl in project netxms by netxms.
the class DashboardDynamicView method setObject.
/**
* @param object
*/
private void setObject(Dashboard object) {
if (dbc != null)
dbc.dispose();
dashboard = object;
dbc = new DashboardControl(parentComposite, SWT.NONE, dashboard, this, selectionProvider, false);
parentComposite.layout();
setPartName(Messages.get().DashboardDynamicView_PartNamePrefix + dashboard.getObjectName());
}
use of org.netxms.ui.eclipse.dashboard.widgets.DashboardControl in project netxms by netxms.
the class DashboardView method createPartControl.
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
selectionProvider = new IntermediateSelectionProvider();
getSite().setSelectionProvider(selectionProvider);
ConsoleJob job = new ConsoleJob(Messages.get().DashboardView_GetEffectiveRights, this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
readOnly = ((dashboard.getEffectiveRights() & UserAccessRights.OBJECT_ACCESS_MODIFY) == 0);
}
@Override
protected String getErrorMessage() {
return Messages.get().DashboardView_GetEffectiveRightsError;
}
};
job.start();
// FIXME: rewrite waiting
try {
job.join();
} catch (InterruptedException e) {
}
parentComposite = parent;
dbc = new DashboardControl(parent, SWT.NONE, dashboard, this, selectionProvider, false);
if (!readOnly) {
dbcModifyListener = new DashboardModifyListener() {
@Override
public void save() {
actionSave.setEnabled(false);
firePropertyChange(PROP_DIRTY);
}
@Override
public void modify() {
actionSave.setEnabled(true);
firePropertyChange(PROP_DIRTY);
}
};
dbc.setModifyListener(dbcModifyListener);
}
activateContext();
createActions();
contributeToActionBars();
clientListener = new SessionListener() {
@Override
public void notificationHandler(SessionNotification n) {
if (n.getCode() == SessionNotification.OBJECT_CHANGED && dashboard.getObjectId() == n.getSubCode()) {
parentComposite.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
rebuildDashboard(true);
}
});
}
}
};
session.addListener(clientListener);
}
use of org.netxms.ui.eclipse.dashboard.widgets.DashboardControl in project netxms by netxms.
the class DashboardPage method createContent.
/* (non-Javadoc)
* @see org.netxms.webui.mobile.pages.AbstractPage#createContent(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Composite createContent(Composite parent) {
NXCSession session = (NXCSession) ConsoleSharedData.getSession();
Dashboard dashboard = (Dashboard) session.findObjectById(objectId, Dashboard.class);
if (dashboard != null) {
DashboardControl dbc = new DashboardControl(parent, SWT.NONE, dashboard, null, false);
setTitle(dashboard.getObjectName());
return dbc;
} else {
setTitle("[" + objectId + "]");
return new Composite(parent, SWT.NONE);
}
}
use of org.netxms.ui.eclipse.dashboard.widgets.DashboardControl in project netxms by netxms.
the class DashboardDynamicView method createPartControl.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
* .Composite)
*/
@Override
public void createPartControl(Composite parent) {
selectionProvider = new IntermediateSelectionProvider();
getSite().setSelectionProvider(selectionProvider);
parentComposite = parent;
if (dashboard != null)
dbc = new DashboardControl(parent, SWT.NONE, dashboard, this, selectionProvider, false);
createActions();
contributeToActionBars();
selectionService = getSite().getWorkbenchWindow().getSelectionService();
selectionListener = new ISelectionListener() {
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if ((part instanceof DashboardNavigator) && (selection instanceof IStructuredSelection) && !selection.isEmpty()) {
Object object = ((IStructuredSelection) selection).getFirstElement();
if (object instanceof Dashboard) {
setObject((Dashboard) object);
}
}
}
};
selectionService.addSelectionListener(selectionListener);
}
use of org.netxms.ui.eclipse.dashboard.widgets.DashboardControl in project netxms by netxms.
the class DashboardDynamicView method rebuildDashboard.
/**
* Rebuild current dashboard
*/
private void rebuildDashboard() {
if (dashboard == null)
return;
if (dbc != null)
dbc.dispose();
dashboard = (Dashboard) ((NXCSession) ConsoleSharedData.getSession()).findObjectById(dashboard.getObjectId(), Dashboard.class);
if (dashboard != null) {
dbc = new DashboardControl(parentComposite, SWT.NONE, dashboard, this, selectionProvider, false);
parentComposite.layout();
setPartName(Messages.get().DashboardDynamicView_PartNamePrefix + dashboard.getObjectName());
} else {
dbc = null;
}
}
Aggregations