| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
package net.smartlab.web.page; |
| 25 |
|
|
| 26 |
|
import java.util.Enumeration; |
| 27 |
|
|
| 28 |
|
import javax.servlet.jsp.tagext.TagData; |
| 29 |
|
import javax.servlet.jsp.tagext.TagExtraInfo; |
| 30 |
|
import javax.servlet.jsp.tagext.ValidationMessage; |
| 31 |
|
import javax.servlet.jsp.tagext.VariableInfo; |
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
@author |
| 37 |
|
|
|
|
|
| 0% |
Uncovered Elements: 44 (44) |
Complexity: 13 |
Complexity Density: 0,52 |
|
| 38 |
|
public class PaginateTei extends TagExtraInfo { |
| 39 |
|
|
| 40 |
|
|
| 41 |
|
@see |
| 42 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 43 |
0
|
public final VariableInfo[] getVariableInfo(TagData data) {... |
| 44 |
0
|
return new VariableInfo[] {new VariableInfo("paginator", "net.smartlab.web.page.Paginator", true, VariableInfo.NESTED)}; |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
@see |
| 49 |
|
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 6 |
Complexity Density: 0,5 |
|
| 50 |
0
|
public boolean isValid(TagData tagData) {... |
| 51 |
0
|
boolean hasHref = false; |
| 52 |
0
|
boolean hasForm = false; |
| 53 |
|
|
| 54 |
0
|
Enumeration attributes = tagData.getAttributes(); |
| 55 |
0
|
while (attributes.hasMoreElements()) { |
| 56 |
0
|
String attribute = (String)attributes.nextElement(); |
| 57 |
0
|
if (attribute.equals("href")) { |
| 58 |
0
|
hasHref = true; |
| 59 |
0
|
} else if (attribute.equals("form")) { |
| 60 |
0
|
hasForm = true; |
| 61 |
|
} |
| 62 |
|
} |
| 63 |
0
|
if (hasHref && hasForm) { |
| 64 |
|
|
| 65 |
0
|
return false; |
| 66 |
|
} |
| 67 |
0
|
return true; |
| 68 |
|
} |
| 69 |
|
|
| 70 |
|
|
| 71 |
|
@see |
| 72 |
|
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 6 |
Complexity Density: 0,5 |
|
| 73 |
0
|
public ValidationMessage[] validate(TagData tagData) {... |
| 74 |
0
|
boolean hasHref = false; |
| 75 |
0
|
boolean hasForm = false; |
| 76 |
|
|
| 77 |
0
|
Enumeration attributes = tagData.getAttributes(); |
| 78 |
0
|
while (attributes.hasMoreElements()) { |
| 79 |
0
|
String attribute = (String)attributes.nextElement(); |
| 80 |
0
|
if (attribute.equals("href")) { |
| 81 |
0
|
hasHref = true; |
| 82 |
0
|
} else if (attribute.equals("form")) { |
| 83 |
0
|
hasForm = true; |
| 84 |
|
} |
| 85 |
|
} |
| 86 |
0
|
if (hasHref && hasForm) { |
| 87 |
0
|
return new ValidationMessage[] {new ValidationMessage(tagData.getId(), "Page tag has both href and form attributes")}; |
| 88 |
|
} |
| 89 |
0
|
return null; |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
} |