@AfterRender public void afterRender(MarkupWriter writer) { String id; if (elementName == null) { elementName = resources.getElementName(); if (elementName == null) { elementName = "ul"; } } if (draggableName == null) { draggableName = "div"; if (elementName.equals("ul")) { draggableName = "li"; } } Object compoment = resources.getContainer(); if (ClientElement.class.isAssignableFrom(compoment.getClass())) { id = ((ClientElement) compoment).getClientId(); } else { id = javaScriptSupport.allocateClientId(resources); } if (Grid.class.isAssignableFrom(compoment.getClass())) { elementName = "tbody"; draggableName = "tr"; } element = writer.getElement(); element.visit( new Visitor() { public void visit(Element e) { if (e.getName().equals(elementName)) { element = e; } if (e.getName().equals("tr")) { String c = e.getAttribute("class"); if (c != null) { e.forceAttributes("id", c.split(" ")[0]); } } } }); String currentID = element.getAttribute("id"); if (currentID != null) { id = currentID; } else { element.forceAttributes("id", id); } // element.addClassName("sortable"); // logger.info("spec {}",spec); if (!spec.has("selector")) { spec.put("selector", String.format("#%s %s", id, draggableName)); } if (!spec.has("context")) { ArrayEventContext aec = new ArrayEventContext(typeCoercer, defaulted(context)); spec.put("context", String.format("/%s", contextPathEncoder.encodeIntoPath(aec))); } javaScriptSupport.addInitializerCall("jqDraggable", spec); }
private void addErrorClassToCurrentElement() { markupWriter.getElement().addClassName(CSSClassConstants.ERROR); }
@BeginRender public void beginRender(MarkupWriter writer) { writer.getElement().addClassName("uppydowner"); }