1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.messageboards.util;
21  
22  import com.liferay.portal.kernel.util.StringPool;
23  
24  /**
25   * <a href="BBCodeTag.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Alexander Chow
28   *
29   */
30  public class BBCodeTag {
31  
32      public BBCodeTag() {
33      }
34  
35      public String getElement() {
36          return _element;
37      }
38  
39      public void setElement(String element) {
40          _element = element;
41      }
42  
43      public boolean hasElement() {
44          if (_element != null) {
45              return true;
46          }
47          else {
48              return false;
49          }
50      }
51  
52      public int getEndPos() {
53          return _endPos;
54      }
55  
56      public void setEndPos(int pos) {
57          _endPos = pos;
58      }
59  
60      public String getParameter() {
61          return _parameter;
62      }
63  
64      public void setParameter(String parameter) {
65          _parameter = parameter.trim();
66  
67          if (_parameter.startsWith(StringPool.APOSTROPHE) ||
68              _parameter.startsWith(StringPool.QUOTE)) {
69  
70              _parameter = _parameter.substring(1);
71          }
72  
73          if (_parameter.endsWith(StringPool.APOSTROPHE) ||
74              _parameter.endsWith(StringPool.QUOTE)) {
75  
76              _parameter = _parameter.substring(0, _parameter.length() - 1);
77          }
78  
79          _parameter = _parameter.trim();
80      }
81  
82      public boolean hasParameter() {
83          if (_parameter != null) {
84              return true;
85          }
86          else {
87              return false;
88          }
89      }
90  
91      public int getStartPos() {
92          return _startPos;
93      }
94  
95      public void setStartPos(int pos) {
96          _startPos = pos;
97      }
98  
99      private String _element;
100     private int _endPos;
101     private String _parameter;
102     private int _startPos;
103 
104 }