List of usage examples for java.util Locale GERMAN
Locale GERMAN
To view the source code for java.util Locale GERMAN.
Click Source Link
From source file:org.yccheok.jstock.gui.MainFrame.java
/** * Initialize language menu items so that correct item is being selected * according to current default locale.//from w ww .j a va 2 s . c om */ private void initLanguageMenuItemsSelection() { // Please revise Statement's construct code, when adding in new language. // So that its language guessing algorithm will work as it is. final Locale defaultLocale = Locale.getDefault(); if (Utils.isTraditionalChinese(defaultLocale)) { this.jRadioButtonMenuItem4.setSelected(true); } else if (Utils.isSimplifiedChinese(defaultLocale)) { this.jRadioButtonMenuItem2.setSelected(true); } else if (defaultLocale.getLanguage().equals(Locale.GERMAN.getLanguage())) { this.jRadioButtonMenuItem3.setSelected(true); } else if (defaultLocale.getLanguage().equals(Locale.ITALIAN.getLanguage())) { this.jRadioButtonMenuItem5.setSelected(true); } else { this.jRadioButtonMenuItem1.setSelected(true); } }
From source file:unikn.dbis.univis.explorer.VExplorer.java
License:asdf
private void initStatePanel() { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0;/*from w w w . ja v a2s. c om*/ gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; chartLabel = new VLabel(Constants.CHART); whatChartLabel = new VLabel(Constants.BAR_CHART_HORIZONTAL); complete = new JPanel(); complete.add(chartLabel); complete.add(whatChartLabel); statePanel.add(complete, gbc); measureLabel = new VLabel(Constants.MEASURE); complete = new JPanel(); complete.add(measureLabel); complete.add(tree.getWhatMeasureLabel()); ++gbc.gridy; statePanel.add(complete, gbc); languageLabel = new VLabel(Constants.LANGUAGE); whatLanguageLabel = new JLabel(Locale.GERMAN.getDisplayName()); complete = new JPanel(); complete.add(languageLabel); complete.add(whatLanguageLabel); ++gbc.gridy; statePanel.add(complete, gbc); timeLabel = new VLabel(Constants.TIME); whatTimeLabel = new VClock(); complete = new JPanel(); complete.add(timeLabel); complete.add(whatTimeLabel); ++gbc.gridy; statePanel.add(complete, gbc); dateLabel = new VLabel(Constants.DATE); whatDateLabel = new JLabel(whatTimeLabel.getDate()); complete = new JPanel(); complete.add(dateLabel); complete.add(whatDateLabel); ++gbc.gridy; statePanel.add(complete, gbc); StackedBox box = new StackedBox(); box.addBox("Status", statePanel, BorderLayout.WEST); underStatePanel.add(box, BorderLayout.CENTER); }
From source file:org.yccheok.jstock.gui.JStock.java
/** * Initialize language menu items so that correct item is being selected * according to current default locale./* w w w. ja va 2 s . co m*/ */ private void initLanguageMenuItemsSelection() { // Please revise Statement's construct code, when adding in new language. // So that its language guessing algorithm will work as it is. final Locale defaultLocale = Locale.getDefault(); if (Utils.isTraditionalChinese(defaultLocale)) { this.jRadioButtonMenuItem4.setSelected(true); } else if (Utils.isSimplifiedChinese(defaultLocale)) { this.jRadioButtonMenuItem2.setSelected(true); } else if (defaultLocale.getLanguage().equals(Locale.GERMAN.getLanguage())) { this.jRadioButtonMenuItem3.setSelected(true); } else if (defaultLocale.getLanguage().equals(Locale.ITALIAN.getLanguage())) { this.jRadioButtonMenuItem5.setSelected(true); } else if (defaultLocale.getLanguage().equals(Locale.FRENCH.getLanguage())) { this.jRadioButtonMenuItem6.setSelected(true); } else { this.jRadioButtonMenuItem1.setSelected(true); } }
From source file:de.iteratec.iteraplan.businesslogic.service.legacyExcel.ExcelImportServiceAttributesIntegrationTest.java
@Test public void testImportDateAttribute() { // create attribute type and sample building block AttributeTypeGroup atg = testDataHelper.createAttributeTypeGroup("myTAG", ""); DateAT dateType = testDataHelper.createDateAttributeType("MyDateType", "", atg); testDataHelper.assignAttributeTypeToAllAvailableBuildingBlockTypes(dateType); InformationSystem is = testDataHelper.createInformationSystem("myIS"); InformationSystemRelease isr = testDataHelper.createInformationSystemRelease(is, "1.0"); // create excel cells with import data final HSSFWorkbook workbook = new HSSFWorkbook(); final CellStyle dateStyle = workbook.createCellStyle(); dateStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy")); final HSSFSheet sheet = workbook.createSheet(); final HSSFRow row = sheet.createRow(0); final Cell cell1 = row.createCell(0); cell1.setCellValue(createDate(2010, 12, 31)); cell1.setCellStyle(dateStyle); // need to do this so our import routines can parse it back as a date value Map<String, Cell> attributes = new HashMap<String, Cell>(); attributes.put(dateType.getName(), cell1); LandscapeData landscapeData = new LandscapeData(); landscapeData.addAttributes(isr, attributes); landscapeData.setLocale(Locale.GERMAN); excelImportService.importLandscapeData(landscapeData); InformationSystemRelease isrLoadedFromDb = isrService.loadObjectById(isr.getId()); String loadedAv = isrLoadedFromDb.getAttributeValue(dateType.getName(), Locale.GERMAN); assertEquals("31.12.2010", loadedAv); // following call failed before ITERAPLAN-170 was fixed @SuppressWarnings("unused") AttributeType at = attributeTypeService.getAttributeTypeByName(dateType.getName()); }
From source file:org.openmrs.ObsTest.java
/** * @see Obs#getValueAsString(Locale)/*from ww w . j a v a 2s.com*/ */ @Test public void getValueAsString_shouldUseCommasOrDecimalPlacesDependingOnLocale() throws Exception { Obs obs = new Obs(); obs.setValueNumeric(123456789.3); String str = "123456789,3"; Assert.assertEquals(str, obs.getValueAsString(Locale.GERMAN)); }
From source file:de.geeksfactory.opacclient.apis.SISIS.java
protected SearchRequestResult parse_search(String html, int page) throws OpacErrorException { Document doc = Jsoup.parse(html); doc.setBaseUri(opac_url + "/searchfoo"); if (doc.select(".error").size() > 0) { throw new OpacErrorException(doc.select(".error").text().trim()); } else if (doc.select(".nohits").size() > 0) { throw new OpacErrorException(doc.select(".nohits").text().trim()); } else if (doc.select(".box-header h2, #nohits").text().contains("keine Treffer")) { return new SearchRequestResult(new ArrayList<SearchResult>(), 0, 1, 1); }//w w w . ja v a 2s . c om int results_total = -1; String resultnumstr = doc.select(".box-header h2").first().text(); if (resultnumstr.contains("(1/1)") || resultnumstr.contains(" 1/1")) { reusehtml = html; throw new OpacErrorException("is_a_redirect"); } else if (resultnumstr.contains("(")) { results_total = Integer.parseInt(resultnumstr.replaceAll(".*\\(([0-9]+)\\).*", "$1")); } else if (resultnumstr.contains(": ")) { results_total = Integer.parseInt(resultnumstr.replaceAll(".*: ([0-9]+)$", "$1")); } Elements table = doc.select("table.data tbody tr"); identifier = null; Elements links = doc.select("table.data a"); boolean haslink = false; for (int i = 0; i < links.size(); i++) { Element node = links.get(i); if (node.hasAttr("href") & node.attr("href").contains("singleHit.do") && !haslink) { haslink = true; try { List<NameValuePair> anyurl = URLEncodedUtils .parse(new URI(node.attr("href").replace(" ", "%20").replace("&", "&")), ENCODING); for (NameValuePair nv : anyurl) { if (nv.getName().equals("identifier")) { identifier = nv.getValue(); break; } } } catch (Exception e) { e.printStackTrace(); } } } List<SearchResult> results = new ArrayList<>(); for (int i = 0; i < table.size(); i++) { Element tr = table.get(i); SearchResult sr = new SearchResult(); if (tr.select("td img[title]").size() > 0) { String title = tr.select("td img").get(0).attr("title"); String[] fparts = tr.select("td img").get(0).attr("src").split("/"); String fname = fparts[fparts.length - 1]; MediaType default_by_fname = defaulttypes.get(fname.toLowerCase(Locale.GERMAN).replace(".jpg", "") .replace(".gif", "").replace(".png", "")); MediaType default_by_title = defaulttypes.get(title); MediaType default_name = default_by_title != null ? default_by_title : default_by_fname; if (data.has("mediatypes")) { try { sr.setType(MediaType.valueOf(data.getJSONObject("mediatypes").getString(fname))); } catch (JSONException | IllegalArgumentException e) { sr.setType(default_name); } } else { sr.setType(default_name); } } String alltext = tr.text(); if (alltext.contains("eAudio") || alltext.contains("eMusic")) { sr.setType(MediaType.MP3); } else if (alltext.contains("eVideo")) { sr.setType(MediaType.EVIDEO); } else if (alltext.contains("eBook")) { sr.setType(MediaType.EBOOK); } else if (alltext.contains("Munzinger")) { sr.setType(MediaType.EDOC); } if (tr.children().size() > 3 && tr.child(3).select("img[title*=cover]").size() == 1) { sr.setCover(tr.child(3).select("img[title*=cover]").attr("abs:src")); if (sr.getCover().contains("showCover.do")) { downloadCover(sr); } } Element middlething; if (tr.children().size() > 2 && tr.child(2).select("a").size() > 0) { middlething = tr.child(2); } else { middlething = tr.child(1); } List<Node> children = middlething.childNodes(); if (middlething.select("div").not("#hlrightblock,.bestellfunktionen").size() == 1) { Element indiv = middlething.select("div").not("#hlrightblock,.bestellfunktionen").first(); if (indiv.children().size() > 1) { children = indiv.childNodes(); } } else if (middlething.select("span.titleData").size() == 1) { children = middlething.select("span.titleData").first().childNodes(); } int childrennum = children.size(); List<String[]> strings = new ArrayList<>(); for (int ch = 0; ch < childrennum; ch++) { Node node = children.get(ch); if (node instanceof TextNode) { String text = ((TextNode) node).text().trim(); if (text.length() > 3) { strings.add(new String[] { "text", "", text }); } } else if (node instanceof Element) { List<Node> subchildren = node.childNodes(); for (int j = 0; j < subchildren.size(); j++) { Node subnode = subchildren.get(j); if (subnode instanceof TextNode) { String text = ((TextNode) subnode).text().trim(); if (text.length() > 3) { strings.add(new String[] { ((Element) node).tag().getName(), "text", text, ((Element) node).className(), node.attr("style") }); } } else if (subnode instanceof Element) { String text = ((Element) subnode).text().trim(); if (text.length() > 3) { strings.add(new String[] { ((Element) node).tag().getName(), ((Element) subnode).tag().getName(), text, ((Element) node).className(), node.attr("style") }); } } } } } StringBuilder description = null; if (tr.select("span.Z3988").size() == 1) { // Sometimes there is a <span class="Z3988"> item which provides // data in a standardized format. List<NameValuePair> z3988data; boolean hastitle = false; try { description = new StringBuilder(); z3988data = URLEncodedUtils .parse(new URI("http://dummy/?" + tr.select("span.Z3988").attr("title")), "UTF-8"); for (NameValuePair nv : z3988data) { if (nv.getValue() != null) { if (!nv.getValue().trim().equals("")) { if (nv.getName().equals("rft.btitle") && !hastitle) { description.append("<b>").append(nv.getValue()).append("</b>"); hastitle = true; } else if (nv.getName().equals("rft.atitle") && !hastitle) { description.append("<b>").append(nv.getValue()).append("</b>"); hastitle = true; } else if (nv.getName().equals("rft.au")) { description.append("<br />").append(nv.getValue()); } else if (nv.getName().equals("rft.date")) { description.append("<br />").append(nv.getValue()); } } } } } catch (URISyntaxException e) { description = null; } } boolean described = false; if (description != null && description.length() > 0) { sr.setInnerhtml(description.toString()); described = true; } else { description = new StringBuilder(); } int k = 0; boolean yearfound = false; boolean titlefound = false; boolean sigfound = false; for (String[] part : strings) { if (!described) { if (part[0].equals("a") && (k == 0 || !titlefound)) { if (k != 0) { description.append("<br />"); } description.append("<b>").append(part[2]).append("</b>"); titlefound = true; } else if (part[2].matches("\\D*[0-9]{4}\\D*") && part[2].length() <= 10) { yearfound = true; if (k != 0) { description.append("<br />"); } description.append(part[2]); } else if (k == 1 && !yearfound && part[2].matches("^\\s*\\([0-9]{4}\\)$")) { if (k != 0) { description.append("<br />"); } description.append(part[2]); } else if (k == 1 && !yearfound && part[2].matches("^\\s*\\([0-9]{4}\\)$")) { if (k != 0) { description.append("<br />"); } description.append(part[2]); } else if (k > 1 && k < 4 && !sigfound && part[0].equals("text") && part[2].matches("^[A-Za-z0-9,\\- ]+$")) { description.append("<br />"); description.append(part[2]); } } if (part.length == 4) { if (part[0].equals("span") && part[3].equals("textgruen")) { sr.setStatus(SearchResult.Status.GREEN); } else if (part[0].equals("span") && part[3].equals("textrot")) { sr.setStatus(SearchResult.Status.RED); } } else if (part.length == 5) { if (part[4].contains("purple")) { sr.setStatus(SearchResult.Status.YELLOW); } } if (sr.getStatus() == null) { if ((part[2].contains("entliehen") && part[2].startsWith("Vormerkung ist leider nicht mglich")) || part[2].contains("nur in anderer Zweigstelle ausleihbar und nicht bestellbar")) { sr.setStatus(SearchResult.Status.RED); } else if (part[2].startsWith("entliehen") || part[2].contains("Ein Exemplar finden Sie in einer anderen Zweigstelle")) { sr.setStatus(SearchResult.Status.YELLOW); } else if ((part[2].startsWith("bestellbar") && !part[2].contains("nicht bestellbar")) || (part[2].startsWith("vorbestellbar") && !part[2].contains("nicht vorbestellbar")) || (part[2].startsWith("vorbestellbar") && !part[2].contains("nicht vorbestellbar")) || (part[2].startsWith("vormerkbar") && !part[2].contains("nicht vormerkbar")) || (part[2].contains("heute zurckgebucht")) || (part[2].contains("ausleihbar") && !part[2].contains("nicht ausleihbar"))) { sr.setStatus(SearchResult.Status.GREEN); } if (sr.getType() != null) { if (sr.getType().equals(MediaType.EBOOK) || sr.getType().equals(MediaType.EVIDEO) || sr.getType().equals(MediaType.MP3)) // Especially Onleihe.de ebooks are often marked // green though they are not available. { sr.setStatus(SearchResult.Status.UNKNOWN); } } } k++; } if (!described) { sr.setInnerhtml(description.toString()); } sr.setNr(10 * (page - 1) + i); sr.setId(null); results.add(sr); } resultcount = results.size(); return new SearchRequestResult(results, results_total, page); }
From source file:eu.ggnet.dwoss.misc.op.listings.SalesListingProducerOperation.java
/** * Generates PDF files for units in a specific sales channel. * The lists are seperated by brand./* w w w . jav a 2s . co m*/ * <p> * @param channel the saleschannel * @return PDF files for units in a specific sales channel. */ private Map<TradeName, Collection<FileJacket>> generatePdfListings(SalesChannel channel) throws UserInfoException { SubMonitor m = monitorFactory.newSubMonitor("Endkundenlisten erstellen", 10); m.message("lade Gertedaten"); m.start(); List<StockUnit> stockUnits = new StockUnitEao(stockEm).findByNoLogicTransaction(); List<UniqueUnit> uniqueUnits = new UniqueUnitEao(uuEm).findByIds(toUniqueUnitIds(stockUnits)); PriceType priceType = (channel == SalesChannel.CUSTOMER ? PriceType.CUSTOMER : PriceType.RETAILER); m.worked(2, "prfe und filtere Gerte"); SortedMap<UniqueUnit, StockUnit> uusus = toSortedMap(uniqueUnits, stockUnits, new UniqueUnitComparator()); for (Iterator<Map.Entry<UniqueUnit, StockUnit>> it = uusus.entrySet().iterator(); it.hasNext();) { Map.Entry<UniqueUnit, StockUnit> entry = it.next(); UniqueUnit uu = entry.getKey(); StockUnit su = entry.getValue(); if (uu == null) throw new NullPointerException(su + " has no UniqueUnit, Database Error"); if (uu.getSalesChannel() != channel || !uu.hasPrice(priceType) || su.isInTransaction()) { it.remove(); } } L.info("Selected {} Units for the Lists", uusus.size()); m.worked(1, "sortiere und bereite Gerte vor"); Map<Product, Set<UniqueUnit>> stackedUnits = new HashMap<>(); for (Map.Entry<UniqueUnit, StockUnit> entry : uusus.entrySet()) { Product p = entry.getKey().getProduct(); if (!stackedUnits.containsKey(p)) stackedUnits.put(p, new HashSet<>()); stackedUnits.get(p).add(entry.getKey()); } List<StackedLine> stackedLines = new ArrayList<>(stackedUnits.size()); DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(Locale.GERMAN); df.applyPattern("#,###,##0.00"); for (Map.Entry<Product, Set<UniqueUnit>> entry : stackedUnits.entrySet()) { Product p = entry.getKey(); StackedLine line = new StackedLine(); line.setBrand(p.getTradeName()); line.setGroup(p.getGroup()); line.setCommodityGroupName(p.getGroup().getNote()); line.setDescription(p.getDescription()); line.setManufacturerName(p.getTradeName().getName()); line.setManufacturerPartNo(p.getPartNo()); line.setName(p.getName()); line.setImageUrl(imageFinder.findImageUrl(p.getImageId())); boolean priceChanged = false; double customerPrice = 0; for (UniqueUnit uu : entry.getValue()) { StackedLineUnit elem = new StackedLineUnit(); elem.setAccessories(UniqueUnitFormater.toSingleLineAccessories(uu)); elem.setComment(UniqueUnitFormater.toSingleLineComment(uu)); elem.setConditionLevelDescription(uu.getCondition().getNote()); elem.setMfgDate(uu.getMfgDate()); elem.setRefurbishedId(uu.getRefurbishId()); elem.setSerial(uu.getSerial()); elem.setWarranty(uu.getWarranty().getName()); if (uu.getWarranty().equals(Warranty.WARRANTY_TILL_DATE)) elem.setWarrentyTill(uu.getWarrentyValid()); double uuPrice = uu.getPrice(priceType); elem.setCustomerPrice(uuPrice); elem.setRoundedTaxedCustomerPrice(MathUtil.roundedApply(uuPrice, GlobalConfig.TAX, 0.02)); // For the "ab XXX" handler if (customerPrice == 0) { customerPrice = uuPrice; } else if (customerPrice > uuPrice) { customerPrice = uuPrice; priceChanged = true; } else if (customerPrice < uuPrice) { priceChanged = true; } elem.normaize(); line.add(elem); } line.setAmount(line.getUnits().size()); line.setCustomerPriceLabel((priceChanged ? "ab " : "") + df.format(MathUtil.roundedApply(customerPrice, GlobalConfig.TAX, 0.02))); line.normaize(); stackedLines.add(line); } L.info("Created {} Lines for the Lists", stackedLines.size()); m.worked(1, "erzeuge listen"); Set<ListingConfiguration> configs = new HashSet<>(); if (listingService.isAmbiguous() || listingService.isUnsatisfied()) { for (TradeName brand : TradeName.values()) { for (ProductGroup value : ProductGroup.values()) { configs.add(ListingConfiguration.builder().filePrefix("Gerteliste ") .name(brand.getName() + " " + value.getName()).brand(brand).groups(EnumSet.of(value)) .headLeft("Beispieltext Links\nZeile 2").headCenter("Beispieltext Mitte\nZeile 2") .headRight("Beispieltext Rechts\nZeile 2").footer("Fusszeilentext").build()); } } } else { configs.addAll(listingService.get().listingConfigurations()); } m.setWorkRemaining(configs.size() + 1); Map<TradeName, Collection<FileJacket>> jackets = new HashMap<>(); for (ListingConfiguration config : configs) { m.worked(1, "erstelle Liste " + config.getName()); if (StringUtils.isBlank(config.getJasperTemplateFile())) config.setJasperTemplateFile(compileReportToTempFile("CustomerSalesListing")); if (StringUtils.isBlank(config.getJasperTempleteUnitsFile())) config.setJasperTempleteUnitsFile(compileReportToTempFile("CustomerSalesListingUnits")); FileJacket fj = createListing(config, stackedLines); if (fj != null) { if (!jackets.containsKey(config.getBrand())) jackets.put(config.getBrand(), new HashSet<>()); jackets.get(config.getBrand()).add(fj); } } m.finish(); return jackets; }
From source file:software.coolstuff.springframework.owncloud.service.impl.rest.OwncloudRestResourceServiceTest.java
@Override protected void prepare_createDirectory_OK(OwncloudTestResourceImpl expectedResource) throws Exception { ArrayList<DavResource> result = Lists.newArrayList(createDavResourceFrom(expectedResource, Locale.GERMAN)); Mockito.when(sardine.list(getResourcePath(expectedResource.getHref()), 0)) .then(new Answer<List<DavResource>>() { private int count = 0; @Override//from w ww . ja v a2s. c o m public List<DavResource> answer(InvocationOnMock invocation) throws Throwable { if (count++ == 0) { throw new SardineException("not Found", HttpStatus.NOT_FOUND.value(), "not Found"); } return result; } }); }
From source file:test.be.fedict.eid.applet.PcscTest.java
@Test public void pcscChangePin() throws Exception { this.messages = new Messages(Locale.GERMAN); PcscEidSpi pcscEidSpi = new PcscEid(new TestView(), this.messages); if (false == pcscEidSpi.isEidPresent()) { LOG.debug("insert eID card"); pcscEidSpi.waitForEidPresent();//from w w w . j a v a 2s. c om } pcscEidSpi.changePin(); pcscEidSpi.close(); }
From source file:test.be.fedict.eid.applet.PcscTest.java
@Test public void diagnosticTests() throws Exception { this.messages = new Messages(Locale.GERMAN); PcscEidSpi pcscEidSpi = new PcscEid(new TestView(), this.messages); DiagnosticTestCallbackHandler callbackHandler = new DiagnosticTestCallbackHandler(); pcscEidSpi.diagnosticTests(callbackHandler); pcscEidSpi.close();//from w w w. jav a2 s. c o m }