public CategoriesList(Resources resources) { this.resources = resources; this.categoryNodeElements = new ArrayList<>(); rootPanel = new FlowPanel(); rootPanel.setStyleName(resources.defaultCategoriesListCss().rootPanel()); initWidget(rootPanel); scrollPanel = new FlowPanel(); scrollPanel.setStyleName(resources.defaultCategoriesListCss().scrollPanel()); rootPanel.add(scrollPanel); lockPanel = new FlowPanel(); lockPanel.setStyleName(resources.defaultCategoriesListCss().lockPanel()); lockPanel.setVisible(false); rootPanel.add(lockPanel); selectionManager = new SelectionManager(); }
CategoryRenderer renderer = category.getRenderer(); this.resources = resources; setStyleName(resources.defaultCategoriesListCss().category()); FlowPanel header = new FlowPanel(); header.sinkEvents(Event.ONCLICK); header.setStyleName(resources.defaultCategoriesListCss().categoryHeader()); SpanElement label = Document.get().createSpanElement(); label.setClassName(resources.defaultCategoriesListCss().categoryLabel()); expandControl.setClassName(resources.defaultCategoriesListCss().expandControl()); header.getElement().appendChild(expandControl); container = new FocusPanel(); container.setTabIndex(1); container.setStyleName(resources.defaultCategoriesListCss().itemContainer()); container.sinkEvents(Event.ONCLICK); container.addDomHandler( renderChildren(); if (renderChildren) { expandControl.addClassName(resources.defaultCategoriesListCss().expandedImage()); } else { expandOrCollapse();
public void inject() { resources.coreCss().ensureInjected(); windowClientBundle.getStyle().ensureInjected(); resources.treeCss().ensureInjected(); resources.defaultSimpleListCss().ensureInjected(); resources.partStackCss().ensureInjected(); resources.dialogBox().ensureInjected(); resources.clipboardCss().ensureInjected(); resources.notificationCss().ensureInjected(); resources.dataGridStyle().ensureInjected(); resources.cellTableStyle().ensureInjected(); resources.defaultCategoriesListCss().ensureInjected(); resources.buttonLoaderCss().ensureInjected(); resources.menuCss().ensureInjected(); resources.commandsExplorerCss().ensureInjected(); resources.commandsPaletteCss().ensureInjected(); resources.commandToolbarCss().ensureInjected(); resources.editorCss().ensureInjected(); resources.commandTypeChooserCss().ensureInjected(); resources.treeStylesCss().ensureInjected(); } }
private Element renderCategoryHeader(String category) { SpanElement categoryElement = Document.get().createSpanElement(); categoryElement.setClassName(resources.defaultCategoriesListCss().headerText()); SpanElement iconElement = Document.get().createSpanElement(); categoryElement.appendChild(iconElement); SpanElement textElement = Document.get().createSpanElement(); categoryElement.appendChild(textElement); textElement.setInnerText(category); Icon icon = iconRegistry.getIconIfExist(category + ".samples.category.icon"); if (icon != null) { final SVGImage iconSVG = icon.getSVGImage(); if (iconSVG != null) { iconElement.appendChild(iconSVG.getElement()); return categoryElement; } } return categoryElement; }
private void expandOrCollapse() { if (!expanded) { expanded = true; if (container.getElement().getChildCount() == 0) { renderChildren(); } animator.show((elemental.dom.Element) container.getElement()); expandControl.addClassName(resources.defaultCategoriesListCss().expandedImage()); } else { animator.hide((elemental.dom.Element) container.getElement()); expandControl.removeClassName(resources.defaultCategoriesListCss().expandedImage()); expanded = false; } }
/** * Creates a new ListItem overlay object by creating a div element, assigning it the listItem * css class, and associating it to its data. */ public static <M> ListItem<M> create( CategoryRenderer<M> factory, CategoriesList.Css css, M data) { Element element = factory.createElement(); element.addClassName(css.categoryItem()); ListItem<M> item = ListItem.cast(element); item.setData(data); return item; }
@Override public SpanElement renderCategory(Category<ProjectImporterDescriptor> category) { SpanElement textElement = Document.get().createSpanElement(); textElement.setClassName(resources.defaultCategoriesListCss().headerText()); textElement.setInnerText(category.getTitle()); return textElement; } };