/** * Returns the id of the referenced component, or null if there is no referenced component. */ @Override public String getId() { return component == null ? null : component.getId(); }
@Override public String getId() { return component.getId() + "-" + subId; } }
/** * Invokes a client-side print request. * * @param printRoot Root component for printing. * @param title Optional title text. * @param header Header to print at top of first page. * @param styleSheet Style sheet to be applied. * @param preview If true, show print preview. */ public static void print(BaseComponent printRoot, String title, String header, String styleSheet, boolean preview) { List<String> content = new ArrayList<>(); if (header != null && !header.isEmpty()) { content.add("$report_headers $" + header); } if (title != null && !title.isEmpty()) { content.add( "<div><div class='cwf-reporting-header-title'>" + StringEscapeUtils.escapeHtml(title) + "</div></div>"); } content.add("#" + printRoot.getId()); // ClientUtil.printToClient(content, StrUtil.toList(styleSheet, ","), preview); }
/** * Create an event of the specified type, target, related target, and data. * * @param type The event type. * @param target The target of the event. * @param relatedTarget The related target that participated in the event. * @param data Arbitrary data to associate with the event. */ public Event(String type, BaseComponent target, BaseComponent relatedTarget, Object data) { this.type = type; this.target = target; this.targetId = target == null ? null : target.getId(); this.data = data; this.currentTarget = target; this.relatedTarget = relatedTarget; this.page = target != null ? target.getPage() : null; this.page = this.page == null ? ExecutionContext.getPage() : this.page; }
/** * Registers/unregisters a component newly attached to this page. * * @param component Component to register/unregister. * @param register If true, register the component. If false, unregister it. */ /*package*/ void registerComponent(BaseComponent component, boolean register) { if (getId() == null) { return; } String id = component.getId(); if (id == null) { id = nextComponentId(); component._setId(id); } if (register) { ids.put(id, component); } else { ids.remove(id); } Event event = new Event(register ? "register" : "unregister", this, component); fireEvent(event); }