use of org.opencms.ui.dialogs.history.diff.I_CmsDiffProvider in project opencms-core by alkacon.
the class CmsHistoryDialog method tryCompare.
/**
* Opens the 'compare' view for the two selected versions of the resource.<p>
*
* @throws CmsException if something goes wrong
*/
public void tryCompare() throws CmsException {
CmsObject cms = A_CmsUI.getCmsObject();
CheckBox check1 = m_group1.getSelected();
CheckBox check2 = m_group2.getSelected();
if (!canCompare(check1, check2)) {
Notification.show(CmsVaadinUtils.getMessageText(Messages.GUI_HISTORY_DIALOG_SELECT_TWO_DIFFERENT_VERSIONS_0));
} else {
CmsHistoryResourceBean bean1 = (CmsHistoryResourceBean) (check1.getData());
CmsHistoryResourceBean bean2 = (CmsHistoryResourceBean) (check2.getData());
VerticalLayout diffContainer = new VerticalLayout();
diffContainer.setSpacing(true);
for (I_CmsDiffProvider diff : m_diffs) {
Optional<Component> optionalDiff = diff.diff(cms, bean1, bean2);
if (optionalDiff.isPresent()) {
diffContainer.addComponent(optionalDiff.get());
}
}
Panel panel = new Panel();
panel.setSizeFull();
diffContainer.setWidth("100%");
diffContainer.setMargin(true);
panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
panel.setContent(diffContainer);
openChildDialog(CmsHistoryDialog.this, panel, CmsVaadinUtils.getMessageText(Messages.GUI_HISTORY_DIALOG_COMPARE_0));
}
}
Aggregations