use of com.vaadin.v7.ui.VerticalLayout in project opencms-core by alkacon.
the class CmsValueDiff method diff.
/**
* @see org.opencms.ui.dialogs.history.diff.I_CmsDiffProvider#diff(org.opencms.file.CmsObject, org.opencms.gwt.shared.CmsHistoryResourceBean, org.opencms.gwt.shared.CmsHistoryResourceBean)
*/
public Optional<Component> diff(final CmsObject cms, CmsHistoryResourceBean v1, CmsHistoryResourceBean v2) throws CmsException {
CmsResource resource1 = A_CmsAttributeDiff.readResource(cms, v1);
I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(resource1);
CmsMacroResolver resolver = new CmsVersionMacroResolver(v1, v2);
if ((type instanceof CmsResourceTypeXmlContent) || (type instanceof CmsResourceTypeXmlPage)) {
CmsResource resource2 = A_CmsAttributeDiff.readResource(cms, v2);
final Panel panel = new Panel(CmsVaadinUtils.getMessageText(Messages.GUI_HISTORY_DIALOG_CONTENT_VALUE_TABLE_CAPTION_0));
final CmsFile file1 = cms.readFile(resource1);
final CmsFile file2 = cms.readFile(resource2);
VerticalLayout vl = new VerticalLayout();
vl.setMargin(true);
vl.setSpacing(true);
Table table = buildValueComparisonTable(cms, panel, file1, file2, resolver);
if (table.getContainerDataSource().size() == 0) {
return Optional.absent();
}
Button fileTextCompareButton = new Button(CmsVaadinUtils.getMessageText(Messages.GUI_HISTORY_DIALOG_COMPARE_WHOLE_FILE_0));
vl.addComponent(fileTextCompareButton);
vl.setComponentAlignment(fileTextCompareButton, Alignment.MIDDLE_RIGHT);
fileTextCompareButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@SuppressWarnings("synthetic-access")
public void buttonClick(ClickEvent event) {
Component diffView = buildWholeFileDiffView(cms, file1, file2);
CmsHistoryDialog.openChildDialog(panel, diffView, CmsVaadinUtils.getMessageText(Messages.GUI_HISTORY_DIALOG_COMPARE_WHOLE_FILE_0));
}
});
vl.addComponent(table);
panel.setContent(vl);
Component result = panel;
return Optional.fromNullable(result);
} else {
return Optional.absent();
}
}
use of com.vaadin.v7.ui.VerticalLayout in project opencms-core by alkacon.
the class CmsUpdateStep02DBDialog method getDisplayContent.
/**
* Gets the content.<p>
*
* @param dbBean to create content for
* @return VerticalLayout
*/
private VerticalLayout getDisplayContent(CmsUpdateDBManager dbBean) {
VerticalLayout res = new VerticalLayout();
res.setSpacing(true);
Label label = new Label();
label.setContentMode(ContentMode.HTML);
String html = "";
html += "<p>Detected Database is: " + dbBean.getDbName() + "</p>";
html += "<p>Following db pool(s) will be upgraded:</p>";
label.setValue(html);
res.addComponent(label);
Iterator<String> it = dbBean.getPools().iterator();
while (it.hasNext()) {
String pool = it.next();
res.addComponent(getDBPoolPanel(dbBean, pool));
}
return res;
}
use of com.vaadin.v7.ui.VerticalLayout in project opencms-core by alkacon.
the class CmsUpdateStep02DBDialog method getDBPoolPanel.
/**
* Get panel for given db pool.<p>
*
* @param dbBean to get info from
* @param pool to show panel for
* @return Panel
*/
private Panel getDBPoolPanel(CmsUpdateDBManager dbBean, String pool) {
Panel res = new Panel();
res.setCaption(pool);
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
String widthString = "300px";
layout.addComponent(getTableLikeLabel("JDBC Driver", dbBean.getDbDriver(pool), widthString));
layout.addComponent(getTableLikeLabel("JDBC Connection Url", dbBean.getDbUrl(pool), widthString));
layout.addComponent(getTableLikeLabel("JDBC Connection Url Params", dbBean.getDbParams(pool), widthString));
layout.addComponent(getTableLikeLabel("Database User", dbBean.getDbUser(pool), widthString));
res.setContent(layout);
return res;
}
use of com.vaadin.v7.ui.VerticalLayout in project opencms-core by alkacon.
the class A_CmsUI method setContentToDialog.
/**
* Replaces the ui content with a single dialog.<p>
*
* TODO: In the future this should only handle window creation, refactor dialog contents to CmsBasicDialog
*
* @param caption the caption
* @param component the dialog content
*/
public void setContentToDialog(String caption, Component component) {
setContent(new Label());
Window window = CmsBasicDialog.prepareWindow(DialogWidth.narrow);
CmsBasicDialog dialog = new CmsBasicDialog();
VerticalLayout result = new VerticalLayout();
dialog.setContent(result);
window.setContent(dialog);
window.setCaption(caption);
window.setClosable(false);
addWindow(window);
window.center();
if (component instanceof I_CmsHasButtons) {
I_CmsHasButtons hasButtons = (I_CmsHasButtons) component;
for (Button button : hasButtons.getButtons()) {
dialog.addButton(button);
}
}
result.addComponent(component);
}
use of com.vaadin.v7.ui.VerticalLayout in project opencms-core by alkacon.
the class CmsVaadinUtils method showAlert.
/**
* Shows an alert box to the user with the given information, which will perform the given action after the user clicks on OK.<p>
*
* @param title the title
* @param message the message
*
* @param callback the callback to execute after clicking OK
*/
public static void showAlert(String title, String message, final Runnable callback) {
final Window window = new Window();
window.setModal(true);
Panel panel = new Panel();
panel.setCaption(title);
panel.setWidth("500px");
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
panel.setContent(layout);
layout.addComponent(new Label(message));
Button okButton = new Button();
okButton.addClickListener(new ClickListener() {
/**
* The serial version id.
*/
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
window.close();
if (callback != null) {
callback.run();
}
}
});
layout.addComponent(okButton);
layout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT);
okButton.setCaption(org.opencms.workplace.Messages.get().getBundle(A_CmsUI.get().getLocale()).key(org.opencms.workplace.Messages.GUI_DIALOG_BUTTON_OK_0));
window.setContent(panel);
window.setClosable(false);
window.setResizable(false);
A_CmsUI.get().addWindow(window);
}
Aggregations