Author: ivaynberg
Date: Thu Dec 7 14:57:51 2006
New Revision: 483717
URL: http://svn.apache.org/viewvc?view=rev&rev=483717
Log:
preserve markup id on component replacement
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Component.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/MarkupContainer.java
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Component.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Component.java?view=diff&rev=483717&r1=483716&r2=483717
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Component.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Component.java
Thu Dec 7 14:57:51 2006
@@ -925,6 +925,16 @@
return markupId;
}
+ final boolean hasMarkupIdMetaData()
+ {
+ return getMetaData(MARKUP_ID_KEY) != null;
+ }
+
+ final void setMarkupIdMetaData(String markupId)
+ {
+ setMetaData(MARKUP_ID_KEY, markupId);
+ }
+
/**
* Gets metadata for this component using the given key.
*
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/MarkupContainer.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/MarkupContainer.java?view=diff&rev=483717&r1=483716&r2=483717
==============================================================================
---
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/MarkupContainer.java
(original)
+++
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/MarkupContainer.java
Thu Dec 7 14:57:51 2006
@@ -267,7 +267,8 @@
// optimization.
if ((child == null) && isTransparentResolver() && (getParent()
!= null))
{
- // Special tags like "_body", "_panel" must implement
IComponentResolver
+ // Special tags like "_body", "_panel" must implement
+ // IComponentResolver
// if they want to be transparent.
if (path.startsWith("_") == false)
{
@@ -355,8 +356,11 @@
}
catch (RuntimeException ex)
{
- if(ex instanceof WicketRuntimeException) throw ex;
- else throw new WicketRuntimeException("Error attaching
this container for rendering: " + this,ex);
+ if (ex instanceof WicketRuntimeException)
+ throw ex;
+ else
+ throw new WicketRuntimeException("Error
attaching this container for rendering: "
+ + this, ex);
}
}
@@ -555,8 +559,7 @@
final ComponentTag associatedMarkupOpenTag =
associatedMarkupStream.getTag();
// Check for required open tag name
- if (!((associatedMarkupOpenTag != null) &&
associatedMarkupOpenTag.isOpen() &&
- (associatedMarkupOpenTag instanceof WicketTag)))
+ if (!((associatedMarkupOpenTag != null) &&
associatedMarkupOpenTag.isOpen() && (associatedMarkupOpenTag instanceof
WicketTag)))
{
associatedMarkupStream.throwMarkupException(exceptionMessage);
}
@@ -617,6 +620,10 @@
// The position of the associated markup remains the
same
child.markupIndex = replaced.markupIndex;
+
+ // The generated markup id remains the same
+ String replacedId = (replaced.hasMarkupIdMetaData()) ?
replaced.getMarkupId() : null;
+ child.setMarkupIdMetaData(replaced.getMarkupId());
}
return this;
@@ -889,7 +896,7 @@
return null;
}
-
+
/**
* Get the markup stream set on this container.
*