001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.messageboards.util;
022:
023: import com.liferay.portal.kernel.util.StringPool;
024:
025: /**
026: * <a href="BBCodeTag.java.html"><b><i>View Source</i></b></a>
027: *
028: * @author Alexander Chow
029: *
030: */
031: public class BBCodeTag {
032:
033: public BBCodeTag() {
034: }
035:
036: public String getElement() {
037: return _element;
038: }
039:
040: public void setElement(String element) {
041: _element = element;
042: }
043:
044: public boolean hasElement() {
045: if (_element != null) {
046: return true;
047: } else {
048: return false;
049: }
050: }
051:
052: public int getEndPos() {
053: return _endPos;
054: }
055:
056: public void setEndPos(int pos) {
057: _endPos = pos;
058: }
059:
060: public String getParameter() {
061: return _parameter;
062: }
063:
064: public void setParameter(String parameter) {
065: _parameter = parameter.trim();
066:
067: if (_parameter.startsWith(StringPool.APOSTROPHE)
068: || _parameter.startsWith(StringPool.QUOTE)) {
069:
070: _parameter = _parameter.substring(1);
071: }
072:
073: if (_parameter.endsWith(StringPool.APOSTROPHE)
074: || _parameter.endsWith(StringPool.QUOTE)) {
075:
076: _parameter = _parameter.substring(0,
077: _parameter.length() - 1);
078: }
079:
080: _parameter = _parameter.trim();
081: }
082:
083: public boolean hasParameter() {
084: if (_parameter != null) {
085: return true;
086: } else {
087: return false;
088: }
089: }
090:
091: public int getStartPos() {
092: return _startPos;
093: }
094:
095: public void setStartPos(int pos) {
096: _startPos = pos;
097: }
098:
099: private String _element;
100: private int _endPos;
101: private String _parameter;
102: private int _startPos;
103:
104: }
|