Search in sources :

Example 71 with HorizontalLayout

use of com.vaadin.v7.ui.HorizontalLayout in project opencms-core by alkacon.

the class CmsRestoreDeletedDialog method initDeletedResources.

/**
 * Fills the list of resources to select from.<p>
 *
 * @param cms the cms context
 * @param deletedResources the deleted resources
 *
 * @throws CmsException if something goes wrong
 */
private void initDeletedResources(CmsObject cms, List<I_CmsHistoryResource> deletedResources) throws CmsException {
    Collections.sort(deletedResources, new Comparator<I_CmsHistoryResource>() {

        public int compare(I_CmsHistoryResource first, I_CmsHistoryResource second) {
            return first.getRootPath().compareTo(second.getRootPath());
        }
    });
    m_deletedResourceContainer.removeAllComponents();
    m_selectionContainer = new IndexedContainer();
    m_selectionContainer.addContainerProperty(PROP_SELECTED, Boolean.class, Boolean.FALSE);
    m_okButton.setEnabled(!deletedResources.isEmpty());
    if (deletedResources.isEmpty()) {
        m_deletedResourceContainer.addComponent(new Label(CmsVaadinUtils.getMessageText(org.opencms.workplace.list.Messages.GUI_LIST_EMPTY_0)));
    }
    for (I_CmsHistoryResource deleted : deletedResources) {
        I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(deleted.getTypeId());
        String typeName = resType.getTypeName();
        CmsExplorerTypeSettings explorerType = OpenCms.getWorkplaceManager().getExplorerTypeSetting(typeName);
        String title = cms.getRequestContext().removeSiteRoot(deleted.getRootPath());
        String subtitle = CmsVaadinUtils.getMessageText(org.opencms.ui.Messages.GUI_RESTOREDELETED_DATE_VERSION_2, CmsVfsService.formatDateTime(cms, deleted.getDateLastModified()), "" + deleted.getVersion());
        if (explorerType == null) {
            explorerType = OpenCms.getWorkplaceManager().getExplorerTypeSetting(deleted.isFile() ? CmsResourceTypeUnknownFile.RESOURCE_TYPE_NAME : CmsResourceTypeUnknownFolder.RESOURCE_TYPE_NAME);
        }
        CmsResourceInfo info = new CmsResourceInfo(title, subtitle, CmsResourceUtil.getBigIconResource(explorerType, deleted.getName()));
        info.setWidth("100%");
        HorizontalLayout hl = new HorizontalLayout();
        hl.setWidth("100%");
        CheckBox checkbox = new CheckBox();
        hl.addComponent(checkbox);
        hl.addComponent(info);
        hl.setExpandRatio(info, 1);
        hl.setComponentAlignment(checkbox, Alignment.MIDDLE_LEFT);
        m_selectionContainer.addItem(deleted.getStructureId());
        checkbox.setPropertyDataSource(m_selectionContainer.getItem(deleted.getStructureId()).getItemProperty(PROP_SELECTED));
        m_deletedResourceContainer.addComponent(hl);
    }
}
Also used : I_CmsResourceType(org.opencms.file.types.I_CmsResourceType) CmsResourceInfo(org.opencms.ui.components.CmsResourceInfo) I_CmsHistoryResource(org.opencms.file.history.I_CmsHistoryResource) CheckBox(com.vaadin.v7.ui.CheckBox) IndexedContainer(com.vaadin.v7.data.util.IndexedContainer) Label(com.vaadin.v7.ui.Label) CmsExplorerTypeSettings(org.opencms.workplace.explorer.CmsExplorerTypeSettings) HorizontalLayout(com.vaadin.v7.ui.HorizontalLayout)

Example 72 with HorizontalLayout

use of com.vaadin.v7.ui.HorizontalLayout in project opencms-core by alkacon.

the class CmsDeleteDialog method indent.

/**
 * Indents a resources box.<p>
 *
 * @param resourceInfo the resource box
 *
 * @return an indented resource box
 */
private Component indent(CmsResourceInfo resourceInfo) {
    boolean simple = false;
    if (simple) {
        return resourceInfo;
    } else {
        HorizontalLayout hl = new HorizontalLayout();
        Label label = new Label("");
        label.setWidth("35px");
        hl.addComponent(label);
        hl.addComponent(resourceInfo);
        hl.setExpandRatio(resourceInfo, 1.0f);
        hl.setWidth("100%");
        return hl;
    }
}
Also used : Label(com.vaadin.v7.ui.Label) HorizontalLayout(com.vaadin.v7.ui.HorizontalLayout)

Example 73 with HorizontalLayout

use of com.vaadin.v7.ui.HorizontalLayout in project opencms-core by alkacon.

the class CmsFlushCache method getButtonLayout.

/**
 * Creates the button layout.<p>
 *
 * @param size number ob buttons per line
 * @param clickedRunnable click runnable
 * @return VerticalLayout
 */
