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