Author: doogie
Date: Wed Sep 8 19:03:31 2010
New Revision: 995204
URL:
http://svn.apache.org/viewvc?rev=995204&view=revLog:
Remember the node's systemId, startColumn, and startLine, and use them
in a default toString() implementation.
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java?rev=995204&r1=995203&r2=995204&view=diff==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java Wed Sep 8 19:03:31 2010
@@ -53,6 +53,9 @@ public class ModelWidget implements Seri
public static final String enableBoundaryCommentsParam = "widgetVerbose";
protected String name;
protected boolean enableWidgetBoundaryComments = false;
+ private String systemId;
+ private int startColumn;
+ private int startLine;
protected ModelWidget() {}
@@ -62,6 +65,9 @@ public class ModelWidget implements Seri
*/
public ModelWidget(Element widgetElement) {
this.name = widgetElement.getAttribute("name");
+ this.systemId = (String) widgetElement.getUserData("systemId");
+ this.startColumn = ((Integer) widgetElement.getUserData("startColumn")).intValue();
+ this.startLine = ((Integer) widgetElement.getUserData("startLine")).intValue();
}
/**
@@ -73,6 +79,35 @@ public class ModelWidget implements Seri
}
/**
+ * Returns the url as a string, from where this widget was defined.
+ * @return url
+ */
+ public String getSystemId() {
+ return systemId;
+ }
+
+ /**
+ * Returns the column where this widget was defined, in it's containing xml file.
+ * @return start column
+ */
+ public int getStartColumn() {
+ return startColumn;
+ }
+
+ /**
+ * Returns the line where this widget was defined, in it's containing xml file.
+ * @return start line
+ */
+ public int getStartLine() {
+ return startLine;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + getSystemId() + "#" + getName() + "@" + getStartColumn() + "," + getStartLine() + "]";
+ }
+
+ /**
* Returns the widget's name to be used in boundary comments. The default action
* is to return the widget's name. Derived classes can override this method to
* return a customized name.