Author: knopp
Date: Mon Jan 14 11:19:17 2008
New Revision: 611897
URL: http://svn.apache.org/viewvc?rev=611897&view=rev
Log:
WICKET-1283
Modified:
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java
Modified:
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java?rev=611897&r1=611896&r2=611897&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java
(original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java
Mon Jan 14 11:19:17 2008
@@ -1391,15 +1391,21 @@
* attribute set explicitly via a call to [EMAIL PROTECTED]
#setMarkupId(String)}, id attribute defined in
* the markup, or an automatically generated id - in that order.
* <p>
- * If no explicit id is set this function will generate an id value
that will be unique in the
- * page. This is the preferred way as there is no chance of id
collision.
+ * If no id is set and <code>createIfDoesNotExist</code> is false, this
method will return
+ * null. Otherwise it will generate an id value that will be unique in
the page. This is the
+ * preferred way as there is no chance of id collision.
* <p>
* Note: This method should only be called after the component or its
parent have been added to
* the page.
*
+ * @param createIfDoesNotExist
+ * When there is no existing markup id, determines whether
it should be generated or
+ * whether <code>null</code> should be returned.
+ *
* @return markup id of the component
*/
- public String getMarkupId()
+
+ public String getMarkupId(boolean createIfDoesNotExist)
{
Object storedMarkupId = getMarkupIdImpl();
@@ -1408,6 +1414,11 @@
return (String)storedMarkupId;
}
+ if (storedMarkupId == null && createIfDoesNotExist == false)
+ {
+ return null;
+ }
+
final int generatedMarkupId = storedMarkupId instanceof Integer
? ((Integer)storedMarkupId).intValue() :
nextAutoIndex();
@@ -1437,6 +1448,24 @@
markupId = markupId.replace('-', '_');
return markupId;
+ }
+
+ /**
+ * Retrieves id by which this component is represented within the
markup. This is either the id
+ * attribute set explicitly via a call to [EMAIL PROTECTED]
#setMarkupId(String)}, id attribute defined in
+ * the markup, or an automatically generated id - in that order.
+ * <p>
+ * If no explicit id is set this function will generate an id value
that will be unique in the
+ * page. This is the preferred way as there is no chance of id
collision.
+ * <p>
+ * Note: This method should only be called after the component or its
parent have been added to
+ * the page.
+ *
+ * @return markup id of the component
+ */
+ public String getMarkupId()
+ {
+ return getMarkupId(true);
}
/**