You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by eh...@apache.org on 2007/06/25 00:01:19 UTC
svn commit: r550295 -
/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java
Author: ehillenius
Date: Sun Jun 24 15:01:18 2007
New Revision: 550295
URL: http://svn.apache.org/viewvc?view=rev&rev=550295
Log:
WICKET-694
Modified:
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java
Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java?view=diff&rev=550295&r1=550294&r2=550295
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java Sun Jun 24 15:01:18 2007
@@ -1181,10 +1181,13 @@
/**
* Retrieves id by which this component is represented within the markup.
+ * This is either the id attribute if it is set explicitly in the markup, or
+ * a generated id.
* <p>
* The point of this function is to generate a unique id to make it easy to
* locate this component in the generated markup for post-wicket processing
- * such as javascript or an xslt transform.
+ * such as javascript or an xslt transform in case no explicit id was set
+ * yet.
* <p>
* Note: This method should only be called after the component or its parent
* have been added to the page.
@@ -1204,7 +1207,13 @@
+ "to find the page it is supposed to operate in before you can call "
+ "this method (Component#getMarkupId)");
}
- markupId = getId() + page.getAutoIndex();
+ // try to read from markup
+ markupId = getMarkupAttributes().getString("id");
+ if (markupId == null)
+ {
+ // if not in the markup, generate one
+ markupId = getId() + page.getAutoIndex();
+ }
setMetaData(MARKUP_ID_KEY, markupId);
}
return markupId;