1   /**
2    * Copyright (c) 2000-2010 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   *
12   *
13   */
14  
15  package com.liferay.portlet.messageboards.util;
16  
17  import com.liferay.portal.kernel.util.StringPool;
18  
19  /**
20   * <a href="BBCodeTag.java.html"><b><i>View Source</i></b></a>
21   *
22   * @author Alexander Chow
23   */
24  public class BBCodeTag {
25  
26      public BBCodeTag() {
27      }
28  
29      public String getElement() {
30          return _element;
31      }
32  
33      public void setElement(String element) {
34          _element = element;
35      }
36  
37      public boolean hasElement() {
38          if (_element != null) {
39              return true;
40          }
41          else {
42              return false;
43          }
44      }
45  
46      public int getEndPos() {
47          return _endPos;
48      }
49  
50      public void setEndPos(int pos) {
51          _endPos = pos;
52      }
53  
54      public String getParameter() {
55          return _parameter;
56      }
57  
58      public void setParameter(String parameter) {
59          _parameter = parameter.trim();
60  
61          if (_parameter.startsWith(StringPool.APOSTROPHE) ||
62              _parameter.startsWith(StringPool.QUOTE)) {
63  
64              _parameter = _parameter.substring(1);
65          }
66  
67          if (_parameter.endsWith(StringPool.APOSTROPHE) ||
68              _parameter.endsWith(StringPool.QUOTE)) {
69  
70              _parameter = _parameter.substring(0, _parameter.length() - 1);
71          }
72  
73          _parameter = _parameter.trim();
74      }
75  
76      public boolean hasParameter() {
77          if (_parameter != null) {
78              return true;
79          }
80          else {
81              return false;
82          }
83      }
84  
85      public int getStartPos() {
86          return _startPos;
87      }
88  
89      public void setStartPos(int pos) {
90          _startPos = pos;
91      }
92  
93      private String _element;
94      private int _endPos;
95      private String _parameter;
96      private int _startPos;
97  
98  }