Search in sources :

Example 61 with VerticalLayout

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

the class CmsCacheViewApp method getFlexStatisticButton.

/**
 * Creates in info button for flex cache statistics.<p>
 *
 * @return CmsInfoButton
 */
protected static CmsInfoButton getFlexStatisticButton() {
    Map<String, String> infoMap = new LinkedHashMap<String, String>();
    CmsFlexCache cache = OpenCms.getFlexCache();
    CmsLruCache entryLruCache = cache.getEntryLruCache();
    infoMap.put(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_FLEXCACHE_LABEL_STATS_KEYS_0), String.valueOf(cache.keySize()));
    infoMap.put(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_FLEXCACHE_LABEL_STATS_VARIATIONS_0), String.valueOf(cache.size()));
    infoMap.put(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_FLEXCACHE_LABEL_MEMORY_MAXSIZE_0), CmsFileUtil.formatFilesize(entryLruCache.getMaxCacheCosts(), A_CmsUI.getCmsObject().getRequestContext().getLocale()));
    infoMap.put(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_FLEXCACHE_LABEL_MEMORY_CURSIZE_0), CmsFileUtil.formatFilesize(entryLruCache.getObjectCosts(), A_CmsUI.getCmsObject().getRequestContext().getLocale()));
    CmsInfoButton info = new CmsInfoButton(infoMap);
    VerticalLayout prog = new VerticalLayout();
    Label label = new Label();
    label.setContentMode(ContentMode.HTML);
    label.setValue("<p>" + CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_FLEXCACHE_LABEL_MEMORY_BLOCK_0) + "</p>");
    prog.addComponent(label);
    prog.addComponent(getProgressBar((float) entryLruCache.getObjectCosts() / (float) entryLruCache.getMaxCacheCosts()));
    info.addAdditionalElement(prog, 0);
    info.setWindowCaption(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_FLEX_0));
    info.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_FLEX_0));
    return info;
}
Also used : Label(com.vaadin.v7.ui.Label) VerticalLayout(com.vaadin.v7.ui.VerticalLayout) CmsFlexCache(org.opencms.flex.CmsFlexCache) CmsLruCache(org.opencms.cache.CmsLruCache) LinkedHashMap(java.util.LinkedHashMap) CmsInfoButton(org.opencms.ui.components.CmsInfoButton)

Example 62 with VerticalLayout

use of com.vaadin.v7.ui.VerticalLayout 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 63 with VerticalLayout

use of com.vaadin.v7.ui.VerticalLayout 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

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