001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.bean.html5; 018 019import org.apache.juneau.marshall.*; 020 021/** 022 * DTO for an HTML <a class="doclink" href="https://www.w3.org/TR/html5/text-level-semantics.html#the-bdo-element"><bdo></a> 023 * element. 024 * 025 * <p> 026 * The bdo element represents a span of text that is to be formatted in a different direction than 027 * the surrounding text. It is used to override the bidirectional algorithm and explicitly set the 028 * direction of text. The bdo element requires a dir attribute to specify the text direction, which 029 * can be "ltr" (left-to-right) or "rtl" (right-to-left). 030 * 031 * <h5 class='section'>Examples:</h5> 032 * <p class='bcode w800'> 033 * <jk>import static</jk> org.apache.juneau.bean.html5.HtmlBuilder.*; 034 * 035 * <jc>// Right-to-left text</jc> 036 * Bdo <jv>rtl</jv> = <jsm>bdo</jsm>(<js>"rtl"</js>, <js>"مرحبا بالعالم"</js>); 037 * 038 * <jc>// Left-to-right text</jc> 039 * Bdo <jv>ltr</jv> = <jsm>bdo</jsm>(<js>"ltr"</js>, <js>"Hello World"</js>); 040 * 041 * <jc>// Mixed direction text</jc> 042 * Bdo <jv>mixed</jv> = <jsm>bdo</jsm>(<js>"rtl"</js>, <js>"Hello "</js>, <jsm>bdo</jsm>(<js>"ltr"</js>, <js>"World"</js>), <js>" مرحبا"</js>); 043 * 044 * <jc>// Hebrew text with explicit direction</jc> 045 * Bdo <jv>hebrew</jv> = <jsm>bdo</jsm>(<js>"rtl"</js>, <js>"שלום עולם"</js>); 046 * 047 * <jc>// Arabic text with explicit direction</jc> 048 * Bdo <jv>arabic</jv> = <jsm>bdo</jsm>(<js>"rtl"</js>, <js>"مرحبا بالعالم"</js>); 049 * 050 * <jc>// Styled bidirectional text</jc> 051 * Bdo <jv>styled</jv> = <jsm>bdo</jsm>(<js>"rtl"</js>, <js>"نص باللغة العربية"</js>) 052 * .class_(<js>"bidi-text"</js>) 053 * .style(<js>"color: blue;"</js>); 054 * 055 * <jc>// Numbers with explicit direction</jc> 056 * Bdo <jv>numbers</jv> = <jsm>bdo</jsm>(<js>"rtl"</js>, <js>"١٢٣٤٥"</js>); 057 * </p> 058 * 059 * <p> 060 * The following convenience methods are provided for constructing instances of this bean: 061 * <ul class='javatree'> 062 * <li class='jc'>{@link HtmlBuilder} 063 * <ul class='javatree'> 064 * <li class='jm'>{@link HtmlBuilder#bdo() bdo()} 065 * <li class='jm'>{@link HtmlBuilder#bdo(String, Object...) bdo(String, Object...)} 066 * </ul> 067 * </ul> 068 * </p> 069 * 070 * <h5 class='section'>See Also:</h5><ul> 071 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 072 * </ul> 073 */ 074@Marshalled(typeName = "bdo") 075public class Bdo extends HtmlElementMixed<Bdo> { 076 077 /** 078 * Creates an empty {@link Bdo} element. 079 */ 080 public Bdo() {} 081 082 /** 083 * Creates a {@link Bdo} element with the specified {@link Bdo#dir(String)} attribute and child nodes. 084 * 085 * @param dir The {@link Bdo#dir(String)} attribute. 086 * @param children The child nodes. 087 */ 088 public Bdo(String dir, Object...children) { 089 dir(dir).children(children); 090 } 091 092}