List of usage examples for javax.servlet.jsp JspWriter println
abstract public void println(Object x) throws IOException;
From source file:com.silverpeas.tags.navigation.MenuTag.java
/** * Print html.// w ww . ja v a 2 s .c o m * @param out * @param html * @param display */ private void print(JspWriter out, String html, boolean display) { if (display) { try { out.println(html); } catch (IOException e) { e.printStackTrace(); } } }
From source file:org.kuali.mobility.tags.LocalisedFieldTag.java
/** * Writes the required HTML for a language's input * * @param out//from w ww . j a v a 2 s.com * @param language * @throws IOException */ private void writeInputForLanguage(JspWriter out, String language) throws IOException { out.print("<div data-l10n-lang=\""); out.print(language); // If it is not the default language, hide it for now if (!getDefaultLanguage().equals(language)) { out.print("\" style=\"display: none\" "); } out.println("\">"); this.writeInput(out, language); out.println("</div>"); }
From source file:org.openmrs.web.taglib.ObsTableWidget.java
public int doStartTag() { Locale loc = Context.getLocale(); DateFormat df = Context.getDateFormat(); //DateFormat.getDateInstance(DateFormat.SHORT, loc); // determine which concepts we care about List<Concept> conceptList = new ArrayList<Concept>(); Set<Integer> conceptIds = new HashSet<Integer>(); ConceptService cs = Context.getConceptService(); for (StringTokenizer st = new StringTokenizer(concepts, "|"); st.hasMoreTokens();) { String s = st.nextToken().trim(); log.debug("looking at " + s); boolean isSet = s.startsWith("set:"); if (isSet) { s = s.substring(4).trim();/* w ww. j ava 2 s . c om*/ } Concept c = null; if (s.startsWith("name:")) { String name = s.substring(5).trim(); c = cs.getConceptByName(name); } else { try { c = cs.getConcept(Integer.valueOf(s.trim())); } catch (Exception ex) { log.error("Error during concept c getConcept", ex); } } if (c != null) { if (isSet) { List<Concept> inSet = cs.getConceptsByConceptSet(c); for (Concept con : inSet) { if (!conceptIds.contains(con.getConceptId())) { conceptList.add(con); conceptIds.add(con.getConceptId()); } } } else { if (!conceptIds.contains(c.getConceptId())) { conceptList.add(c); conceptIds.add(c.getConceptId()); } } } log.debug("conceptList == " + conceptList); } // organize obs of those concepts by Date and Concept Set<Integer> conceptsWithObs = new HashSet<Integer>(); SortedSet<Date> dates = new TreeSet<Date>(); Map<String, List<Obs>> groupedObs = new HashMap<String, List<Obs>>(); // key is conceptId + "." + date for (Obs o : observations) { Integer conceptId = o.getConcept().getConceptId(); if (conceptIds.contains(conceptId)) { Date thisDate = o.getObsDatetime(); // TODO: allow grouping by day/week/month/etc if ((fromDate != null && thisDate.compareTo(fromDate) < 0) || (toDate != null && thisDate.compareTo(toDate) > 0)) { continue; } dates.add(thisDate); String key = conceptId + "." + thisDate; List<Obs> group = groupedObs.get(key); if (group == null) { group = new ArrayList<Obs>(); groupedObs.put(key, group); } group.add(o); conceptsWithObs.add(conceptId); } } if (!showEmptyConcepts) { for (Iterator<Concept> i = conceptList.iterator(); i.hasNext();) { if (!conceptsWithObs.contains(i.next().getConceptId())) { i.remove(); } } } List<Date> dateOrder = new ArrayList<Date>(dates); if (sortDescending) { Collections.reverse(dateOrder); } if (limit > 0 && limit < dateOrder.size()) { if (!sortDescending) { dateOrder = dateOrder.subList(dateOrder.size() - limit, dateOrder.size()); } else { dateOrder = dateOrder.subList(0, limit); } } StringBuilder ret = new StringBuilder(); ret.append("<table"); if (id != null) { ret.append(" id=\"" + id + "\""); } if (cssClass != null) { ret.append(" class=\"" + cssClass + "\""); } ret.append(">"); if (orientVertical) { if (showConceptHeader) { ret.append("<tr>"); ret.append("<th></th>"); for (Concept c : conceptList) { showConceptHeader(loc, ret, c); } ret.append("</tr>"); } for (Date date : dateOrder) { ret.append("<tr>"); if (showDateHeader) { ret.append("<th>" + df.format(date) + "</th>"); } for (Concept c : conceptList) { showConcept(loc, groupedObs, ret, date, c); } ret.append("</tr>"); } } else { // horizontal if (showDateHeader) { ret.append("<tr>"); ret.append("<th></th>"); for (Date date : dateOrder) { ret.append("<th>" + df.format(date) + "</th>"); } } for (Concept c : conceptList) { ret.append("<tr>"); if (showConceptHeader) { showConceptHeader(loc, ret, c); } for (Date date : dateOrder) { showConcept(loc, groupedObs, ret, date, c); } ret.append("</tr>"); } } ret.append("</table>"); try { JspWriter w = pageContext.getOut(); w.println(ret); } catch (IOException ex) { log.error("Error while starting ObsTableWidget tag", ex); } return SKIP_BODY; }
From source file:nl.strohalm.cyclos.taglibs.OptionTag.java
@Override public int doEndTag() throws JspException { try {/* www. j av a 2s.c o m*/ final MultiDropDownTag mdd = (MultiDropDownTag) findAncestorWithClass(this, MultiDropDownTag.class); if (mdd == null) { throw new IllegalStateException("cyclos:option tag must be nested in a cyclos:muldiDropDown tag"); } final JspWriter out = pageContext.getOut(); final String text = StringEscapeUtils.escapeJavaScript(StringUtils.trimToEmpty(this.text)); final String value = StringEscapeUtils.escapeJavaScript(StringUtils.trimToEmpty(this.value)); boolean selected; if (this.selected == null) { final List<String> selectedValues = mdd.getSelectedValues(); selected = selectedValues != null && selectedValues.contains(value); } else { selected = this.selected; } out.println(mdd.getDivId() + ".values.push({text:'" + text + "', value:'" + value + "', selected:" + selected + "})"); return EVAL_PAGE; } catch (final IOException e) { throw new JspException(e); } finally { release(); } }
From source file:org.kuali.mobility.tags.MultiPageTag.java
public void doTag() throws JspException { PageContext pageContext = (PageContext) getJspContext(); HttpServletRequest hsr = (HttpServletRequest) pageContext.getRequest(); Cookie cks[] = hsr.getCookies();/*from w w w . j a v a 2 s .c om*/ if (cks != null) { for (Cookie c : cks) { if (c.getName().equals("jqmHeader")) { setJqmHeader(c.getValue()); //LOG.info("---jqmHeader: " + jqmHeader); } } } ServletContext servletContext = pageContext.getServletContext(); WebApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(servletContext); setAuthMapper((AuthenticationMapper) ac.getBean("authenticationMapper")); CoreService coreService = (CoreService) ac.getBean("coreService"); Properties kmeProperties = (Properties) ac.getBean("kmeProperties"); User user = (User) pageContext.getSession().getAttribute(AuthenticationConstants.KME_USER_KEY); String contextPath = servletContext.getContextPath(); JspWriter out = pageContext.getOut(); try { out.println("<!DOCTYPE html>"); if (!getAppcacheEnabled().equals("false")) { LOG.debug("Appcache Enabled"); out.println("<html manifest=\"" + contextPath + "/" + (StringUtils.isEmpty(getAppcacheFilename()) ? "kme.appcache" : getAppcacheFilename().trim()) + "\">"); } else { LOG.debug("Appcache Disabled"); out.println("<html>"); } out.println("<head>"); out.println("<title>" + getTitle() + "</title>"); out.println( "<link href=\"" + kmeProperties.getProperty("favico.url", "http://www.kuali.org/favicon.ico") + "\" rel=\"icon\" />"); out.println( "<link href=\"" + kmeProperties.getProperty("favico.url", "http://www.kuali.org/favicon.ico") + "\" rel=\"shortcut icon\" />"); // out.println("<link rel=\"apple-touch-icon\" href=\"" + contextPath + "/apple-touch-icon-precomposed.png\"/>"); out.println("<link rel=\"apple-touch-icon\" href=\"" + contextPath + "/touch-icon-iphone.png\"/>"); out.println("<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"" + contextPath + "/touch-icon-ipad.png\"/>"); out.println("<link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"" + contextPath + "/touch-icon-iphone-retina.png\"/>"); out.println("<link rel=\"apple-touch-icon\" sizes=\"144x144\" href=\"" + contextPath + "/touch-icon-ipad-retina.png\"/>"); out.println("<link href=\"" + contextPath + "/css/jquery.mobile.css\" rel=\"stylesheet\" type=\"text/css\" />"); out.println("<link href=\"" + contextPath + "/css/jquery-mobile-fluid960.css\" rel=\"stylesheet\" type=\"text/css\" />"); out.println("<link href=\"" + contextPath + "/css/kme.css\" rel=\"stylesheet\" type=\"text/css\" />"); out.println("<link href=\"" + contextPath + "/css/institution.css\" rel=\"stylesheet\" type=\"text/css\" />"); // Attach all CSS files for (String cssFile : getCssFilenames()) { out.println("<link href=\"" + contextPath + "/css/" + cssFile + ".css\" rel=\"stylesheet\" type=\"text/css\" />"); } out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.js\"></script>"); out.println( "<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.cookie.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/custom.js\"></script>"); out.println( "<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.mobile.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.tmpl.js\"></script>"); out.println( "<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.validate.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.validate.ready.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.templates.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.transit.min.js\"></script>"); out.println( "<script type=\"text/javascript\" src=\"" + contextPath + "/js/BrowserDetect.js\"></script>"); out.println( "<script type=\"text/javascript\" src=\"" + contextPath + "/js/ServerDetails.js\"></script>"); if (isNative()) { out.println( "<script type=\"text/javascript\" src=\"" + contextPath + "/js/PushConfig.js\"></script>"); } out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/jquery.autoellipsis-1.0.3.min.js\"></script>"); // if (getPlatform() != null && getPlatform().equals("iOS")) { // out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/phonegap-" + getPhonegap() + ".js\"></script>"); // out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/ChildBrowser.js\"></script>"); // out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/barcodescanner.js\"></script>"); //// out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/Connection.js\"></script>"); // out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/PushHandler.js\"></script>"); // out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/Badge.js\"></script>"); // out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/applicationPreferences.js\"></script>"); // } else if (getPlatform() != null && getPlatform().equals("Android")) { // out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/phonegap-" + getPhonegap() + ".js\"></script>"); // out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/childbrowser.js\"></script>"); // out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/barcodescanner.js\"></script>"); // out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/statusbarnotification.js\"></script>"); // //out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/C2DMPlugin.js\"></script>"); // //out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/PG_C2DM_script.js\"></script>"); // } if (isPlatform(Device.TYPE_IOS)) { if (isPhoneGap("1.4.1")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/phonegap-1.4.1.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/ChildBrowser.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/barcodescanner.js\"></script>"); // out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/Connection.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/PushHandler.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/Badge.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/applicationPreferences.js\"></script>"); } else if (isPhoneGap("1.7.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/cordova-1.7.0.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/ChildBrowser.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/barcodescanner.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/ActionSheet.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/Badge.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/LocalNotifications.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/Notifications.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/PrintPlugin.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/1.7.0/applicationPreferences.js\"></script>"); } else if (isPhoneGap("2.2.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.2.0/cordova-2.2.0.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.2.0/ActionSheet.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.2.0/applicationPreferences.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.2.0/AudioStreamer.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.2.0/Badge.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.2.0/barcodescanner.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.2.0/ChildBrowser.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/PushHandler.js\"></script>"); } else if (isPhoneGap("2.3.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.3.0/cordova-2.3.0.js\"></script>"); } else if (isPhoneGap("2.4.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.4.0/cordova-2.4.0.js\"></script>"); } else if (isPhoneGap("2.5.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.5.0/cordova-2.5.0.js\"></script>"); } else if (isPhoneGap("2.6.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.6.0/cordova-2.6.0.js\"></script>"); } else if (isPhoneGap("2.7.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.7.0/cordova-2.7.0.js\"></script>"); } else if (isPhoneGap("2.8.1")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/iOS/2.8.1/cordova.js\"></script>"); } } else if (isPlatform(Device.TYPE_ANDROID)) { if (isPhoneGap("2.2.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/cordova-2.2.0.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/childbrowser.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/barcodescanner.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/statusbarnotification.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/datePickerPlugin.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/applicationPreferences.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/AudioStreamer.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/GCMPlugin.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/2.2.0/CORDOVA_GCM_script.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/PushHandler.js\"></script>"); } else { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/phonegap-" + getPhonegap() + ".js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/childbrowser.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/barcodescanner.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/statusbarnotification.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/C2DMPlugin.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/PG_C2DM_script.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/android/PushHandler.js\"></script>"); } } else if (isPlatform(Device.TYPE_BLACKBERRY)) { if (isPhoneGap("2.2.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/PushConfig.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/blackberry/2.2.0/cordova-2.2.0.js\"></script>"); out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/blackberry/2.2.0/kme-application.js\"></script>"); } } else if (isPlatform(Device.TYPE_WINDOWS)) { if (isPhoneGap("2.2.0")) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/windowsMobile/2.2.0/cordova-2.2.0.js\"></script>"); } } String profileId = coreService.findGoogleAnalyticsProfileId().trim(); if (!isDisableGoogleAnalytics() && profileId.length() > 0) { out.println("<script type=\"text/javascript\">"); out.println("var _gaq = _gaq || [];"); out.println("_gaq.push(['_setAccount', '" + profileId + "']);"); out.println("_gaq.push(['_trackPageview']);"); out.println("(function() {"); out.println( "var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;"); out.println( "ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';"); out.println( "var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);"); out.println("})();"); out.println("</script>"); } if (isUsesGoogleMaps()) { if (getMapLocale() != null) { out.println( "<script type=\"text/javascript\" src=\"http://maps.google.com/maps/api/js?sensor=true&language=" + getMapLocale() + "\"></script>"); } else { out.println( "<script type=\"text/javascript\" src=\"http://maps.google.com/maps/api/js?sensor=true\"></script>"); } } // Now add all the javascripts for (String javascript : getJsFilenames()) { out.println("<script type=\"text/javascript\" src=\"" + contextPath + "/js/" + javascript + ".js\"></script>"); } // out.println("<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />"); // out.println("<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\" />"); out.println( "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\">"); out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"); out.println("</head>"); if (getOnBodyLoad() != null) { out.println("<body onload='" + getOnBodyLoad() + "'>"); } else { out.println("<body>"); } getJspBody().invoke(out); out.println("</body>"); out.println("</html>"); } catch (Exception e) { LOG.error(e.getMessage(), e); } }
From source file:com.camel.framework.tag.CssLinkTag.java
/** * ?? Minify?link??//from ww w . j a va2s . c o m * * @param sb * @param resourcesUrl * @param out */ private void parseToMinifyStyle(StringBuffer sb, String resourcesUrl, JspWriter out) { // sb.setLength(0); // minify?link sb.append("<link type='").append(type).append("' rel='").append(rel).append("' href='").append(resourcesUrl) .append("min/?"); if (StringUtils.isNotBlank(path)) { sb.append("b=").append(path).append("&"); } sb.append("f=").append(href).append("'/>"); try { // ? out.println(sb.toString()); } catch (IOException e) { logger.error("Could not print out value '" + sb.toString(), e); } }
From source file:info.magnolia.cms.gui.inline.BarEdit.java
/** * <p>/*from ww w .j a v a2 s . co m*/ * draws the main bar (incl. all magnolia specific js and css sources) * </p> */ public void drawHtml(JspWriter out) throws IOException { boolean isGranted = Resource.getActivePage(this.getRequest()).isGranted(Permission.SET); if (!Resource.showPreview(this.getRequest()) && isGranted && Server.isAdmin()) { this.setEvent("onmousedown", "mgnlMoveNodeEnd(this,'" + this.getPath() + "');"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ this.setEvent("onmouseover", "mgnlMoveNodeHigh(this);"); //$NON-NLS-1$ //$NON-NLS-2$ this.setEvent("onmouseout", "mgnlMoveNodeReset(this);"); //$NON-NLS-1$ //$NON-NLS-2$ out.println(this.getHtml()); } }
From source file:edu.cornell.mannlib.vitro.webapp.web.jsptags.OptionsForPropertyTag.java
public int doStartTag() { try {// w w w . j a v a 2s . c o m VitroRequest vreq = new VitroRequest((HttpServletRequest) pageContext.getRequest()); WebappDaoFactory wdf = vreq.getWebappDaoFactory(); if (wdf == null) throw new Exception("could not get WebappDaoFactory from request."); Individual subject = wdf.getIndividualDao().getIndividualByURI(getSubjectUri()); if (subject == null) throw new Exception("could not get individual for subject uri " + getSubjectUri()); ObjectProperty objProp = wdf.getObjectPropertyDao().getObjectPropertyByURI(getPredicateUri()); if (objProp == null) throw new Exception("could not get object property for predicate " + getPredicateUri()); List<VClass> vclasses = new ArrayList<VClass>(); vclasses = wdf.getVClassDao().getVClassesForProperty(getPredicateUri(), true); HashMap<String, Individual> indMap = new HashMap<String, Individual>(); for (VClass vclass : vclasses) { for (Individual ind : wdf.getIndividualDao().getIndividualsByVClassURI(vclass.getURI(), -1, -1)) if (!indMap.containsKey(ind.getURI())) indMap.put(ind.getURI(), ind); } List<Individual> individuals = new ArrayList(indMap.values()); List<ObjectPropertyStatement> stmts = subject.getObjectPropertyStatements(); if (stmts == null) throw new Exception("object properties for subject were null"); individuals = removeIndividualsAlreadyInRange(individuals, stmts); Collections.sort(individuals, new compareEnts()); JspWriter out = pageContext.getOut(); int optionsCount = 0; for (Individual ind : individuals) { String uri = ind.getURI(); if (uri != null) { out.print("<option value=\"" + StringEscapeUtils.escapeHtml(uri) + '"'); if (uri.equals(getSelectedUri())) out.print(" selected=\"selected\""); out.print('>'); out.print(StringEscapeUtils.escapeHtml(ind.getName())); out.println("</option>"); ++optionsCount; } } log.trace("added " + optionsCount + " options for object property \"" + getPredicateUri() + "\" in OptionsForPropertyTag.doStartTag()"); } catch (Exception ex) { throw new Error("Error in doStartTag: " + ex.getMessage()); } return SKIP_BODY; }
From source file:edu.cornell.mannlib.vedit.tags.OptionTag.java
public int doEndTag() throws JspException { try {// w ww . ja v a2s. c om JspWriter out = pageContext.getOut(); List optList = null; ListOrderedMap optGroups = null; try { optList = (List) getFormObject().getOptionLists().get(name); outputOptionsMarkup(optList, out); } catch (ClassCastException e) { // maybe it's a ListOrderedMap of optgroups optGroups = (ListOrderedMap) getFormObject().getOptionLists().get(name); OrderedMapIterator ogKey = optGroups.orderedMapIterator(); while (ogKey.hasNext()) { String optGroupName = (String) ogKey.next(); out.println("<optgroup label=\"" + StringEscapeUtils.escapeHtml(optGroupName) + "\">"); outputOptionsMarkup((List) optGroups.get(optGroupName), out); out.println("</optgroup>"); } } catch (NullPointerException npe) { System.out.println("OptionTag could not find option list for " + name); } } catch (Exception ex) { ex.printStackTrace(); throw new JspException(ex.getMessage()); } return SKIP_BODY; // EVAL_PAGE; did colnames only //EVAL_PAGE in connection pooled version; }
From source file:info.magnolia.cms.gui.inline.BarNew.java
/** * <p>/*w w w. j a va 2 s . c om*/ * draws the main bar (incl. all magnolia specific js and css sources) * </p> */ public void drawHtml(JspWriter out) throws IOException { boolean isGranted = Resource.getActivePage(this.getRequest()).isGranted(Permission.SET); if (!Resource.showPreview(this.getRequest()) && isGranted) { this.setEvent("onmousedown", "mgnlMoveNodeEnd(this,'" + this.getPath() + "');"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ this.setEvent("onmouseover", "mgnlMoveNodeHigh(this);"); //$NON-NLS-1$ //$NON-NLS-2$ this.setEvent("onmouseout", "mgnlMoveNodeReset(this);"); //$NON-NLS-1$ //$NON-NLS-2$ this.setId(this.getNodeCollectionName() + "__" + this.getNodeName()); //$NON-NLS-1$ out.println(this.getHtml()); } }