protected static VerticalLayout getButtonLayout(int size, final Runnable clickedRunnable) {
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
    Button clean_flex = getFlushButton(Messages.GUI_CACHE_FLEXCACHE_CLEAN_ADMIN_TOOL_NAME_0, Messages.GUI_CACHE_FLEXCACHE_CLEAN_ADMIN_TOOL_HELP_0, new CmsFlexCacheCleanDialog(), clickedRunnable);
    Button clean_image = getFlushButton(Messages.GUI_CACHE_IMAGECACHE_CLEAN_ADMIN_TOOL_NAME_0, Messages.GUI_CACHE_IMAGECACHE_CLEAN_ADMIN_TOOL_HELP_0, new CmsImageCacheCleanDialog(), clickedRunnable);
    Button clean_core = getFlushButton(Messages.GUI_CACHE_CORECACHE_CLEAN_ADMIN_TOOL_NAME_0, Messages.GUI_CACHE_CORECACHE_CLEAN_ADMIN_TOOL_HELP_0, new CmsConfirmSimpleFlushDialog(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_CORECACHE_CLEAN_ADMIN_TOOL_CONF_0)), new Runnable() {

        public void run() {
            OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_CLEAR_CACHES, null));
            clickedRunnable.run();
        }
    });
    Button clean_repo = getFlushButton(Messages.GUI_CACHE_JSP_REPOSITORY_ADMIN_TOOL_NAME_0, Messages.GUI_CACHE_JSP_REPOSITORY_ADMIN_TOOL_HELP_0, new CmsConfirmSimpleFlushDialog(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_JSP_REPOSITORY_ADMIN_TOOL_CONF_0)), new Runnable() {

        public void run() {
            OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY, Collections.<String, Object>emptyMap()));
            OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR, Collections.<String, Object>singletonMap("action", new Integer(CmsFlexCache.CLEAR_ENTRIES))));
            clickedRunnable.run();
        }
    });
    Button reini = getFlushButton(Messages.GUI_CACHE_REINI_TOOL_NAME_0, Messages.GUI_CACHE_REINI_TOOL_NAME_HELP_0, new CmsConfirmSimpleFlushDialog(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_REINI_TOOL_CONF_0)), new Runnable() {

        public void run() {
            try {
                // re-initialize the workplace
                OpenCms.getWorkplaceManager().initialize(A_CmsUI.getCmsObject());
                // fire "clear caches" event to reload all cached resource bundles
                OpenCms.fireCmsEvent(I_CmsEventListener.EVENT_CLEAR_CACHES, new HashMap<String, Object>());
                clickedRunnable.run();
            } catch (CmsException e) {
                LOG.error("Unable to reinitialize workspace", e);
            }
        }
    });
    List<Component> elements = new ArrayList<Component>();
    elements.add(clean_core);
    elements.add(clean_flex);
    elements.add(clean_image);
    elements.add(reini);
    elements.add(clean_repo);
    HorizontalLayout row = new HorizontalLayout();
    row.setSpacing(true);
    for (int i = 0; i < elements.size(); i++) {
        if (size > 0) {
            row.addComponent(elements.get(i));
            if (((i % (size - 1)) == 0) & (i > 0)) {
                layout.addComponent(row);
                row = new HorizontalLayout();
                row.setSpacing(true);
            }
        } else {
            layout.addComponent(elements.get(i));
        }
    }
    return layout;
}
Also used : HashMap(java.util.HashMap) CmsEvent(org.opencms.main.CmsEvent) ArrayList(java.util.ArrayList) HorizontalLayout(com.vaadin.v7.ui.HorizontalLayout) Button(com.vaadin.ui.Button) CmsException(org.opencms.main.CmsException) VerticalLayout(com.vaadin.v7.ui.VerticalLayout) Component(com.vaadin.ui.Component)

Example 74 with HorizontalLayout

use of com.vaadin.v7.ui.HorizontalLayout in project opencms-core by alkacon.

the class CmsCacheAdminApp method getStartComponent.

/**
 * Creates the component to be shown on accessing the app with some statistical information about the caches.<p>
 *
 * @return a vaadin vertical layout component
 */
private Component getStartComponent() {
    VerticalLayout outerouter = new VerticalLayout();
    VerticalLayout outer = new VerticalLayout();
    outer.setSizeUndefined();
    HorizontalLayout layout = new HorizontalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
    // Statistic about heap space
    layout.addComponent(getJavaCacheStatsPanel());
    Panel flex = new Panel();
    // flex.setWidth("400px");
    flex.setContent(CmsCacheViewApp.getFlexStatisticButton().getInfoLayout());
    flex.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_FLEX_0));
    HorizontalLayout flush = new HorizontalLayout();
    flush.addComponent(new CmsFlushCache());
    flush.setMargin(true);
    layout.addComponent(flex);
    outer.addComponent(flush);
    outer.addComponent(layout);
    outerouter.addStyleName("o-center");
    outerouter.addComponent(outer);
    return outerouter;
}
Also used : Panel(com.vaadin.ui.Panel) VerticalLayout(com.vaadin.v7.ui.VerticalLayout) HorizontalLayout(com.vaadin.v7.ui.HorizontalLayout)

Aggregations

HorizontalLayout (com.vaadin.ui.HorizontalLayout)53 Button (com.vaadin.ui.Button)37 Label (com.vaadin.ui.Label)32 VerticalLayout (com.vaadin.ui.VerticalLayout)32 ComboBox (com.vaadin.v7.ui.ComboBox)29 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)29 CssStyles (de.symeda.sormas.ui.utils.CssStyles)29 Alignment (com.vaadin.ui.Alignment)28 ValoTheme (com.vaadin.ui.themes.ValoTheme)28 Captions (de.symeda.sormas.api.i18n.Captions)28 ButtonHelper (de.symeda.sormas.ui.utils.ButtonHelper)27 FacadeProvider (de.symeda.sormas.api.FacadeProvider)26 Strings (de.symeda.sormas.api.i18n.Strings)26 VaadinIcons (com.vaadin.icons.VaadinIcons)25 UserProvider (de.symeda.sormas.ui.UserProvider)25 ControllerProvider (de.symeda.sormas.ui.ControllerProvider)24 ComboBoxHelper (de.symeda.sormas.ui.utils.ComboBoxHelper)23 MenuBar (com.vaadin.ui.MenuBar)22 UserRight (de.symeda.sormas.api.user.UserRight)22 ViewModelProviders (de.symeda.sormas.ui.ViewModelProviders)22