use of org.eclipse.kapua.app.console.shared.model.GwtDeploymentPackage in project kapua by eclipse.
the class DeviceTabPackages method openUninstallDialog.
private void openUninstallDialog() {
final GwtDeploymentPackage selectedDeploymentPackage = installedPackageTab.getSelectedDeploymentPackage();
if (selectedDeploymentPackage != null) {
toolBar.disable();
final PackageUninstallDialog packageUninstallDialog = new PackageUninstallDialog(selectedDevice.getScopeId(), selectedDevice.getId(), selectedDeploymentPackage);
packageUninstallDialog.addListener(Events.Hide, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
toolBar.enable();
Boolean exitStatus = packageUninstallDialog.getExitStatus();
if (exitStatus == null) {
// Operation Aborted
return;
} else {
InfoDialogType exitDialogType;
String exitMessage = packageUninstallDialog.getExitMessage();
if (exitStatus == true) {
// Operation Success
exitDialogType = InfoDialogType.INFO;
} else {
// Operaton Failed
exitDialogType = InfoDialogType.ERROR;
}
//
// Exit dialog
InfoDialog exitDialog = new InfoDialog(exitDialogType, exitMessage);
exitDialog.show();
m_uninstallButton.disable();
m_deviceTabs.setDevice(selectedDevice);
}
}
});
packageUninstallDialog.show();
}
}
use of org.eclipse.kapua.app.console.shared.model.GwtDeploymentPackage in project kapua by eclipse.
the class DeviceTabPackagesInstalled method refresh.
public void refresh() {
if (m_dirty && m_initialized) {
GwtDevice selectedDevice = getSelectedDevice();
if (selectedDevice == null || !selectedDevice.isOnline()) {
m_treeStore.removeAll();
m_treeGrid.unmask();
m_treeGrid.getView().setEmptyText(MSGS.deviceNoDeviceSelectedOrOffline());
} else {
m_treeGrid.mask(MSGS.loading());
gwtDeviceManagementService.findDevicePackages(selectedDevice.getScopeId(), selectedDevice.getId(), new AsyncCallback<List<GwtDeploymentPackage>>() {
@Override
public void onSuccess(List<GwtDeploymentPackage> packages) {
m_treeStore.removeAll();
if (packages != null && !packages.isEmpty()) {
for (GwtDeploymentPackage pkg : packages) {
m_treeStore.add(pkg, false);
if (pkg.getBundleInfos() != null) {
for (GwtBundleInfo bundle : pkg.getBundleInfos()) {
m_treeStore.add(pkg, bundle, false);
}
}
}
} else {
m_rootTabPanel.getUninstallButton().disable();
m_treeGrid.getView().setEmptyText(MSGS.deviceNoPackagesInstalled());
m_treeGrid.getView().refresh(false);
}
m_treeGrid.unmask();
}
@Override
public void onFailure(Throwable caught) {
FailureHandler.handle(caught);
m_treeGrid.unmask();
}
});
}
m_dirty = false;
}
}
use of org.eclipse.kapua.app.console.shared.model.GwtDeploymentPackage in project kapua by eclipse.
the class DeviceTabPackagesInstalled method onRender.
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
ColumnConfig name = new ColumnConfig("name", "Name", 100);
name.setRenderer(new TreeGridCellRenderer<ModelData>());
ColumnConfig version = new ColumnConfig("version", "Version", 150);
version.setSortable(false);
ColumnModel cm = new ColumnModel(Arrays.asList(name, version));
m_treeGrid = new TreeGrid<ModelData>(m_treeStore, cm);
m_treeGrid.setBorders(false);
m_treeGrid.setLoadMask(true);
m_treeGrid.getStyle().setLeafIcon(AbstractImagePrototype.create(Resources.INSTANCE.plugin()));
m_treeGrid.setAutoExpandColumn("name");
m_treeGrid.setTrackMouseOver(false);
m_treeGrid.getAriaSupport().setLabelledBy(getHeader().getId() + "-label");
m_treeGrid.getView().setAutoFill(true);
m_treeGrid.getView().setEmptyText(MSGS.deviceNoDeviceSelectedOrOffline());
m_treeGrid.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<ModelData>() {
@Override
public void selectionChanged(SelectionChangedEvent<ModelData> se) {
ModelData selectedItem = se.getSelectedItem();
// Check if it's a package or a bundle
if (selectedItem instanceof GwtDeploymentPackage) {
m_rootTabPanel.getUninstallButton().enable();
} else {
m_rootTabPanel.getUninstallButton().disable();
}
}
});
add(m_treeGrid);
m_initialized = true;
}
use of org.eclipse.kapua.app.console.shared.model.GwtDeploymentPackage in project kapua by eclipse.
the class GwtDeviceManagementServiceImpl method findDevicePackages.
//
// Packages
//
@Override
public List<GwtDeploymentPackage> findDevicePackages(String scopeShortId, String deviceShortId) throws GwtKapuaException {
List<GwtDeploymentPackage> gwtPkgs = new ArrayList<GwtDeploymentPackage>();
try {
KapuaLocator locator = KapuaLocator.getInstance();
DevicePackageManagementService deviceManagementService = locator.getService(DevicePackageManagementService.class);
KapuaId scopeId = KapuaEid.parseShortId(scopeShortId);
KapuaId deviceId = KapuaEid.parseShortId(deviceShortId);
DevicePackages deploymentPackages = deviceManagementService.getInstalled(scopeId, deviceId, null);
for (DevicePackage deploymentPackage : deploymentPackages.getPackages()) {
GwtDeploymentPackage gwtPkg = new GwtDeploymentPackage();
gwtPkg.setName(deploymentPackage.getName());
gwtPkg.setVersion(deploymentPackage.getVersion());
DevicePackageBundleInfos devicePackageBundleInfos = deploymentPackage.getBundleInfos();
if (devicePackageBundleInfos != null) {
List<GwtBundleInfo> gwtBundleInfos = new ArrayList<GwtBundleInfo>();
for (DevicePackageBundleInfo bundleInfo : devicePackageBundleInfos.getBundlesInfos()) {
GwtBundleInfo gwtBundleInfo = new GwtBundleInfo();
gwtBundleInfo.setName(bundleInfo.getName());
gwtBundleInfo.setVersion(bundleInfo.getVersion());
gwtBundleInfos.add(gwtBundleInfo);
}
gwtPkg.setBundleInfos(gwtBundleInfos);
}
gwtPkgs.add(gwtPkg);
}
} catch (Throwable t) {
KapuaExceptionHandler.handle(t);
}
return gwtPkgs;
}
Aggregations