code
stringlengths
73
34.1k
label
stringclasses
1 value
public static Ellipsoid of( final String name, final double a, final double b, final double f ) { return new Ellipsoid(name, a, b, f); }
java
@Deprecated public static Builder builder(final String version, final String creator) { return new Builder(Version.of(version), creator); }
java
public static Reader reader(final Version version, final Mode mode) { return new Reader(GPX.xmlReader(version), mode); }
java
public static Reader reader(final Version version) { return new Reader(GPX.xmlReader(version), Mode.STRICT); }
java
public static Reader reader(final Mode mode) { return new Reader(GPX.xmlReader(Version.V11), mode); }
java
public String toPattern() { return _formats.stream() .map(Objects::toString) .collect(Collectors.joining()); }
java
static String readString(final DataInput in) throws IOException { final byte[] bytes = new byte[readInt(in)]; in.readFully(bytes); return new String(bytes, "UTF-8"); }
java
static <T> void writes( final Collection<? extends T> elements, final Writer<? super T> writer, final DataOutput out ) throws IOException { writeInt(elements.size(), out); for (T element : elements) { writer.write(element, out); } }
java
static <T> List<T> reads( final Reader<? extends T> reader, final DataInput in ) throws IOException { final int length = readInt(in); final List<T> elements = new ArrayList<>(length); for (int i = 0; i < length; ++i) { elements.add(reader.read(in)); } return elements; }
java
public double to(final Unit unit) { requireNonNull(unit); return unit.convert(_value, Unit.METERS_PER_SECOND); }
java
public static <T extends Serializable> Flowable<T> write(final Flowable<T> source, final File file) { return write(source, file, false, DEFAULT_BUFFER_SIZE); }
java
@VisibleForTesting static Method getMethod(Class<?> cls, String name, Class<?>... params) { Method m; try { m = cls.getDeclaredMethod(name, params); } catch (Exception e) { throw new RuntimeException(e); } m.setAccessible(true); return m; }
java
private void mapAndSetOffset() { try { final RandomAccessFile backingFile = new RandomAccessFile(this.file, "rw"); backingFile.setLength(this.size); final FileChannel ch = backingFile.getChannel(); this.addr = (Long) mmap.invoke(ch, 1, 0L, this.size); ...
java
public void getBytes(long pos, byte[] data, long offset, long length) { unsafe.copyMemory(null, pos + addr, data, BYTE_ARRAY_OFFSET + offset, length); }
java
public Phrase put(String key, CharSequence value) { if (!keys.contains(key)) { throw new IllegalArgumentException("Invalid key: " + key); } if (value == null) { throw new IllegalArgumentException("Null value for '" + key + "'"); } keysToValues.put(key, value); // Invalidate the cach...
java
public Phrase putOptional(String key, CharSequence value) { return keys.contains(key) ? put(key, value) : this; }
java
public CharSequence format() { if (formatted == null) { if (!keysToValues.keySet().containsAll(keys)) { Set<String> missingKeys = new HashSet<String>(keys); missingKeys.removeAll(keysToValues.keySet()); throw new IllegalArgumentException("Missing keys: " + missingKeys); } ...
java
private Token token(Token prev) { if (curChar == EOF) { return null; } if (curChar == '{') { char nextChar = lookahead(); if (nextChar == '{') { return leftCurlyBracket(prev); } else if (nextChar >= 'a' && nextChar <= 'z') { return key(prev); } else { th...
java
private TextToken text(Token prev) { int startIndex = curCharIndex; while (curChar != '{' && curChar != EOF) { consume(); } return new TextToken(prev, curCharIndex - startIndex); }
java
private void consume() { curCharIndex++; curChar = (curCharIndex == pattern.length()) ? EOF : pattern.charAt(curCharIndex); }
java
private String determineLanguage(FacesContext fc, DataTable dataTable) { final List<String> availableLanguages = Arrays.asList("de", "en", "es", "fr", "hu", "it", "nl", "pl", "pt", "ru"); if (BsfUtils.isStringValued(dataTable.getCustomLangUrl())) { return dataTable.getCustomLangUrl(); } else if (BsfUtils.i...
java
public String getType() { String mode = A.asString(getAttributes().get("mode"), "badge"); return mode.equals("edit") ? "text" : "hidden"; }
java
protected void renderPassThruAttributes(FacesContext context, UIComponent component, String[] attrs, boolean shouldRenderDataAttributes) throws IOException { ResponseWriter writer = context.getResponseWriter(); if ((attrs == null || attrs.length <= 0) && shouldRenderDataAttributes == false) return; ...
java
protected void generateErrorAndRequiredClass(UIInput input, ResponseWriter rw, String clientId, String additionalClass1, String additionalClass2, String additionalClass3) throws IOException { String styleClass = getErrorAndRequiredClass(input, clientId); if (null != additionalClass1) { additionalClass1 = ...
java
public static Converter getConverter(FacesContext fc, ValueHolder vh) { // explicit converter Converter converter = vh.getConverter(); // try to find implicit converter if (converter == null) { ValueExpression expr = ((UIComponent) vh).getValueExpression("value"); if (expr != null) { Class<?>...
java
public static String getRequestParameter(FacesContext context, String name) { return context.getExternalContext().getRequestParameterMap().get(name); }
java
public static boolean beginDisabledFieldset(IContentDisabled component, ResponseWriter rw) throws IOException { if (component.isContentDisabled()) { rw.startElement("fieldset", (UIComponent) component); rw.writeAttribute("disabled", "disabled", "null"); return true; } return false; }
java
@Deprecated protected String getFormGroupWithFeedback(String additionalClass, String clientId) { if (BsfUtils.isLegacyFeedbackClassesEnabled()) { return additionalClass; } return additionalClass + " " + FacesMessages.getErrorSeverityClass(clientId); }
java
public static String getValueAsString(Object value, FacesContext ctx, DateTimePicker dtp) { // Else we use our own converter if(value == null) { return null; } Locale sloc = BsfUtils.selectLocale(ctx.getViewRoot().getLocale(), dtp.getLocale(), dtp); String javaFormatString = BsfUtils.selectJavaDateTimeForm...
java
public static String getDateAsString(FacesContext fc, DateTimePicker dtp, Object value, String javaFormatString, Locale locale) { if (value == null) { return null; } Converter converter = dtp.getConverter(); return converter == null ? getInternalDateAsString(value, javaFormatString, locale) : c...
java
private void encodeSeverityMessage(FacesContext facesContext, Growl uiGrowl, FacesMessage msg) throws IOException { ResponseWriter writer = facesContext.getResponseWriter(); String summary = msg.getSummary() != null ? msg.getSummary() : ""; String detail = msg.getDetail() != null ? msg.get...
java
private String getSeverityIcon(FacesMessage message) { if (message.getSeverity().equals(FacesMessage.SEVERITY_WARN)) return "fa fa-exclamation-triangle"; else if (message.getSeverity().equals(FacesMessage.SEVERITY_ERROR)) return "fa fa-times-circle"; else if (message.getSeverity().equals(FacesMessage.SEVERI...
java
private String getMessageType(FacesMessage message) { if (message.getSeverity().equals(FacesMessage.SEVERITY_WARN)) return "warning"; else if (message.getSeverity().equals(FacesMessage.SEVERITY_ERROR)) return "danger"; else if (message.getSeverity().equals(FacesMessage.SEVERITY_FATAL)) return "danger"; ...
java
public static void printNodeData(Node rootNode, String tab) { tab = tab == null ? "" : tab + " "; for (Node n : rootNode.getChilds()) { printNodeData(n, tab); } }
java
public static Node searchNodeById(Node rootNode, int nodeId) { if (rootNode.getNodeId() == nodeId) { return rootNode; } Node foundNode = null; for (Node n : rootNode.getChilds()) { foundNode = searchNodeById(n, nodeId); if (foundNode != null) { ...
java
public static String renderModelAsJson(Node rootNode, boolean renderRoot) { if (renderRoot) { return renderSubnodes(rootNode == null ? new ArrayList<Node>() : new ArrayList<Node>(Arrays.asList(rootNode))); } else if (rootNode != null && rootNode.hasChild()) { return renderSubnode...
java
public static void encodeDropMenuStart(DropMenu c, ResponseWriter rw, String l) throws IOException { rw.startElement("ul", c); if (c.getContentClass() != null) rw.writeAttribute("class", "dropdown-menu " + c.getContentClass(), "class"); else rw.writeAttribute("class", "dropdown-menu", "class"); if (null !...
java
private static void drawClearDiv(ResponseWriter writer, UIComponent tabView) throws IOException { writer.startElement("div", tabView); writer.writeAttribute("style", "clear:both;", "style"); writer.endElement("div"); }
java
private static void encodeTabLinks(FacesContext context, ResponseWriter writer, TabView tabView, int currentlyActiveIndex, List<UIComponent> tabs, String clientId, String hiddenInputFieldID) throws IOException { writer.startElement("ul", tabView); writer.writeAttribute("id", clientId, "id"); Tooltip.generat...
java
private static void encodeTabContentPanes(final FacesContext context, final ResponseWriter writer, final TabView tabView, final int currentlyActiveIndex, final List<UIComponent> tabs) throws IOException { writer.startElement("div", tabView); String classes = "tab-content"; if (tabView.getContentClass() != null...
java
private static void encodeTabs(final FacesContext context, final ResponseWriter writer, final List<UIComponent> children, final int currentlyActiveIndex, final String hiddenInputFieldID, final boolean disabled) throws IOException { if (null != children) { int tabIndex = 0; for (int index = 0; index < childr...
java
private static void encodeTabAnchorTag(FacesContext context, ResponseWriter writer, Tab tab, String hiddenInputFieldID, int tabindex, boolean disabled) throws IOException { writer.startElement("a", tab); writer.writeAttribute("id", tab.getClientId().replace(":", "_") + "_tab", "id"); writer.writeAttribute("rol...
java
public static int toInt(Object val) { if (val == null) { return 0; } if (val instanceof Number) { return ((Number) val).intValue(); } if (val instanceof String) { return Integer.parseInt((String) val); } throw new IllegalArgumentException(...
java
private String encodeClick(FacesContext context, Button button) { String js; String userClick = button.getOnclick(); if (userClick != null) { js = userClick; } // +COLON; } else { js = ""; } String fragment = button.getFragment(); String outcome = button.getOutcome(); if (null != outcome && out...
java
private boolean canOutcomeBeRendered(Button button, String fragment, String outcome) { boolean renderOutcome = true; if (null == outcome && button.getAttributes() != null && button.getAttributes().containsKey("ng-click")) { String ngClick = (String)button.getAttributes().get("ng-click"); if (null != ngClick &...
java
private String determineTargetURL(FacesContext context, Button button, String outcome) { ConfigurableNavigationHandler cnh = (ConfigurableNavigationHandler) context.getApplication() .getNavigationHandler(); NavigationCase navCase = cnh.getNavigationCase(context, null, outcome); /* * Param Name: javax.faces...
java
private static String getStyleClasses(Button button, boolean isResponsive) { StringBuilder sb; sb = new StringBuilder(40); // optimize int sb.append("btn"); String size = button.getSize(); if (size != null) { sb.append(" btn-").append(size); } String look = button.getLook(); if (look != null) { s...
java
public List<UIComponent> resolve(UIComponent component, List<UIComponent> parentComponents, String currentId, String originalExpression, String[] parameters) { List<UIComponent> result = new ArrayList<UIComponent>(); for (UIComponent parent : parentComponents) { UIComponent grandparent = component.getParent()...
java
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { if (!component.isRendered()) { return; } PanelGrid panelGrid = (PanelGrid) component; ResponseWriter writer = context.getResponseWriter(); boolean idHasBeenRendered=false; String...
java
protected String[] getRowClasses(PanelGrid grid) { String rowClasses = grid.getRowClasses(); if (null == rowClasses || rowClasses.trim().length()==0) return null; String[] rows = rowClasses.split(","); return rows; }
java
protected int[] getColSpanArray(PanelGrid panelGrid) { String columnsCSV = panelGrid.getColSpans(); if (null == columnsCSV || columnsCSV.trim().length()==0) { columnsCSV = panelGrid.getColumns(); if ("1".equals(columnsCSV)) { columnsCSV = "12"; } else if ("2".equals(columnsCSV)) { ...
java
protected String[] getColumnClasses(PanelGrid panelGrid, int[] colSpans) { String columnsCSV = panelGrid.getColumnClasses(); String[] columnClasses; if (null == columnsCSV || columnsCSV.trim().length()==0) columnClasses = null; else { columnClasses = columnsCSV.split(","); if (columnClasses.length > c...
java
protected void generateColumnStart(UIComponent child, String colStyleClass, ResponseWriter writer) throws IOException { writer.startElement("div", child); writer.writeAttribute("class", colStyleClass, "class"); }
java
protected void generateRowStart(ResponseWriter writer, int row, String[] rowClasses, PanelGrid panelGrid) throws IOException { writer.startElement("div", panelGrid); if (null == rowClasses) writer.writeAttribute("class", "row", "class"); else writer.writeAttribute("class", "row " + rowClasses[row % rowClass...
java
protected void generateContainerStart(ResponseWriter writer, PanelGrid panelGrid, boolean idHasBeenRendered) throws IOException { writer.startElement("div", panelGrid); if (!idHasBeenRendered) { String clientId = panelGrid.getClientId(); writer.writeAttribute("id", clientId, "id"); } writeAttribute(writer...
java
protected void renderInputTag(FacesContext context, ResponseWriter rw, String clientId, SelectBooleanCheckbox selectBooleanCheckbox) throws IOException { int numberOfDivs = 0; String responsiveStyleClass = Responsive.getResponsiveStyleClass(selectBooleanCheckbox, false).trim(); if (responsiveStyleClass.length(...
java
protected void renderInputTagEnd(ResponseWriter rw, SelectBooleanCheckbox selectBooleanCheckbox) throws IOException { rw.endElement("input"); String caption = selectBooleanCheckbox.getCaption(); if (null != caption) { if (selectBooleanCheckbox.isEscape()) { rw.writeText(" " + caption, null); } else {...
java
protected void renderInputTagValue(FacesContext context, ResponseWriter rw, SelectBooleanCheckbox selectBooleanCheckbox) throws IOException { String v = getValue2Render(context, selectBooleanCheckbox); if (v != null && "true".equals(v)) { rw.writeAttribute("checked", v, null); } }
java
public void setMask(String mask) { if (mask != null && !mask.isEmpty()) { AddResourcesListener.addResourceToHeadButAfterJQuery(C.BSF_LIBRARY, "js/jquery.inputmask.bundle.min.js"); } getStateHelper().put(PropertyKeys.mask, mask); }
java
private static String getStyleClasses(AbstractNavLink link, boolean isResponsive) { StringBuilder sb; sb = new StringBuilder(20); // optimize int String look = null; if (link instanceof Link) { look = ((Link) link).getLook(); } else if (link instanceof CommandLink) { look = ((CommandLink) link).getLook...
java
public static boolean isValued(Object obj) { if (obj == null) return false; if (obj instanceof String) return isStringValued((String) obj); return true; }
java
public static String stringOrDefault(String str, String defaultValue) { if(isStringValued(str)) return str; return defaultValue; }
java
public static String snakeCaseToCamelCase(String snakeCase) { if(snakeCase.contains("-")) { StringBuilder camelCaseStr = new StringBuilder(snakeCase.length()); boolean toUpperCase = false; for (char c : snakeCase.toCharArray()) { if (c == '-') toUpperCase = true; else { if (toUpperCase) { ...
java
public static String camelCaseToSnakeCase(String camelCase) { if (null == camelCase || camelCase.length()==0) return camelCase; StringBuilder snakeCase = new StringBuilder(camelCase.length()+3); snakeCase.append(camelCase.charAt(0)); boolean hasCamelCase=false; for (int i = 1; i < camelCase.length(); i++) ...
java
public static String escapeHtml(String htmlString) { StringBuffer sb = new StringBuffer(htmlString.length()); // true if last char was blank boolean lastWasBlankChar = false; int len = htmlString.length(); char c; for (int i = 0; i < len; i++) { c = htmlString.charAt(i); if (c == ' ') { // blan...
java
public static String escapeJQuerySpecialCharsInSelector(String selector) { String jQuerySpecialChars = "!\"#$%&'()*+,./:;<=>?@[]^`{|}~;"; String[] jsc = jQuerySpecialChars.split("(?!^)"); for(String c: jsc) { selector = selector.replace(c, "\\\\" + c); } return selector; }
java
public static UIForm getClosestForm(UIComponent component) { while (component != null) { if (component instanceof UIForm) { return (UIForm) component; } component = component.getParent(); } return null; }
java
public static String getComponentClientId(final String componentId) { FacesContext context = FacesContext.getCurrentInstance(); UIViewRoot root = context.getViewRoot(); UIComponent c = findComponent(root, componentId); if (c==null) { return null; } return c.getClientId(context); }
java
public static UIComponent findComponent(UIComponent c, String id) { if (id.equals(c.getId())) { return c; } Iterator<UIComponent> kids = c.getFacetsAndChildren(); while (kids.hasNext()) { UIComponent found = findComponent(kids.next(), id); if (found != null) { return found; } } return null; ...
java
public static String getInitParam(String param, FacesContext context) { return context.getExternalContext().getInitParameter(param); }
java
public static String resolveSearchExpressions(String refItem) { if (refItem != null) { if (refItem.contains("@") || refItem.contains("*")) { refItem = ExpressionResolver.getComponentIDs(FacesContext.getCurrentInstance(), FacesContext.getCurrentInstance().getViewRoot(), refItem); } } return refItem...
java
public static boolean isLegacyFeedbackClassesEnabled() { String legacyErrorClasses = getInitParam("net.bootsfaces.legacy_error_classes"); legacyErrorClasses=evalELIfPossible(legacyErrorClasses); return legacyErrorClasses.equalsIgnoreCase("true") || legacyErrorClasses.equalsIgnoreCase("yes"); }
java
private void encodeDefaultLanguageJS(FacesContext fc) throws IOException { ResponseWriter rw = fc.getResponseWriter(); rw.startElement("script", null); rw.write("$.datepicker.setDefaults($.datepicker.regional['" + fc.getViewRoot().getLocale().getLanguage() + "']);"); rw.endElement("script"); }
java
public static String convertFormat(String format) { if (format == null) return null; else { // day of week format = format.replaceAll("EEE", "D"); // year format = format.replaceAll("yy", "y"); // month if (format.indexOf("MMM") != -1) { format = format.replaceAll("MMM", "M"); } else { ...
java
private static String encodeVisibility(IResponsive r, String value, String prefix) { if(value == null) return ""; if ("true".equals(value) || "false".equals(value)) { throw new FacesException("The attributes 'visible' and 'hidden' don't accept boolean values. If you want to show or hide the element conditionall...
java
private static String getSize(IResponsiveLabel r, Sizes size) { String colSize = "-1"; switch(size) { case xs: colSize = r.getLabelColXs(); if(colSize.equals("-1")) colSize = r.getLabelTinyScreen(); break; case sm: colSize = r.getLabelColSm(); if(colSize.equals("-1")) colSize = r.getLabelSmallScr...
java
private static int sizeToInt(String size) { if (size==null) return -1; if ("full".equals(size)) return 12; if ("full-size".equals(size)) return 12; if ("fullSize".equals(size)) return 12; if ("full-width".equals(size)) return 12; if ("fullWidth".equals(size)) return 12; if ("half".equals(size)) return 6; ...
java
private static List<String> getSizeRange(String operation, String size) { return getSizeRange(operation, size, null); }
java
public static List<String> wonderfulTokenizer(String tokenString, String[] delimiters) { List<String> tokens = new ArrayList<String>(); String currentToken = ""; for(int i = 0; i < tokenString.length(); i++) { String _currItem = String.valueOf(tokenString.charAt(i)); if(_currItem.trim().isEmpty()) continue;...
java
public static String getResponsiveLabelClass(IResponsiveLabel r) { if(!shouldRenderResponsiveClasses(r)) { return ""; } int colxs = sizeToInt(getSize(r, Sizes.xs)); int colsm = sizeToInt(getSize(r, Sizes.sm)); int colmd = sizeToInt(getSi...
java
private static boolean shouldRenderResponsiveClasses(Object r) { // This method only checks inputs. if(r instanceof UIComponent && r instanceof IResponsiveLabel) { UIForm form = AJAXRenderer.getSurroundingForm((UIComponent) r, true); if(form instanceof Form) { ...
java
public String getSeverityName(Severity severity) { if (severity.equals(FacesMessage.SEVERITY_INFO)) { return "info"; } else if (severity.equals(FacesMessage.SEVERITY_WARN)) { return "warn"; } else if (severity.equals(FacesMessage.SEVERITY_ERROR)) { return "error"; } else if (severity.equals(FacesMessag...
java
public static ValueExpression createValueExpression(String p_expression) { FacesContext context = FacesContext.getCurrentInstance(); ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory(); ELContext elContext = context.getELContext(); ValueExpression vex = expressionFactory.create...
java
public static ValueExpression createValueExpression(String p_expression, Class<?> expectedType) { FacesContext context = FacesContext.getCurrentInstance(); ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory(); ELContext elContext = context.getELContext(); if (null == expectedTyp...
java
public static MethodExpression createMethodExpression(String p_expression, Class<?> returnType, Class<?>... parameterTypes) { FacesContext context = FacesContext.getCurrentInstance(); ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory(); ELContext elContext = context.getELConte...
java
public static NGBeanAttributeInfo getBeanAttributeInfos(UIComponent c) { String core = getCoreValueExpression(c); synchronized (beanAttributeInfos) { if (beanAttributeInfos.containsKey(c)) { return beanAttributeInfos.get(c); } } NGBeanAttributeInfo info = new NGBeanAttributeInfo(c); synchronized (be...
java
public static String getCoreValueExpression(UIComponent component) { ValueExpression valueExpression = component.getValueExpression("value"); if (null != valueExpression) { String v = valueExpression.getExpressionString(); if (null != v) { Matcher matcher = EL_EXPRESSION.matcher(v); if (matcher.find()...
java
public static Annotation[] readAnnotations(UIComponent p_component) { ValueExpression valueExpression = p_component.getValueExpression("value"); if (valueExpression != null && valueExpression.getExpressionString() != null && valueExpression.getExpressionString().length()>0) { return readAnnotations(valueExpressi...
java
public void processEvent(SystemEvent event) throws AbortProcessingException { FacesContext context = FacesContext.getCurrentInstance(); UIViewRoot root = context.getViewRoot(); // render the resources only if there is at least one bsf component if (ensureExistBootsfacesComponent(root, context)) { addCSS(roo...
java
private boolean ensureExistBootsfacesComponent(UIViewRoot root, FacesContext context) { Map<String, Object> viewMap = root.getViewMap(); // check explicit js request if (viewMap.get(RESOURCE_KEY) != null) return true; // check explicit css request if (viewMap.get(THEME_RESOURCE_KEY) != null) return tru...
java
public static UIComponent findBsfComponent(UIComponent parent, String targetLib) { if (targetLib.equalsIgnoreCase((String) parent.getAttributes().get("library"))) { return parent; } Iterator<UIComponent> kids = parent.getFacetsAndChildren(); while (kids.hasNext()) { UIComponent found = findBsfComponent(ki...
java
private void addMetaTags(UIViewRoot root, FacesContext context) { // Check context-param String viewportParam = BsfUtils.getInitParam(C.P_VIEWPORT, context); viewportParam = evalELIfPossible(viewportParam); String content = "width=device-width, initial-scale=1"; if (!viewportParam.isEmpty() && isFalseOrNo(vi...
java
private void addCSS(UIViewRoot root, FacesContext context) { // The following code is needed to diagnose the warning "Unable to save dynamic // action with clientId 'j_id...'" // List<UIComponent> r = root.getComponentResources(context, "head"); // System.out.println("**************"); // for (UIComponent ava...
java
private void addJavascript(UIViewRoot root, FacesContext context) { // The following code is needed to diagnose the warning "Unable to save dynamic // action with clientId 'j_id...'" // List<UIComponent> r = root.getComponentResources(context, "head"); // System.out.println("**************"); // for (UICompon...
java
private void removeDuplicateResources(UIViewRoot root, FacesContext context) { List<UIComponent> resourcesToRemove = new ArrayList<UIComponent>(); Map<String, UIComponent> alreadyThere = new HashMap<String, UIComponent>(); List<UIComponent> components = new ArrayList<UIComponent>(root.getComponentResources(contex...
java
private void enforceCorrectLoadOrder(UIViewRoot root, FacesContext context) { // // first, handle the CSS files. // // Put BootsFaces.css or BootsFaces.min.css first, // // theme.css second // // and everything else behind them. List<UIComponent> resources = new ArrayList<UIComponent>(); List<UIComponent> f...
java
private UIComponent findHeader(UIViewRoot root) { for (UIComponent c : root.getChildren()) { if (c instanceof HtmlHead) return c; } for (UIComponent c : root.getChildren()) { if (c instanceof HtmlBody) return null; if (c instanceof UIOutput) if (c.getFacets() != null) return c; } ret...
java
public static void addResourceToHeadButAfterJQuery(String library, String resource) { addResource(resource, library, library + "#" + resource, RESOURCE_KEY); }
java
public static void addBasicJSResource(String library, String resource) { addResource(resource, library, resource, BASIC_JS_RESOURCE_KEY); }
java
public static void addThemedCSSResource(String resource) { Map<String, Object> viewMap = FacesContext.getCurrentInstance().getViewRoot().getViewMap(); @SuppressWarnings("unchecked") List<String> resourceList = (List<String>) viewMap.get(THEME_RESOURCE_KEY); if (null == resourceList) { resourceList = new Arra...
java