private final ArrayList dirtyPaintabletSet = new ArrayList();
- private final HashMap paintableIdMap = new HashMap();
+ private final HashMap<Paintable, String> paintableIdMap = new HashMap<Paintable, String>();
- private final HashMap idPaintableMap = new HashMap();
+ private final HashMap<String, Paintable> idPaintableMap = new HashMap<String, Paintable>();
private int idSequence = 0;
*/
public String getPaintableId(Paintable paintable) {
- String id = (String) paintableIdMap.get(paintable);
+ String id = paintableIdMap.get(paintable);
if (id == null) {
// use testing identifier as id if set
id = paintable.getDebugId();
private final static String UIDL_ARG_NAME = "name";
- private final Stack mOpenTags;
+ private final Stack<String> mOpenTags;
- private final Stack openJsonTags;
+ private final Stack<JsonTag> openJsonTags;
private final PrintWriter uidlBuffer;
private boolean cacheEnabled = false;
- private Collection paintedComponents = new HashSet();
+ private Collection<Paintable> paintedComponents = new HashSet<Paintable>();
+
+ private Collection<Paintable> identifiersCreatedDueRefPaint;
/**
* Creates a new XMLPrintWriter, without automatic line flushing.
uidlBuffer = outWriter;
// Initialize tag-writing
- mOpenTags = new Stack();
- openJsonTags = new Stack();
+ mOpenTags = new Stack<String>();
+ openJsonTags = new Stack<JsonTag>();
cacheEnabled = cachingRequired;
}
}
if (openJsonTags.size() > 0) {
- final JsonTag parent = (JsonTag) openJsonTags.pop();
+ final JsonTag parent = openJsonTags.pop();
String lastTag = "";
- lastTag = (String) mOpenTags.pop();
+ lastTag = mOpenTags.pop();
if (!tagName.equalsIgnoreCase(lastTag)) {
throw new PaintException("Invalid UIDL: wrong ending tag: '"
+ tagName + "' expected: '" + lastTag + "'.");
public boolean startTag(Paintable paintable, String tagName)
throws PaintException {
startTag(tagName, true);
- final boolean isPreviouslyPainted = manager.hasPaintableId(paintable);
+ final boolean isPreviouslyPainted = manager.hasPaintableId(paintable)
+ && (identifiersCreatedDueRefPaint == null || !identifiersCreatedDueRefPaint
+ .contains(paintable));
final String id = manager.getPaintableId(paintable);
paintable.addListener(manager);
addAttribute("id", id);
public void paintReference(Paintable paintable, String referenceName)
throws PaintException {
+ if (!manager.hasPaintableId(paintable)) {
+ if (identifiersCreatedDueRefPaint == null) {
+ identifiersCreatedDueRefPaint = new HashSet<Paintable>();
+ }
+ identifiersCreatedDueRefPaint.add(paintable);
+ }
final String id = manager.getPaintableId(paintable);
addAttribute(referenceName, id);
}
this.name = name;
}
+ @Override
public String getJsonPresentation() {
return "\"" + name + "\":" + (value == true ? "true" : "false");
}
this.name = name;
}
+ @Override
public String getJsonPresentation() {
return "\"" + name + "\":\"" + value + "\"";
}
this.name = name;
}
+ @Override
public String getJsonPresentation() {
return "\"" + name + "\":" + value;
}
this.name = name;
}
+ @Override
public String getJsonPresentation() {
return "\"" + name + "\":" + value;
}
this.name = name;
}
+ @Override
public String getJsonPresentation() {
return "\"" + name + "\":" + value;
}
this.name = name;
}
+ @Override
public String getJsonPresentation() {
return "\"" + name + "\":" + value;
}
this.name = name;
}
+ @Override
public String getJsonPresentation() {
String pres = "\"" + name + "\":[";
for (int i = 0; i < value.length;) {