Search in sources :

Example 56 with VerticalLayout

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();
    }
}
Also used : CmsResourceTypeXmlPage(org.opencms.file.types.CmsResourceTypeXmlPage) Table(com.vaadin.v7.ui.Table) ClickEvent(com.vaadin.ui.Button.ClickEvent) CmsResourceTypeXmlContent(org.opencms.file.types.CmsResourceTypeXmlContent) CmsMacroResolver(org.opencms.util.CmsMacroResolver) I_CmsResourceType(org.opencms.file.types.I_CmsResourceType) Panel(com.vaadin.ui.Panel) CmsFile(org.opencms.file.CmsFile) CmsResource(org.opencms.file.CmsResource) Button(com.vaadin.ui.Button) VerticalLayout(com.vaadin.v7.ui.VerticalLayout) Component(com.vaadin.ui.Component) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 57 with VerticalLayout

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;
}
Also used : Label(com.vaadin.v7.ui.Label) VerticalLayout(com.vaadin.v7.ui.VerticalLayout)

Example 58 with VerticalLayout

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;
}
Also used : Panel(com.vaadin.ui.Panel) VerticalLayout(com.vaadin.v7.ui.VerticalLayout)

Example 59 with VerticalLayout

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);
}
Also used : Window(com.vaadin.ui.Window) CmsBasicDialog(org.opencms.ui.components.CmsBasicDialog) Button(com.vaadin.ui.Button) Label(com.vaadin.v7.ui.Label) VerticalLayout(com.vaadin.v7.ui.VerticalLayout)

Example 60 with VerticalLayout

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);
}
Also used : Window(com.vaadin.ui.Window) Panel(com.vaadin.ui.Panel) MouseButton(com.vaadin.shared.MouseEventDetails.MouseButton) Button(com.vaadin.ui.Button) ItemClickEvent(com.vaadin.v7.event.ItemClickEvent) ClickEvent(com.vaadin.ui.Button.ClickEvent) Label(com.vaadin.v7.ui.Label) VerticalLayout(com.vaadin.v7.ui.VerticalLayout) ClickListener(com.vaadin.ui.Button.ClickListener)

Aggregations

VerticalLayout (com.vaadin.v7.ui.VerticalLayout)34 VerticalLayout (com.vaadin.ui.VerticalLayout)25 Button (com.vaadin.ui.Button)22 Label (com.vaadin.ui.Label)18 Label (com.vaadin.v7.ui.Label)17 HorizontalLayout (com.vaadin.ui.HorizontalLayout)16 Window (com.vaadin.ui.Window)12 Component (com.vaadin.ui.Component)11 ValoTheme (com.vaadin.ui.themes.ValoTheme)11 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)11 VaadinIcons (com.vaadin.icons.VaadinIcons)10 Panel (com.vaadin.ui.Panel)10 TextField (com.vaadin.v7.ui.TextField)10 Strings (de.symeda.sormas.api.i18n.Strings)10 ButtonHelper (de.symeda.sormas.ui.utils.ButtonHelper)10 CssStyles (de.symeda.sormas.ui.utils.CssStyles)10 Captions (de.symeda.sormas.api.i18n.Captions)9 Alignment (com.vaadin.ui.Alignment)8 CheckBox (com.vaadin.v7.ui.CheckBox)8 OptionGroup (com.vaadin.v7.ui.OptionGroup)8