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;
}
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;
}
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;
}
Aggregations