use of org.jkiss.dbeaver.ui.dashboard.control.DashboardListViewer in project dbeaver by serge-rider.
the class DashboardItemViewDialog method createDialogArea.
@Override
protected Composite createDialogArea(Composite parent) {
Composite dialogArea = super.createDialogArea(parent);
Composite chartGroup = UIUtils.createPlaceholder(dialogArea, 1);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 450;
gd.heightHint = 300;
chartGroup.setLayoutData(gd);
chartGroup.setLayout(new FillLayout());
DashboardListViewer dashboardListViewer = new DashboardListViewer(parentPart.getSite(), sourceItem.getDataSourceContainer(), parentPart.getViewConfiguration());
dashboardListViewer.setSingleChartMode(true);
dashboardListViewer.createControl(chartGroup);
DashboardItem targetItem = new DashboardItem((DashboardList) dashboardListViewer.getDefaultGroup(), sourceItem.getDashboardId());
targetItem.moveViewFrom(sourceItem, false);
return dialogArea;
}
use of org.jkiss.dbeaver.ui.dashboard.control.DashboardListViewer in project dbeaver by serge-rider.
the class DashboardUpdater method getViewDashboards.
private void getViewDashboards(DashboardView view, List<DashboardContainer> dashboards) {
long currentTime = System.currentTimeMillis();
DashboardListViewer viewManager = view.getDashboardListViewer();
if (viewManager == null || !viewManager.getDataSourceContainer().isConnected()) {
return;
}
for (DashboardGroupContainer group : viewManager.getGroups()) {
for (DashboardContainer dashboard : group.getItems()) {
Date lastUpdateTime = dashboard.getLastUpdateTime();
if (lastUpdateTime == null || (currentTime - lastUpdateTime.getTime()) >= dashboard.getUpdatePeriod()) {
dashboards.add(dashboard);
}
}
}
}
use of org.jkiss.dbeaver.ui.dashboard.control.DashboardListViewer in project dbeaver by serge-rider.
the class DashboardView method createDashboardControls.
private void createDashboardControls(Composite parent) {
try {
String secondaryId = getViewSite().getSecondaryId();
if (CommonUtils.isEmpty(secondaryId)) {
throw new IllegalStateException("Dashboard view requires active database connection");
}
String projectName, dsId;
int divPos = secondaryId.indexOf("/");
if (divPos == -1) {
projectName = null;
dsId = secondaryId;
} else {
projectName = secondaryId.substring(0, divPos);
dsId = secondaryId.substring(divPos + 1);
}
dataSourceContainer = DBUtils.findDataSource(projectName, dsId);
if (dataSourceContainer == null) {
throw new IllegalStateException("Database connection '" + dsId + "' not found");
}
dataSourceContainer.getRegistry().addDataSourceListener(this);
configuration = new DashboardViewConfiguration(dataSourceContainer, secondaryId);
dashboardListViewer = new DashboardListViewer(getSite(), dataSourceContainer, configuration);
dashboardListViewer.createControl(parent);
dashboardListViewer.createDashboardsFromConfiguration();
getSite().setSelectionProvider(dashboardListViewer);
parent.layout(true, true);
updateStatus();
} catch (Throwable e) {
log.error("Error initializing dashboard view", e);
}
}
use of org.jkiss.dbeaver.ui.dashboard.control.DashboardListViewer in project dbeaver by dbeaver.
the class DashboardUpdater method getViewDashboards.
private void getViewDashboards(DashboardView view, List<DashboardContainer> dashboards) {
long currentTime = System.currentTimeMillis();
DashboardListViewer viewManager = view.getDashboardListViewer();
if (viewManager == null || !viewManager.getDataSourceContainer().isConnected()) {
return;
}
for (DashboardGroupContainer group : viewManager.getGroups()) {
for (DashboardContainer dashboard : group.getItems()) {
Date lastUpdateTime = dashboard.getLastUpdateTime();
if (lastUpdateTime == null || (currentTime - lastUpdateTime.getTime()) >= dashboard.getUpdatePeriod()) {
dashboards.add(dashboard);
}
}
}
}
use of org.jkiss.dbeaver.ui.dashboard.control.DashboardListViewer in project dbeaver by dbeaver.
the class DashboardView method createDashboardControls.
private void createDashboardControls(Composite parent) {
try {
String secondaryId = getViewSite().getSecondaryId();
if (CommonUtils.isEmpty(secondaryId)) {
throw new IllegalStateException("Dashboard view requires active database connection");
}
String projectName, dsId;
int divPos = secondaryId.indexOf("/");
if (divPos == -1) {
projectName = null;
dsId = secondaryId;
} else {
projectName = secondaryId.substring(0, divPos);
dsId = secondaryId.substring(divPos + 1);
}
dataSourceContainer = DBUtils.findDataSource(projectName, dsId);
if (dataSourceContainer == null) {
throw new IllegalStateException("Database connection '" + dsId + "' not found");
}
dataSourceContainer.getRegistry().addDataSourceListener(this);
configuration = new DashboardViewConfiguration(dataSourceContainer, secondaryId);
dashboardListViewer = new DashboardListViewer(getSite(), dataSourceContainer, configuration);
dashboardListViewer.createControl(parent);
dashboardListViewer.createDashboardsFromConfiguration();
getSite().setSelectionProvider(dashboardListViewer);
parent.layout(true, true);
updateStatus();
} catch (Throwable e) {
log.error("Error initializing dashboard view", e);
}
}
Aggregations