Author: mvitenkov
Date: 2008-10-27 11:40:55 -0400 (Mon, 27 Oct 2008)
New Revision: 10913
Modified:
trunk/test-applications/jsp/src/main/java/util/componentInfo/ComponentInfo.java
trunk/test-applications/jsp/src/main/java/util/componentInfo/Info.java
trunk/test-applications/jsp/src/main/java/util/parser/TLDParser.java
Log:
TLDParser last version, that get description, type(method-signature), name and status of
all attributes for tested component.
Modified: trunk/test-applications/jsp/src/main/java/util/componentInfo/ComponentInfo.java
===================================================================
---
trunk/test-applications/jsp/src/main/java/util/componentInfo/ComponentInfo.java 2008-10-27
15:29:26 UTC (rev 10912)
+++
trunk/test-applications/jsp/src/main/java/util/componentInfo/ComponentInfo.java 2008-10-27
15:40:55 UTC (rev 10913)
@@ -95,7 +95,7 @@
AccessibleObject.setAccessible(fields, true);
for (Field field : fields) {
str = field.getName().substring(1);
- if (!Modifier.isStatic(field.getModifiers()) && (allAttributes.contains(str)))
{
+ if (!Modifier.isStatic(field.getModifiers()) &&
(parser.getNamesArray().contains(str))) {
if (str.startsWith("on")) {
componentAttribute.putEvent(str,
"");
Modified: trunk/test-applications/jsp/src/main/java/util/componentInfo/Info.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/util/componentInfo/Info.java 2008-10-27
15:29:26 UTC (rev 10912)
+++ trunk/test-applications/jsp/src/main/java/util/componentInfo/Info.java 2008-10-27
15:40:55 UTC (rev 10913)
@@ -21,7 +21,7 @@
*/
public class Info {
private ComponentInfo info = ComponentInfo.getInstance();
- private ComponentAttribute componentAttribute = info.getComponentAttribute();;
+ private ComponentAttribute componentAttribute = info.getComponentAttribute();
private HtmlPanelGrid panelEvent = null;
public HtmlPanelGrid getPanelEvent() {
Modified: trunk/test-applications/jsp/src/main/java/util/parser/TLDParser.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/util/parser/TLDParser.java 2008-10-27
15:29:26 UTC (rev 10912)
+++ trunk/test-applications/jsp/src/main/java/util/parser/TLDParser.java 2008-10-27
15:40:55 UTC (rev 10913)
@@ -33,6 +33,7 @@
Attribute attribute = new Attribute();
int position, end;
boolean flag = true;
+ StringBuilder sb = new StringBuilder("");
while (((line = reader.readLine()) != null) && flag) {
if ((position = line.indexOf("<name>")) != -1) {
end = line.indexOf("</name>");
@@ -48,36 +49,33 @@
position + 6, end).trim());
}
// find attribute description
- if ((position = line
- .indexOf("<description>")) != -1) {
+ if ((position = line.indexOf("<description>")) != -1) {
- if((end = line.indexOf("</description>")) != -1){
+ if((end = line.indexOf("</description>")) != -1){
attribute.setDescription(line.substring(position + 13, line.length()-14));
}else{
- attribute.setDescription(attribute.getDescription()
- + line.substring(position + 13, line.length()));
+ sb.append(line.substring(position + 13,
line.length()).trim().replaceAll("\t", ""));
line = reader.readLine();
while ((end = line.indexOf("</description>")) == -1) {
- attribute.setDescription(attribute.getDescription() + " "
- + line.substring(0, line.length()).trim());
+ sb.append(line.substring(0, line.length()).replaceAll("\t",
""));
+ line = reader.readLine();
}
- attribute.setDescription(attribute.getDescription()
- + line.substring(0, line.length() - 14));
+ sb.append(line.substring(0, line.length() -
14).trim().replaceAll("\t", ""));
+
+ attribute.setDescription(sb.toString());
+ sb.delete(0, sb.length());
}
- }
+ }
// find attribute type
if ((position = line.indexOf("<type>")) != -1) {
end = line.indexOf("</type>");
-
- /*try {
- Class<?> cl = Class.forName(line
- .substring(position + 6,
- end).trim());*/
attribute.setType(line.substring(position + 6, end).trim());
- /*} catch (ClassNotFoundException e) {
- e.printStackTrace();
- }*/
}
+ // find attribute method-signature
+ if ((position = line.indexOf("<method-signature>")) != -1) {
+ end = line.indexOf("</method-signature>");
+ attribute.setType(line.substring(position + 18, end).trim());
+ }
} while (!((line = reader.readLine())
.contains("</attribute>")));
// define attribute status
@@ -124,4 +122,35 @@
}
return richfacesUI;
}
+ public ArrayList<String> getNamesArray(){
+ ArrayList<String> result = new ArrayList<String>();
+ for(Attribute attr:allAttributes){
+ result.add(attr.getName());
+ }
+ return result;
+ }
+
+ public ArrayList<String> getDescriptionArray(){
+ ArrayList<String> result = new ArrayList<String>();
+ for(Attribute attr:allAttributes){
+ result.add(attr.getDescription());
+ }
+ return result;
+ }
+
+ public ArrayList<String> getTypeArray(){
+ ArrayList<String> result = new ArrayList<String>();
+ for(Attribute attr:allAttributes){
+ result.add(attr.getType());
+ }
+ return result;
+ }
+
+ public ArrayList<Status> getStatusArray(){
+ ArrayList<Status> result = new ArrayList<Status>();
+ for(Attribute attr:allAttributes){
+ result.add(attr.getStatus());
+ }
+ return result;
+ }
}
Show replies by date