use of org.opencms.ui.components.CmsInfoButton in project opencms-core by alkacon.
the class CmsCacheViewApp method getImageStatisticButton.
/**
* Creates in info button for image cache statistics.<p>
*
* @return CmsInfoButton
*/
protected static CmsInfoButton getImageStatisticButton() {
long size = 0L;
if (new File(CmsImageLoader.getImageRepositoryPath()).exists()) {
size = FileUtils.sizeOfDirectory(new File(CmsImageLoader.getImageRepositoryPath()));
}
Map<String, String> infoMap = new LinkedHashMap<String, String>();
infoMap.put(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_IMAGECACHE_LABEL_MEMORY_BLOCK_0), CmsFileUtil.formatFilesize(size, A_CmsUI.getCmsObject().getRequestContext().getLocale()));
CmsInfoButton info = new CmsInfoButton(infoMap);
info.setWindowCaption(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_IMAGE_0));
info.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_IMAGE_0));
return info;
}
use of org.opencms.ui.components.CmsInfoButton in project opencms-core by alkacon.
the class CmsCacheViewApp method getJavaStatisticButton.
/**
* Creates in info button for java cache statistics.<p>
* @param memory memory object
*
* @return CmsInfoButton
*/
public static CmsInfoButton getJavaStatisticButton(CmsMemoryStatus memory) {
Map<String, String> infoMap = new LinkedHashMap<String, String>();
infoMap.put(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_JAVA_HEAP_MAX_0), CmsFileUtil.formatFilesize(memory.getMaxMemory() * 1048576, A_CmsUI.getCmsObject().getRequestContext().getLocale()));
infoMap.put(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_JAVA_HEAP_TOTAL_0), CmsFileUtil.formatFilesize(memory.getTotalMemory() * 1048576, A_CmsUI.getCmsObject().getRequestContext().getLocale()));
infoMap.put(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_JAVA_HEAP_USED_0), CmsFileUtil.formatFilesize(memory.getUsedMemory() * 1048576, A_CmsUI.getCmsObject().getRequestContext().getLocale()));
infoMap.put(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_JAVA_HEAP_FREE_0), CmsFileUtil.formatFilesize(memory.getFreeMemory() * 1048576, 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) memory.getUsage() / 100))));
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 org.opencms.ui.components.CmsInfoButton in project opencms-core by alkacon.
the class CmsAccountsApp method iniButtons.
/**
* Initializes the toolbar buttons.<p>
*/
private void iniButtons() {
m_newButton = CmsToolBar.createButton(FontOpenCms.WAND, CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_ADD_ELEMENT_0));
m_newButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
openNewDialog();
}
});
m_infoButton = new CmsInfoButton();
Button csvButton = new Button(CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_EXPORT_ONLY_USER_0));
csvButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 5472430305539438757L;
public void buttonClick(ClickEvent event) {
boolean includeTechnicalFields = false;
try {
OpenCms.getRoleManager().checkRole(m_cms, CmsRole.ADMINISTRATOR);
includeTechnicalFields = true;
} catch (CmsRoleViolationException e) {
// ok
}
Window window = CmsBasicDialog.prepareWindow(DialogWidth.wide);
CmsUserCsvExportDialog dialog = new CmsUserCsvExportDialog(getFullUser(getVisibleUser()), m_stateBean.getPath(), m_stateBean.getType(), getElementName(m_stateBean), CmsVaadinUtils.isButtonPressed(getToggleButton(m_stateBean)), window, includeTechnicalFields);
window.setContent(dialog);
A_CmsUI.get().addWindow(window);
}
});
m_infoButton.setAdditionalButton(csvButton);
m_addElementButton = CmsToolBar.createButton(FontAwesome.PLUS, CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_ADD_USER_TO_GROUP_0));
m_addElementButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1859694635385726953L;
public void buttonClick(ClickEvent event) {
openAddUserDialog();
}
});
m_toggleButtonRole = CmsToolBar.createButton(FontOpenCms.USERS, CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_ROLES_TOGGLE_0));
m_toggleButtonRole.addClickListener(new ClickListener() {
private static final long serialVersionUID = 8265075332953321274L;
public void buttonClick(ClickEvent event) {
toggleTable(m_toggleButtonRole);
}
});
m_toggleButtonUser = CmsToolBar.createButton(FontOpenCms.USERS, CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_TOGGLE_0));
m_toggleButtonUser.addClickListener(new ClickListener() {
private static final long serialVersionUID = 8265075332953321274L;
public void buttonClick(ClickEvent event) {
toggleTable(m_toggleButtonUser);
}
});
m_toggleButtonGroups = CmsToolBar.createButton(FontOpenCms.USERS, CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_GROUPS_TOGGLE_0));
m_toggleButtonGroups.addClickListener(new ClickListener() {
private static final long serialVersionUID = 8265075332953321274L;
public void buttonClick(ClickEvent event) {
toggleTable(m_toggleButtonGroups);
}
});
m_uiContext.addToolbarButton(m_newButton);
m_uiContext.addToolbarButton(m_addElementButton);
m_uiContext.addToolbarButton(m_infoButton);
m_uiContext.addToolbarButton(m_toggleButtonRole);
m_uiContext.addToolbarButton(m_toggleButtonUser);
m_uiContext.addToolbarButton(m_toggleButtonGroups);
for (Button button : getAdditionalButtons()) {
m_uiContext.addToolbarButton(button);
}
m_filter = CmsVaadinUtils.getOUComboBox(m_cms, m_baseOU, LOG);
m_filter.setWidth("379px");
m_infoLayout.addComponent(m_filter, 0);
m_filterTable = new TextField();
m_filterTable.setIcon(FontOpenCms.FILTER);
m_filterTable.setInputPrompt(Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_FILTER_0));
m_filterTable.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
// m_filterTable.setWidth("200px");
m_filterTable.addTextChangeListener(new TextChangeListener() {
private static final long serialVersionUID = 1L;
public void textChange(TextChangeEvent event) {
filterTable(event.getText());
}
});
m_filterTable.setWidth("200px");
m_infoLayout.addComponent(m_filterTable);
m_infoLayout.addStyleName("o-many-elements");
m_filter.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
if ((m_stateBean.getType() != null) & !m_doNotChange) {
update((String) event.getProperty().getValue(), CmsOuTreeType.OU, null);
} else {
//
}
}
});
if (!m_ouHandler.isOUManagable(m_stateBean.getPath())) {
boolean change = m_doNotChange;
m_doNotChange = false;
m_filter.select(m_filter.getItemIds().iterator().next());
m_doNotChange = change;
}
}
use of org.opencms.ui.components.CmsInfoButton in project opencms-core by alkacon.
the class CmsProjectManager method showNavButtons.
/**
* Shows the sub navigation buttons.<p>
*/
private void showNavButtons() {
if (m_navButtons.isEmpty()) {
Button addProject = CmsToolBar.createButton(FontOpenCms.WAND, CmsVaadinUtils.getMessageText(Messages.GUI_PROJECTS_ADD_0));
addProject.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
Window window = CmsBasicDialog.prepareWindow(DialogWidth.wide);
CmsEditProjectForm form = new CmsEditProjectForm(m_projectsTable, window);
window.setContent(form);
window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_PROJECTS_ADD_0));
A_CmsUI.get().addWindow(window);
window.center();
}
});
m_uiContext.addToolbarButton(addProject);
m_navButtons.add(addProject);
Button history = CmsToolBar.createButton(FontOpenCms.CLIPBOARD, CmsVaadinUtils.getMessageText(Messages.GUI_PROJECTS_HISTORY_0));
history.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
openSubView(CmsProjectManager.PATH_NAME_HISTORY, true);
}
});
m_uiContext.addToolbarButton(history);
m_navButtons.add(history);
try {
Map<String, String> infos = new LinkedHashMap<String, String>();
infos.put(CmsVaadinUtils.getMessageText(Messages.GUI_PROJECTS_STATISTICS_COUNT_0), String.valueOf(OpenCms.getOrgUnitManager().getAllManageableProjects(A_CmsUI.getCmsObject(), "", true).size()));
CmsInfoButton infoButton = new CmsInfoButton(infos);
infoButton.setWindowCaption(CmsVaadinUtils.getMessageText(Messages.GUI_PROJECTS_STATISTICS_0));
infoButton.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_PROJECTS_STATISTICS_0));
m_uiContext.addToolbarButton(infoButton);
} catch (CmsException e) {
LOG.error("unable to get orgunit manager", e);
}
} else {
for (Component button : m_navButtons) {
button.setVisible(true);
}
}
}
use of org.opencms.ui.components.CmsInfoButton 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;
}
Aggregations