use of com.vaadin.ui.CssLayout in project opencms-core by alkacon.
the class CmsSitemapTreeController method createNode.
/**
* Creates a sitemap tree node widget from a tree node bean.<p>
*
* @param entry the tree node bean
* @return the tree node widget
*/
public CmsSitemapTreeNode createNode(final CmsSitemapTreeNodeData entry) {
final CmsSitemapTreeNode node = new CmsSitemapTreeNode();
node.addLayoutClickListener(new LayoutClickListener() {
private static final long serialVersionUID = 1L;
@SuppressWarnings("synthetic-access")
public void layoutClick(LayoutClickEvent event) {
Component currentComponent = event.getClickedComponent();
if (currentComponent != null) {
boolean linked = false;
do {
currentComponent = currentComponent.getParent();
if ((currentComponent != null) && "linked".equals(((AbstractComponent) currentComponent).getData())) {
linked = true;
}
if (event.getClickedComponent() instanceof CmsResourceIcon) {
if (currentComponent == node) {
openTargetPage((CmsSitemapTreeNodeData) (node.getData()), linked);
} else if (currentComponent instanceof CmsSitemapTreeNode) {
break;
}
}
} while (currentComponent != null);
}
}
});
Resource icon = CmsResourceIcon.getSitemapResourceIcon(A_CmsUI.getCmsObject(), entry.getResource(), IconMode.localeCompare);
CmsResourceInfo info = new CmsResourceInfo(entry.getClientEntry().getTitle(), entry.getClientEntry().getSitePath(), icon);
info = CmsResourceInfo.createSitemapResourceInfo(entry.getResource(), OpenCms.getSiteManager().getSiteForRootPath(m_localeContext.getRoot().getRootPath()));
info.getResourceIcon().addStyleName(OpenCmsTheme.POINTER);
info.getResourceIcon().setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_OPEN_PAGE_0));
if (entry.getClientEntry().isHiddenNavigationEntry()) {
info.addStyleName(OpenCmsTheme.RESOURCE_INFO_WEAK);
}
final MenuBar menu = new MenuBar();
boolean noTranslation = false;
noTranslation = entry.isMarkedNoTranslation(m_localeContext.getComparisonLocale());
final MenuItem main = menu.addItem("", null);
main.setIcon(FontOpenCms.CONTEXT_MENU);
CssLayout rightSide = new CssLayout();
info.setButtonWidget(rightSide);
rightSide.addComponent(menu);
main.setCommand(new Command() {
/**
* Serial version id.
*/
private static final long serialVersionUID = 1L;
public void menuSelected(MenuItem selectedItem) {
List<I_CmsSimpleContextMenuEntry<MenuContext>> entries = Arrays.asList(new EntryOpen(), new EntryExplorer(), new EntryProperties(), new EntryLink(), new EntryUnlink(), new EntryMark(), new EntryRemoveMark(), new EntryCopy(), new EntryInfo());
MenuContext context = new MenuContext(entry, node);
m_menu.setEntries(entries, context);
m_menu.open(menu);
}
});
menu.addStyleName("borderless o-toolbar-button o-resourceinfo-toolbar");
if (entry.isLinked()) {
CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(m_localeContext.getRoot().getRootPath());
CmsResourceInfo linkedInfo = CmsResourceInfo.createSitemapResourceInfo(readSitemapEntryFolderIfPossible(entry.getLinkedResource()), site);
linkedInfo.addStyleName(OpenCmsTheme.RESOURCE_INFO_DIRECTLINK);
rightSide.addComponent(linkedInfo, 0);
linkedInfo.setWidth(RHS_WIDTH + "px");
node.setContent(info);
// Data used by click handler to distinguish clicked resource icons
linkedInfo.setData("linked");
linkedInfo.getResourceIcon().setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_OPEN_PAGE_0));
linkedInfo.getResourceIcon().addStyleName(OpenCmsTheme.POINTER);
} else {
if (noTranslation) {
CmsResourceInfo noTranslationInfo = new CmsResourceInfo();
String topMessage = CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_NO_TRANSLATION_TOP_0);
String bottomMessage = CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_NO_TRANSLATION_BOTTOM_0);
noTranslationInfo.getTopLine().setValue(topMessage);
noTranslationInfo.getBottomLine().setValue(bottomMessage);
noTranslationInfo.getResourceIcon().setValue("<span class=\"" + OpenCmsTheme.RESOURCE_ICON + " " + OpenCmsTheme.NO_TRANSLATION_ICON + "\">" + FontAwesome.BAN.getHtml() + "</span>");
noTranslationInfo.addStyleName(OpenCmsTheme.RESOURCE_INFO_DIRECTLINK);
noTranslationInfo.setWidth(RHS_WIDTH + "px");
rightSide.addComponent(noTranslationInfo, 0);
}
node.setContent(info);
}
if (entry.hasNoChildren()) {
node.setOpen(true);
node.setOpenerVisible(false);
}
node.setData(entry);
return node;
}
use of com.vaadin.ui.CssLayout in project cuba by cuba-platform.
the class CubaTokenList method initField.
protected void initField() {
if (editor == null) {
editor = new CssLayout();
editor.setWidthUndefined();
editor.setStyleName(TOKENLIST_EDITOR_STYLENAME);
}
editor.removeAllComponents();
if (!owner.isSimple()) {
owner.lookupPickerField.setWidthAuto();
editor.addComponent(WebComponentsHelper.getComposition(owner.lookupPickerField));
}
owner.lookupPickerField.setVisible(!owner.isSimple());
owner.addButton.setVisible(owner.isSimple());
owner.addButton.setStyleName(ADD_BTN_STYLENAME);
if (addButtonSub != null) {
addButtonSub.remove();
}
if (!owner.isSimple()) {
addButtonSub = owner.addButton.addClickListener(e -> {
if (owner.isEditableWithParent()) {
owner.addValueFromLookupPickerField();
}
owner.addButton.focus();
});
} else {
addButtonSub = owner.addButton.addClickListener(e -> owner.openLookup(() -> owner.addButton.focus()));
}
Button vAddButton = owner.addButton.unwrapOrNull(Button.class);
if (vAddButton != null) {
editor.addComponent(vAddButton);
}
owner.clearButton.setVisible(owner.clearEnabled);
owner.clearButton.setStyleName(CLEAR_BTN_STYLENAME);
if (clearBtnClickSubscription != null) {
clearBtnClickSubscription.remove();
}
clearBtnClickSubscription = owner.clearButton.addClickListener(e -> {
clearValue();
owner.clearButton.focus();
});
com.vaadin.ui.Button vClearButton = owner.clearButton.unwrapOrNull(com.vaadin.ui.Button.class);
editor.addComponent(vClearButton);
}
use of com.vaadin.ui.CssLayout in project cuba by cuba-platform.
the class CubaCurrencyField method initLayout.
protected void initLayout() {
container = new CssLayout();
container.setSizeFull();
container.setPrimaryStyleName(CURRENCYFIELD_LAYOUT_STYLENAME);
container.addComponent(currencyLabel);
if (useWrapper()) {
ie9InputWrapper = new CssLayout(textField);
ie9InputWrapper.setSizeFull();
ie9InputWrapper.setPrimaryStyleName(IE9_INPUT_WRAP_STYLENAME);
container.addComponent(ie9InputWrapper);
} else {
container.addComponent(textField);
}
setFocusDelegate(textField);
}
use of com.vaadin.ui.CssLayout in project cuba by cuba-platform.
the class CubaFileUploadWrapper method initLayout.
protected void initLayout(UploadComponent uploadComponent) {
this.uploadButton = uploadComponent;
container = new CssLayout();
container.addStyleName("c-fileupload-container");
fileNameButton = new CubaButton();
fileNameButton.setWidth(100, Unit.PERCENTAGE);
fileNameButton.addStyleName(ValoTheme.BUTTON_LINK);
fileNameButton.addStyleName("c-fileupload-filename");
setFileNameButtonCaption(null);
container.addComponent(fileNameButton);
container.addComponent(uploadComponent);
clearButton = new CubaButton("");
clearButton.setStyleName("c-fileupload-clear");
container.addComponent(clearButton);
setShowClearButton(showClearButton);
setShowFileName(false);
setWidthUndefined();
}
use of com.vaadin.ui.CssLayout in project cuba by cuba-platform.
the class WindowBreadCrumbs method createLinksLayout.
protected Layout createLinksLayout() {
CssLayout linksLayout = new CssLayout();
linksLayout.setPrimaryStyleName("c-breadcrumbs");
return linksLayout;
}
Aggregations