public Html(String content) { super(); setContent(content); }
/** * Sets the URL of external HTML content. * * @param src URL of external HTML content. */ @PropertySetter(value = "src", description = "The URL of external HTML content.") public void setSrc(String src) { src = nullify(src); if (src != null) { super.setContent(null); } propertyChange("src", this.src, this.src = src, isContentSynced()); }
/** * Sets the HTML content. * * @see org.fujion.component.BaseComponent#setContent(java.lang.String) */ @PropertySetter(value = "content", description = "The text content associated with this component.") @Override public void setContent(String content) { content = nullify(content); if (content != null) { setSrc(null); } super.setContent(content); }
/** * Returns a component of a type suitable for displaying the specified text. For text that is a * URL, returns a hyperlink. For text that begins with <html>, returns an HTML component. * All other text returns a label. * * @param text Text to be displayed. * @return BaseComponent of the appropriate type. */ public static BaseComponent getTextComponent(String text) { String frag = text == null ? "" : StringUtils.substring(text, 0, 20).toLowerCase(); if (frag.contains("<html>")) { return new Html(text); } if (frag.matches("^https?:\\/\\/.+$")) { Hyperlink link = new Hyperlink(); link.setHref(text); link.setTarget("_blank"); return link; } return new Cell(text); }
/** * Show detail for specified component. * * @param item The component containing the model object. */ protected void showDetail(BaseComponent item) { @SuppressWarnings("unchecked") M modelObject = item == null ? null : (M) item.getData(); String detail = modelObject == null ? null : getDetail(modelObject); if (!StringUtils.isEmpty(detail)) { if (getShowDetailPane()) { detailView.setContent(detail); } else { Map<String, Object> map = new HashMap<>(); map.put("title", detailTitle); map.put("content", detail); map.put("allowPrint", getAllowPrint()); try { Window window = (Window) PageUtil .createPage(Constants.RESOURCE_PREFIX + "resourceListDetailPopup.fsp", null, map).get(0); window.modal(null); } catch (Exception e) { DialogUtil.showError(e); } } } }
/** * Override load list to clear display if no patient in context. */ @Override protected void loadData() { if (patient == null) { asyncAbort(); reset(); status("No patient selected."); } else { super.loadData(); } detailView.setContent(null); }
@Override public void afterInitialized(BaseComponent root) { window = (Window) root; window.setTitle(root.getAttribute("title", "")); btnPrint.setVisible(root.getAttribute("allowPrint", false)); String text = root.getAttribute("text", ""); if (text.startsWith("<html>")) { cmpHtml.setContent(text); } else { cmpText.setLabel(text); } }