001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.messageboards.util;
016    
017    import com.liferay.portal.kernel.util.StringPool;
018    
019    /**
020     * @author Alexander Chow
021     */
022    public class BBCodeTag {
023    
024            public BBCodeTag() {
025            }
026    
027            public String getElement() {
028                    return _element;
029            }
030    
031            public void setElement(String element) {
032                    _element = element;
033            }
034    
035            public boolean hasElement() {
036                    if (_element != null) {
037                            return true;
038                    }
039                    else {
040                            return false;
041                    }
042            }
043    
044            public int getEndPos() {
045                    return _endPos;
046            }
047    
048            public void setEndPos(int pos) {
049                    _endPos = pos;
050            }
051    
052            public String getParameter() {
053                    return _parameter;
054            }
055    
056            public void setParameter(String parameter) {
057                    _parameter = parameter.trim();
058    
059                    if (_parameter.startsWith(StringPool.APOSTROPHE) ||
060                            _parameter.startsWith(StringPool.QUOTE)) {
061    
062                            _parameter = _parameter.substring(1);
063                    }
064    
065                    if (_parameter.endsWith(StringPool.APOSTROPHE) ||
066                            _parameter.endsWith(StringPool.QUOTE)) {
067    
068                            _parameter = _parameter.substring(0, _parameter.length() - 1);
069                    }
070    
071                    _parameter = _parameter.trim();
072            }
073    
074            public boolean hasParameter() {
075                    if (_parameter != null) {
076                            return true;
077                    }
078                    else {
079                            return false;
080                    }
081            }
082    
083            public int getStartPos() {
084                    return _startPos;
085            }
086    
087            public void setStartPos(int pos) {
088                    _startPos = pos;
089            }
090    
091            private String _element;
092            private int _endPos;
093            private String _parameter;
094            private int _startPos;
095    
096    }