private void loadPrimary(Button resultComponent, Element element) { String primary = element.attributeValue("primary"); if (Boolean.parseBoolean(primary)) { resultComponent.addStyleName("c-primary-action"); } } }
protected Button createCaptionButton(DashboardLayout layout) { Button captionButton = factory.createComponent(Button.class); captionButton.addStyleName(DashboardStyleConstants.DASHBOARD_EDIT_BUTTON); captionButton.setCaption(layout.getCaption()); return captionButton; }
protected Button createButton(Action action) { Button removeButton = factory.createComponent(Button.class); removeButton.setAction(action); removeButton.addStyleName(DashboardStyleConstants.DASHBOARD_EDIT_BUTTON); removeButton.setIcon(action.getIcon()); removeButton.setCaption(""); return removeButton; }
protected void displayInstances(SearchResult searchResult, String entityName, CssLayout instancesLayout) { Set<SearchResultEntry> entries = searchResult.getEntries(entityName); for (SearchResultEntry entry : entries) { Button instanceBtn = createInstanceButton(entityName, entry); instanceBtn.setAlignment(Alignment.MIDDLE_LEFT); instanceBtn.addStyleName("c-fts-entity"); instancesLayout.add(instanceBtn); HitInfo hi = searchResult.getHitInfo(entry.getId(), entityName); if (hi != null) { List<String> list = new ArrayList<>(hi.getHits().size()); for (Map.Entry<String, String> hitEntry : hi.getHits().entrySet()) { String hitProperty = hitEntry.getKey(); list.add(ftsService.getHitPropertyCaption(entityName, hitProperty) + ": " + hitEntry.getValue()); } Collections.sort(list); for (String caption : list) { Label hitLabel = createHitLabel(caption); hitLabel.addStyleName("c-fts-hit"); hitLabel.addStyleName("fts-hit"); hitLabel.setAlignment(Alignment.MIDDLE_LEFT); instancesLayout.add(hitLabel); } } } }