here is the current working mixin. It uses markup writer to set the button value because
submitLabel = defaultLabel; will result in the error public class BeanEditDefaults { @BindParameter private String reorder; @BindParameter private String submitLabel; @Inject private Environment environment; @Inject private ComponentResources resources; @Inject private Logger logger; private Element form; private String newLabel; @SetupRender @SuppressWarnings("unchecked") void setupRender(MarkupWriter writer) { String defaultLabel = resources.getContainerResources().getMessages().get("submit-label"); logger.info("default {}", defaultLabel); if (submitLabel != null && submitLabel.equals(defaultLabel)) { form = writer.element("mixin", "name", this.getClass().getName()); String type = resources.getContainerResources().getBoundType("object").getSimpleName(); newLabel = resources.getPage().getComponentResources().getMessages().format("submit-label", type); environment.peek(LayoutEnvironment.class).setTitle(newLabel); } Class beantype = resources.getContainerResources().getBoundType("object"); BeanEditEnviromentInterface enviromentType = (BeanEditEnviromentInterface) beantype.getAnnotation(BeanEditEnviromentInterface.class); if (enviromentType != null) { BeanEditEnvironment defaults = environment.peek(enviromentType.value()); if (defaults != null) { if (reorder == null) { reorder = defaults.getOrder(); } } } } @AfterRender void afterRender(MarkupWriter writer) { if (form != null) { writer.end(); form.visit(new Visitor() { public void visit(Element element) { if (element.getName().equals("input")) { String value = element.getAttribute("value"); String type = element.getAttribute("type"); if (type != null && type.equals("submit") && value != null && value.equals(submitLabel)) { element.forceAttributes("value", newLabel); } } } }); } } @CleanupRender void cleanupRender() { if (form != null) { form.pop(); } } } It's attached with a worker public class AddMixinWorker implements ComponentClassTransformWorker2 { public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model) { if ( match(BeanEditForm.class, plasticClass) ) { model.addMixinClassName(BeanEditDefaults.class.getName()); } } boolean match( Class clazz, PlasticClass plasticClass) { return clazz.getName().equals(plasticClass.getClassName()); } } -- View this message in context: http://tapestry.1045711.n5.nabble.com/Can-t-change-BeanEditForm-submitLabel-with-a-mixin-tp5716012p5716038.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org