X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.message%2Fsrc%2Forg%2Fsimantics%2Fmessage%2Futil%2FHtmlUtil.java;h=a6b4ba41b47c59ba1004ecae0a304d7ebb17b318;hb=38f8cf1831e50990f7053dfaa20db64a6342015f;hp=04f301297922964e368b86af62ff34e8cf7b288a;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.message/src/org/simantics/message/util/HtmlUtil.java b/bundles/org.simantics.message/src/org/simantics/message/util/HtmlUtil.java index 04f301297..a6b4ba41b 100644 --- a/bundles/org.simantics.message/src/org/simantics/message/util/HtmlUtil.java +++ b/bundles/org.simantics.message/src/org/simantics/message/util/HtmlUtil.java @@ -1,86 +1,86 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.message.util; - -import java.net.URI; - -/** - * @author Tuukka Lehtonen - */ -public final class HtmlUtil { - - /** - * Encloses the specified text within a <form> tag. - * - * @param text the text to enclose - * @return the enclosed text - */ - public static String html(String text) { - return TagUtil.tag(TagUtil.tag("", "head") + TagUtil.tag(TagUtil.tag(text, "pre"), "body"), "html"); - } - - /** - * Produces a standard HTML <a> anchor tag with the specified - * contents. - * - * @param href the href attribute value of the produced anchor - * (<a href="href"></a>) - * @param text the text inside the anchor element (<a> - * text</a>) - * @return the anchor - */ - public static String a(String href, String text) { - return TagUtil.tag(text, "a", "href", href); - } - - /** - * Produces a standard HTML <a> anchor tag with the specified - * contents. - * - * @param href the href attribute value of the produced anchor - * (<a href="href"></a>) - * @param text the text inside the anchor element (<a> - * text</a>) - * @return the anchor - */ - public static String a(URI href, String text) { - return a(href.toASCIIString(), text); - } - - /** - * Produces a standard HTML <a> anchor tag with the - * specified contents. - * - * @param scheme the <scheme> part of the URI of form - * <scheme>:<scheme-specific-part> - * @param identifier the <scheme-specific-part> part of - * the URI of form - * <scheme>:<scheme-specific-part> - * @param text the text inside the anchor element (<a> - * text</a>) - * @return the anchor - */ - public static String a(String scheme, String identifier, String text) { - return TagUtil.tag(text, "a", "href", scheme + ":" + identifier); - } - - /** - * Encloses the specified text within a <p> tag. - * - * @param text the text to enclose - * @return the enclosed text - */ - public static String p(String text) { - return TagUtil.tag(text, "p"); - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.message.util; + +import java.net.URI; + +/** + * @author Tuukka Lehtonen + */ +public final class HtmlUtil { + + /** + * Encloses the specified text within a <form> tag. + * + * @param text the text to enclose + * @return the enclosed text + */ + public static String html(String text) { + return TagUtil.tag(TagUtil.tag("", "head") + TagUtil.tag(TagUtil.tag(text, "pre"), "body"), "html"); + } + + /** + * Produces a standard HTML <a> anchor tag with the specified + * contents. + * + * @param href the href attribute value of the produced anchor + * (<a href="href"></a>) + * @param text the text inside the anchor element (<a> + * text</a>) + * @return the anchor + */ + public static String a(String href, String text) { + return TagUtil.tag(text, "a", "href", href); + } + + /** + * Produces a standard HTML <a> anchor tag with the specified + * contents. + * + * @param href the href attribute value of the produced anchor + * (<a href="href"></a>) + * @param text the text inside the anchor element (<a> + * text</a>) + * @return the anchor + */ + public static String a(URI href, String text) { + return a(href.toASCIIString(), text); + } + + /** + * Produces a standard HTML <a> anchor tag with the + * specified contents. + * + * @param scheme the <scheme> part of the URI of form + * <scheme>:<scheme-specific-part> + * @param identifier the <scheme-specific-part> part of + * the URI of form + * <scheme>:<scheme-specific-part> + * @param text the text inside the anchor element (<a> + * text</a>) + * @return the anchor + */ + public static String a(String scheme, String identifier, String text) { + return TagUtil.tag(text, "a", "href", scheme + ":" + identifier); + } + + /** + * Encloses the specified text within a <p> tag. + * + * @param text the text to enclose + * @return the enclosed text + */ + public static String p(String text) { + return TagUtil.tag(text, "p"); + } + +}