diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-09-05 19:50:56 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-09-05 19:51:15 +0300 |
commit | 7d25670284b11c7c62ba25183f265227cb3dba83 (patch) | |
tree | c8e76eb70dd3cdd5cf59a99419635f2188b25c24 /server/src/org/jsoup/examples/ListLinks.java | |
parent | 1d0c96de9595c243d88471476d21e5f248be63f7 (diff) | |
download | vaadin-framework-7d25670284b11c7c62ba25183f265227cb3dba83.tar.gz vaadin-framework-7d25670284b11c7c62ba25183f265227cb3dba83.zip |
Reformat project
Diffstat (limited to 'server/src/org/jsoup/examples/ListLinks.java')
-rw-r--r-- | server/src/org/jsoup/examples/ListLinks.java | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/server/src/org/jsoup/examples/ListLinks.java b/server/src/org/jsoup/examples/ListLinks.java index 64b29ba107..d57a488435 100644 --- a/server/src/org/jsoup/examples/ListLinks.java +++ b/server/src/org/jsoup/examples/ListLinks.java @@ -1,13 +1,13 @@ package org.jsoup.examples; +import java.io.IOException; + import org.jsoup.Jsoup; import org.jsoup.helper.Validate; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; -import java.io.IOException; - /** * Example program to list links from a URL. */ @@ -24,22 +24,25 @@ public class ListLinks { print("\nMedia: (%d)", media.size()); for (Element src : media) { - if (src.tagName().equals("img")) - print(" * %s: <%s> %sx%s (%s)", - src.tagName(), src.attr("abs:src"), src.attr("width"), src.attr("height"), - trim(src.attr("alt"), 20)); - else + if (src.tagName().equals("img")) { + print(" * %s: <%s> %sx%s (%s)", src.tagName(), + src.attr("abs:src"), src.attr("width"), + src.attr("height"), trim(src.attr("alt"), 20)); + } else { print(" * %s: <%s>", src.tagName(), src.attr("abs:src")); + } } print("\nImports: (%d)", imports.size()); for (Element link : imports) { - print(" * %s <%s> (%s)", link.tagName(),link.attr("abs:href"), link.attr("rel")); + print(" * %s <%s> (%s)", link.tagName(), link.attr("abs:href"), + link.attr("rel")); } print("\nLinks: (%d)", links.size()); for (Element link : links) { - print(" * a: <%s> (%s)", link.attr("abs:href"), trim(link.text(), 35)); + print(" * a: <%s> (%s)", link.attr("abs:href"), + trim(link.text(), 35)); } } @@ -48,9 +51,10 @@ public class ListLinks { } private static String trim(String s, int width) { - if (s.length() > width) - return s.substring(0, width-1) + "."; - else + if (s.length() > width) { + return s.substring(0, width - 1) + "."; + } else { return s; + } } } |