/** * Returns a {@link RowColumnVector} object representing the row and column number of the {@linkplain #getBegin() start} of this segment in the source document. * @return a {@link RowColumnVector} object representing the row and column number of the {@linkplain #getBegin() start} of this segment in the source document. * @see Source#getRowColumnVector(int pos) */ public RowColumnVector getRowColumnVector() { return source.getRowColumnVector(begin); }
/** * Returns the row number of the specified character position in the source document. * @param pos the position in the source document. * @return the row number of the specified character position in the source document. * @throws IndexOutOfBoundsException if the specified position is not within the bounds of the document. * @see #getColumn(int pos) * @see #getRowColumnVector(int pos) */ public int getRow(final int pos) { return getRowColumnVector(pos).getRow(); }
/** * Returns the column number of the specified character position in the source document. * @param pos the position in the source document. * @return the column number of the specified character position in the source document. * @throws IndexOutOfBoundsException if the specified position is not within the bounds of the document. * @see #getRow(int pos) * @see #getRowColumnVector(int pos) */ public int getColumn(final int pos) { return getRowColumnVector(pos).getColumn(); }
/** * Returns a string representation of this object useful for debugging purposes. * @return a string representation of this object useful for debugging purposes. */ public String getDebugInfo() { final StringBuilder sb=new StringBuilder(50); sb.append('('); source.getRowColumnVector(begin).appendTo(sb); sb.append('-'); source.getRowColumnVector(end).appendTo(sb); sb.append(')'); return sb.toString(); }
private static void log(final Source source, final String part1, final CharSequence part2, final int begin, final String part3) { source.logger.error(source.getRowColumnVector(begin).appendTo(new StringBuilder(200).append(part1).append(' ').append(part2).append(" at ")).append(' ').append(part3).toString()); } }
private static void log(final Source source, final String part1, final CharSequence part2, final int begin, final String part3, final int pos) { source.logger.error(source.getRowColumnVector(pos).appendTo(source.getRowColumnVector(begin).appendTo(new StringBuilder(200).append(part1).append(' ').append(part2).append(" at ")).append(' ').append(part3).append(" at position ")).toString()); }
public RadioCheckboxFormControl(final Element element, final FormControlType formControlType) { super(element,formControlType,true); if (elementContainer.predefinedValue==null) { elementContainer.predefinedValue=CHECKBOX_NULL_DEFAULT_VALUE; if (element.source.logger.isErrorEnabled()) element.source.logger.error(element.source.getRowColumnVector(element.begin).appendTo(new StringBuilder(200)).append(": compulsory \"value\" attribute of ").append(formControlType).append(" control \"").append(name).append("\" is missing, assuming the value \"").append(CHECKBOX_NULL_DEFAULT_VALUE).append('"').toString()); } } public boolean setValue(final String value) {
private void verifyName() { if (formControlType.isSubmit()) return; String missingOrBlank; if (name==null) return; if (name.length()!=0) return; final Source source=getElement().source; if (source.logger.isErrorEnabled()) source.logger.error(getElement().source.getRowColumnVector(getElement().begin).appendTo(new StringBuilder(200)).append(": compulsory \"name\" attribute of ").append(formControlType).append(" control is empty").toString()); }
Source source=(Source)sourceText; sb.append('('); source.getRowColumnVector(outputSegment.getBegin()).appendTo(sb); sb.append('-'); source.getRowColumnVector(outputSegment.getEnd()).appendTo(sb); sb.append(')'); } else {
protected Tag constructTagAt(final Source source, final int pos) { final int closingDelimiterPos=source.getParseText().indexOf('>',pos+1); if (closingDelimiterPos==-1) return null; final Tag tag=constructStartTag(source,pos,closingDelimiterPos+1,"",null); if (source.logger.isErrorEnabled()) source.logger.error(source.getRowColumnVector(tag.getBegin()).appendTo(new StringBuilder(200).append("Encountered possible StartTag at ")).append(" whose content does not match a registered StartTagType").toString()); return tag; } }
@Override public int getFirstLine() { return e.getSource().getRowColumnVector(e.getBegin()).getRow(); }
@Override public int getLastLine() { return e.getSource().getRowColumnVector(e.getEnd()).getRow(); }
@Override public int getFirstLine() { return e.getSource().getRowColumnVector(e.getBegin()).getRow(); }
@Override public int getLastLine() { return e.getSource().getRowColumnVector(e.getEnd()).getRow(); }
protected Tag constructTagAt(final Source source, final int pos) { final ParseText parseText=source.getParseText(); final int nameBegin=pos+getStartDelimiter().length(); final int nameEnd=parseText.indexOf(getClosingDelimiter(),nameBegin); final String name=source.getName(nameBegin,nameEnd); // throws IndexOutOfBoundsException if nameEnd==-1 final EndTag endTag=constructEndTag(source,pos,nameEnd+getClosingDelimiter().length(),name); if (source.logger.isErrorEnabled()) source.logger.error(source.getRowColumnVector(pos).appendTo(new StringBuilder(200).append("Encountered possible EndTag at ")).append(" whose content does not match a registered EndTagType").toString()); return endTag; } }
static final Tag getTagAt(final Source source, final int pos, final boolean serverTagOnly, final boolean assumeNoNestedTags) { final TagTypeRegister.ProspectiveTagTypeIterator prospectiveTagTypeIterator=new TagTypeRegister.ProspectiveTagTypeIterator(source,pos); // prospectiveTagTypeIterator is empty if pos is out of range. while (prospectiveTagTypeIterator.hasNext()) { final TagType tagType=prospectiveTagTypeIterator.next(); if (serverTagOnly && !tagType.isServerTag()) continue; if (!assumeNoNestedTags && !tagType.isValidPosition(source,pos,source.fullSequentialParseData)) continue; try { final Tag tag=tagType.constructTagAt(source,pos); if (tag!=null) return tag; } catch (IndexOutOfBoundsException ex) { if (source.logger.isErrorEnabled()) source.logger.error(source.getRowColumnVector(pos).appendTo(new StringBuilder(200).append("Tag at ")).append(" not recognised as type '").append(tagType.getDescription()).append("' because it has no end delimiter").toString()); } } return null; }
if (source.logger.isErrorEnabled() && !element.equals(endTag.element)) source.logger.error(source.getRowColumnVector(endTag.begin).appendTo(new StringBuilder(200).append("End tag ").append(endTag).append(" at ")).append(" terminates more than one element").toString());
name=getNamePrefix(); if (!parseText.containsAt(getClosingDelimiter(),startDelimiterEnd)) { if (source.logger.isErrorEnabled()) source.logger.error(source.getRowColumnVector(pos).appendTo(new StringBuilder(200).append("EndTag of expected format ").append(staticString).append(" at ")).append(" not recognised as type '").append(getDescription()).append("' because it is missing the closing delimiter").toString()); return null; while (Segment.isWhiteSpace(parseText.charAt(expectedClosingDelimiterPos))) expectedClosingDelimiterPos++; if (!parseText.containsAt(getClosingDelimiter(),expectedClosingDelimiterPos)) { if (source.logger.isErrorEnabled()) source.logger.error(source.getRowColumnVector(pos).appendTo(new StringBuilder(200).append("EndTag ").append(name).append(" at ")).append(" not recognised as type '").append(getDescription()).append("' because its name and closing delimiter are separated by characters other than white space").toString()); return null;
final StartTag nextStartTag=source.getNextStartTag(end,name); if (nextStartTag==null || nextStartTag.begin>nextEndTag.begin) return nextEndTag; if (source.logger.isErrorEnabled()) source.logger.error(source.getRowColumnVector(begin).appendTo(new StringBuilder(200).append("StartTag at ")).append(" missing required end tag - invalid nested start tag encountered before end tag").toString()); if (getResult!=null) return (EndTag)getResult[0]; if (source.logger.isErrorEnabled()) source.logger.error(source.getRowColumnVector(begin).appendTo(new StringBuilder(200).append("StartTag at ")).append(" missing required end tag").toString()); return null;
if (formControlType==null) { if (FormControlType.isNonFormControl(typeAttributeValue)) return null; if (element.source.logger.isErrorEnabled()) element.source.logger.error(element.source.getRowColumnVector(element.begin).appendTo(new StringBuilder(200)).append(": INPUT control with unrecognised type \"").append(typeAttributeValue).append("\" assumed to be type \"text\"").toString()); formControlType=FormControlType.TEXT;