public void execute() { if (this.nestedTask == null) { throw new BuildException("Missing nested element"); } if (this.name == null) { throw new BuildException("Name not specified"); } this.name = ProjectHelper.genComponentName(this.getURI(), this.name); final ComponentHelper helper = ComponentHelper.getComponentHelper(this.getProject()); final String componentName = ProjectHelper.genComponentName(this.nestedTask.getNamespace(), this.nestedTask.getTag()); final AntTypeDefinition def = helper.getDefinition(componentName); if (def == null) { throw new BuildException("Unable to find typedef " + componentName); } final PreSetDefinition newDef = new PreSetDefinition(def, this.nestedTask); newDef.setName(this.name); helper.addDataTypeDefinition(newDef); this.log("defining preset " + this.name, 3); }
/** * Creates a header with the specified appearance. * * @param appearance the appearance of the header */ public Header(HeaderAppearance appearance) { this.appearance = appearance; SafeHtmlBuilder sb = new SafeHtmlBuilder(); this.appearance.render(sb); setElement((Element) XDOM.create(sb.toSafeHtml())); addStyleName("x-small-editor"); widgetPanel = new HorizontalPanel(); widgetPanel.addStyleName("x-panel-toolbar"); XElement barElem = appearance.getBarElem(getElement()); barElem.appendChild(widgetPanel.getElement()); if (tools.size() > 0) { for (int i = 0; i < tools.size(); i++) { widgetPanel.add(tools.get(i)); } } else { widgetPanel.setVisible(false); } ComponentHelper.setParent(this, widgetPanel); appearance.getTextElem(getElement()).setId(getId() + "-label"); setText(text); if (icon != null) { setIcon(icon); } getFocusSupport().setIgnore(true); }
@Override protected void doDetachChildren() { super.doDetachChildren(); ComponentHelper.doDetach(widgetPanel); }