List of usage examples for org.apache.commons.lang WordUtils capitalizeFully
public static String capitalizeFully(String str)
Converts all the whitespace separated words in a String into capitalized words, that is each word is made up of a titlecase character and then a series of lowercase characters.
From source file:org.carewebframework.vista.ui.vitals.DisplayController.java
/** * Load the string grid with data. Calls the grid RPC to retrieve data for the grid. Data is * returned in the following format://from w ww .java2 s . c om * * <pre> * * counts: test count^date count^result count * tests: control ien^test ien^test name^test abbrv^units^low norm^hi norm^percentile RPC * dates: date id^FM date results: date id^row #^value^result ien * * For example: * * 8^2^7 * * 3^3^TEMPERATURE^TMP^F^^^ 5^5^PULSE^PU^/min^60^100^ * 15^15^RESPIRATIONS^RS^/min^^^ 4^4^BLOOD PRESSURE^BP^mmHg^90^150^ * 1^1^HEIGHT^HT^in^^^CIAOCVVM PCTILE 2^2^WEIGHT^WT^lb^^^CIAOCVVM PCTILE * 21^21^PAIN^PA^^^^ 6^6^HEAD CIRCUMFERENCE^HC^in^^^CIAOCVVM PCTILE * * 2^3041018.1446 * 1^3041022.1446 * * 1^2^77^^2445227 1^4^101/65^^2445224 1^5^27^^2445222 2^5^26.5^^2445220 * 1^6^16.5^^2445223 2^6^16^^2445218 1^8^17.5^^2445225 * </pre> */ private void loadGrid() { chart.clear(); if (patient == null) { showMessage("No patient selected."); return; } Iterator<String> data = doRPC(gridRPC, datRange.getStartDate(), datRange.getEndDate(), tests).iterator(); percentiles.clear(); String[] pcs = StrUtil.split(data.next(), StrUtil.U, 3); int testcnt = StrUtil.toInt(pcs[0]); int datecnt = StrUtil.toInt(pcs[1]); int datacnt = StrUtil.toInt(pcs[2]); if (datacnt == 0 || datecnt == 0) { showMessage("No data available within selected range."); return; } initGrid(datecnt + 2, testcnt); // Populate test names and units for (int r = 0; r < testcnt; r++) { pcs = StrUtil.split(data.next(), StrUtil.U, 8); String range = pcs[5] + "-" + pcs[6]; range = "-".equals(range) ? "" : range + " "; setValue(0, r, WordUtils.capitalizeFully(pcs[2]), pcs[0]).setStyle("font-weight:bold"); setValue(datecnt + 1, r, range + pcs[4], pcs[4]).setStyle("font-style:italic"); if (!pcs[7].isEmpty()) { percentiles.put(pcs[0], pcs[7]); } } // Populate date headers Map<String, Listheader> headers = new HashMap<String, Listheader>(); for (int c = 1; c <= datecnt; c++) { pcs = StrUtil.split(data.next(), StrUtil.U, 2); FMDate date = new FMDate(pcs[1]); Listheader hdr = (Listheader) hdrVitals.getChildren().get(c); hdr.setLabel(date.toString()); hdr.setValue(date); hdr.setParent(hdrVitals); headers.put(pcs[0], hdr); } // Populate data cells for (int i = 0; i < datacnt; i++) { pcs = StrUtil.split(data.next(), StrUtil.U, 3); int col = headers.get(pcs[0]).getColumnIndex(); int row = StrUtil.toInt(pcs[1]) - 1; setValue(col, row, StrUtil.strAppend(getValue(col, row), pcs[2], "; "), null); lstVitals.getItemAtIndex(row).setVisible(true); } lstVitals.invalidate(); setSelectedRow(selectedItem); }
From source file:org.carewebframework.vista.ui.vitals.EntryController.java
/** * Load the string grid with data. Calls the grid RPC to retrieve data for the grid. Data is * returned in the following format://from w w w. ja v a 2 s .c o m * * <pre> * * counts: test count^date count^result count * tests: control ien^test ien^test name^test abbrv^units^low norm^hi norm^percentile RPC * dates: date id^FM date results: date id^row #^value^result ien * * For example: * * 8^2^7 * * 3^3^TEMPERATURE^TMP^F^^^ * 5^5^PULSE^PU^/min^60^100^ * 15^15^RESPIRATIONS^RS^/min^^^ * 4^4^BLOOD PRESSURE^BP^mmHg^90^150^ * 1^1^HEIGHT^HT^in^^^CIAOCVVM PCTILE * 2^2^WEIGHT^WT^lb^^^CIAOCVVM PCTILE * 21^21^PAIN^PA^^^^ * 6^6^HEAD CIRCUMFERENCE^HC^in^^^CIAOCVVM PCTILE * * 2^3041018.1446 * 1^3041022.1446 * * 1^2^77^^2445227 * 1^4^101/65^^2445224 * 1^5^27^^2445222 * 2^5^26.5^^2445220 * 1^6^16.5^^2445223 * 2^6^16^^2445218 * 1^8^17.5^^2445225 * </pre> */ private void loadGrid() { if (fetch() == 0) { initGrid(0); return; } Iterator<String> data = template.iterator(); String[] pcs = StrUtil.split(data.next(), StrUtil.U, 3); int testcnt = StrUtil.toInt(pcs[0]); int datecnt = StrUtil.toInt(pcs[1]); int datacnt = StrUtil.toInt(pcs[2]); if (datacnt == 0 || datecnt == 0) { // showMessage("No data available within selected range."); return; } initGrid(datecnt); // Populate test names and units for (int r = 0; r < testcnt; r++) { addRow(); pcs = StrUtil.split(data.next(), StrUtil.U, 8); String range = pcs[5] + "-" + pcs[6]; range = "-".equals(range) ? "" : range + " "; setValue(0, r, WordUtils.capitalizeFully(pcs[2]), pcs[0]); setValue(datecnt + 1, r, range + pcs[4], pcs[4]); } // Populate date headers Map<String, Integer> headers = new HashMap<String, Integer>(); for (int c = 1; c <= datecnt; c++) { pcs = StrUtil.split(data.next(), StrUtil.U, 2); FMDate date = new FMDate(pcs[1]); Column column = getColumn(c); DateTimebox dtb = (DateTimebox) column.getFirstChild(); dtb.setDate(date); headers.put(pcs[0], c); } // Populate data cells for (int i = 0; i < datacnt; i++) { pcs = StrUtil.split(data.next(), StrUtil.U, 3); int col = headers.get(pcs[0]); int row = StrUtil.toInt(pcs[1]) - 1; setValue(col, row, pcs[2], pcs[4]); } }
From source file:org.carrot2.util.StringUtils.java
public static String identifierToHumanReadable(String string) { return WordUtils.capitalizeFully(string.replace('_', ' ')); }
From source file:org.codice.ddf.spatial.ogc.csw.catalog.common.source.CswFilterDelegateTest.java
/** * Creates an Envelop Filter string//from w w w . jav a2 s . c o m * * @param spatialOperator The spatial operator to use in the Filter string * @param propertyName The PropertyName to use in the Filter string * @param lowerCornerPointCoords A pair of coordinates of the form "x y" that represent the lower * corner. * @param upperCornerPointCoords A pair of coordinates of the form "x y" that represent the upper * corner. * @return */ private String createEnvelopeFilterString(SpatialOperatorNameType spatialOperator, GeospatialPropertyName propertyName, String lowerCornerPointCoords, String upperCornerPointCoords) { String spatialOpName; switch (spatialOperator) { case BBOX: // Leave in ALL CAPS spatialOpName = spatialOperator.name(); break; default: spatialOpName = WordUtils.capitalizeFully(spatialOperator.name()); break; } String envelopeFilterString = getXmlHeaderString() + "<ns3:" + spatialOpName + ">" + "<ns3:PropertyName>" + propertyName + "</ns3:PropertyName>" + "<ns4:Envelope>" + "<ns4:lowerCorner>" + lowerCornerPointCoords + "</ns4:lowerCorner>" + "<ns4:upperCorner>" + upperCornerPointCoords + "</ns4:upperCorner>" + "</ns4:Envelope>" + "</ns3:" + spatialOpName + ">" + getXmlFooterString(); return envelopeFilterString; }
From source file:org.codice.ddf.spatial.ogc.csw.catalog.common.source.TestCswFilterDelegate.java
/** * Creates an Envelop Filter string/*w w w . j av a 2s . c o m*/ * * @param spatialOperator The spatial operator to use in the Filter string * @param propertyName The PropertyName to use in the Filter string * @param lowerCornerPointCoords A pair of coordinates of the form "x y" * that represent the lower corner. * @param upperCornerPointCoords A pair of coordinates of the form "x y" * that represent the upper corner. * @return */ private String createEnvelopeFilterString(SpatialOperatorNameType spatialOperator, GeospatialPropertyName propertyName, String lowerCornerPointCoords, String upperCornerPointCoords) { String spatialOpName; switch (spatialOperator) { case BBOX: // Leave in ALL CAPS spatialOpName = spatialOperator.name(); break; default: spatialOpName = WordUtils.capitalizeFully(spatialOperator.name()); break; } String envelopeFilterString = getXmlHeaderString() + "<ns3:" + spatialOpName + ">" + "<ns3:PropertyName>" + propertyName + "</ns3:PropertyName>" + "<ns4:Envelope>" + "<ns4:lowerCorner>" + lowerCornerPointCoords + "</ns4:lowerCorner>" + "<ns4:upperCorner>" + upperCornerPointCoords + "</ns4:upperCorner>" + "</ns4:Envelope>" + "</ns3:" + spatialOpName + ">" + getXmlFooterString(); return envelopeFilterString; }
From source file:org.eclipse.mylyn.reviews.connector.EmfTaskSchema.java
public String getLabel(EStructuralFeature feature) { return WordUtils.capitalizeFully( StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(feature.getName()), ' ')); }
From source file:org.eclipse.smarthome.binding.homematic.internal.type.HomematicTypeGeneratorImpl.java
@Override public void generate(HmDevice device) { if (thingTypeProvider != null) { ThingTypeUID thingTypeUID = UidUtils.generateThingTypeUID(device); ThingType tt = thingTypeProvider.getInternalThingType(thingTypeUID); if (tt == null || device.isGatewayExtras()) { logger.debug("Generating ThingType for device '{}' with {} datapoints", device.getType(), device.getDatapointCount()); List<ChannelGroupType> groupTypes = new ArrayList<ChannelGroupType>(); for (HmChannel channel : device.getChannels()) { List<ChannelDefinition> channelDefinitions = new ArrayList<ChannelDefinition>(); // Omit thing channel definitions for reconfigurable channels; // those will be populated dynamically during thing initialization if (!channel.isReconfigurable()) { // generate channel for (HmDatapoint dp : channel.getDatapoints()) { if (!isIgnoredDatapoint(dp) && dp.getParamsetType() == HmParamsetType.VALUES) { ChannelTypeUID channelTypeUID = UidUtils.generateChannelTypeUID(dp); ChannelType channelType = channelTypeProvider .getInternalChannelType(channelTypeUID); if (channelType == null) { channelType = createChannelType(dp, channelTypeUID); channelTypeProvider.addChannelType(channelType); }/* w ww. j ava 2 s . com*/ ChannelDefinition channelDef = new ChannelDefinitionBuilder(dp.getName(), channelType.getUID()).build(); channelDefinitions.add(channelDef); } } } // generate group ChannelGroupTypeUID groupTypeUID = UidUtils.generateChannelGroupTypeUID(channel); ChannelGroupType groupType = channelGroupTypeProvider.getInternalChannelGroupType(groupTypeUID); if (groupType == null || device.isGatewayExtras()) { String groupLabel = String.format("%s", WordUtils.capitalizeFully(StringUtils.replace(channel.getType(), "_", " "))); groupType = ChannelGroupTypeBuilder.instance(groupTypeUID, groupLabel) .withChannelDefinitions(channelDefinitions).build(); channelGroupTypeProvider.addChannelGroupType(groupType); groupTypes.add(groupType); } } tt = createThingType(device, groupTypes); thingTypeProvider.addThingType(tt); } addFirmware(device); } }
From source file:org.eclipse.smarthome.binding.homematic.internal.type.MetadataUtils.java
/** * Returns the label string for the given Datapoint. *///from ww w. j a v a2 s .c o m public static String getLabel(HmDatapoint dp) { return WordUtils.capitalizeFully(StringUtils.replace(dp.getName(), "_", " ")); }
From source file:org.egov.mrs.domain.entity.RegistrationCertificate.java
public String getUserName() { final String salutation = user.getSalutation() == null ? "" : user.getSalutation().concat(" "); return salutation.concat(WordUtils.capitalizeFully(user.getName())); }
From source file:org.eurekastreams.server.service.restlets.StreamIdValidationResource.java
/** * Handle GET requests.//www. ja va2 s . c o m * * @param variant * the variant to be retrieved. * @throws ResourceException * thrown if a representation cannot be provided * @return a representation of the resource */ @Override public Representation represent(final Variant variant) throws ResourceException { DefaultTransactionDefinition transDef = new DefaultTransactionDefinition(); transDef.setReadOnly(true); TransactionStatus currentStatus = transManager.getTransaction(transDef); boolean isValid; String typeString = WordUtils.capitalizeFully(type.toString()); try { switch (type) { case PERSON: PersonModelView pmv = getPersonMVByAccountId.execute(uniqueKey); isValid = pmv != null; break; case GROUP: List<DomainGroupModelView> groups = groupByShortNameDAO .execute(Collections.singletonList(uniqueKey)); isValid = groups.size() == 1; break; default: typeString = "Type"; throw new RuntimeException("only accepts person and group types."); } transManager.commit(currentStatus); } catch (Exception e) { log.warn("Error validating id", e); transManager.rollback(currentStatus); isValid = false; } String styleColor = isValid ? "green" : "red"; String responseString = isValid ? "Valid " : "Invalid "; // style the response String styledResponse = "<div style=\"color:" + styleColor + "; font-family:Arial; font-size:smaller\">" + responseString + typeString + "</div>"; Representation rep = new StringRepresentation(styledResponse, MediaType.TEXT_HTML); rep.setExpirationDate(new Date(0L)); return rep; }