@Override public final SafeHtml getValue(Snapshot snapshot) { // Get raw description string (ignore < and > characters). // Customize description style as needed. SafeHtml description = SafeHtmlUtils.fromString(snapshot.getDescription()); String descriptionStr = description.asString(); if (snapshot.getStatus() == SnapshotStatus.IN_PREVIEW) { List<String> previewedItems = new ArrayList<>(Arrays.asList(constants.vmConfiguration())); previewedItems.addAll(Linq.getDiskAliases(snapshot.getDiskImages())); descriptionStr = messages.snapshotPreviewing( descriptionStr, StringUtils.join(previewedItems, ", ")); // $NON-NLS-1$ description = templates.snapshotDescription("color:orange", descriptionStr); // $NON-NLS-1$ } else if (snapshot.getType() == SnapshotType.STATELESS) { descriptionStr = descriptionStr + " (" + constants.readonlyLabel() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ description = templates.snapshotDescription("font-style:italic", descriptionStr); // $NON-NLS-1$ } else if (snapshot.getType() == SnapshotType.PREVIEW) { descriptionStr = constants.snapshotDescriptionActiveVmBeforePreview(); description = templates.snapshotDescription("color:gray", descriptionStr); // $NON-NLS-1$ } else if (snapshot.getType() == SnapshotType.ACTIVE) { descriptionStr = constants.snapshotDescriptionActiveVm(); description = templates.snapshotDescription("color:gray", descriptionStr); // $NON-NLS-1$ } else if (snapshot.getType() == SnapshotType.REGULAR && !snapshot.getDiskImages().isEmpty()) { descriptionStr = messages.snapshotPreviewing( descriptionStr, StringUtils.join( Linq.getDiskAliases(snapshot.getDiskImages()), ", ")); // $NON-NLS-1$ description = templates.snapshotDescription("color:gold", descriptionStr); // $NON-NLS-1$ } return description; }
@Override public void edit(final SnapshotModel model) { driver.edit(model); if (model.isShowMemorySnapshotWarning() && !model.isShowPartialSnapshotWarning()) { Style dialogStyle = getParent().getParent().getParent().getElement().getStyle(); dialogStyle.setWidth(450, Style.Unit.PX); dialogStyle.setHeight(200, Style.Unit.PX); } partialSnapshotWarningPanel.setVisible(model.isShowPartialSnapshotWarning()); memoryWarningPanel.setVisible(model.isShowMemorySnapshotWarning()); horizontalSeparator.setVisible( model.isShowPartialSnapshotWarning() && model.isShowMemorySnapshotWarning()); vmDisksLabel.setText( messages.vmDisksLabel( model.getVmDisks().size(), StringUtils.join(Linq.getDiskAliases(model.getVmDisks()), ", "))); // $NON-NLS-1$ snapshotDisksLabel.setText( messages.snapshotDisksLabel( model.getDisks().size(), StringUtils.join(Linq.getDiskAliases(model.getDisks()), ", "))); // $NON-NLS-1$ }