Package org.apache.cocoon.xml

Examples of org.apache.cocoon.xml.AttributesImpl


            this.label = label;
        }

        public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException
        {
            AttributesImpl itemAttrs = new AttributesImpl();
            itemAttrs.addCDATAAttribute("value", datatype.convertToString(value));
            contentHandler.startElement(Constants.WI_NS, ITEM_EL, Constants.WI_PREFIX_COLON + ITEM_EL, itemAttrs);
            contentHandler.startElement(Constants.WI_NS, LABEL_EL, Constants.WI_PREFIX_COLON + LABEL_EL, Constants.EMPTY_ATTRS);
            if (label != null) {
                interpreter.recycle();
                interpreter.setContentHandler(contentHandler);
View Full Code Here


                        Layout layout,
                        PortalService service,
                        ContentHandler handler)
    throws SAXException {
        if (layout instanceof CompositeLayout) {
            AttributesImpl attributes = new AttributesImpl();
            Map parameter = layout.getParameters();
            for (Iterator iter = parameter.values().iterator(); iter.hasNext();) {
                Parameter param = (Parameter) iter.next();
                attributes.addCDATAAttribute(param.getName(), param.getValue());
            }
            XMLUtils.startElement(handler, this.getTagName(context), attributes);

            PortalService portalService = null;
            try {
                portalService = (PortalService) this.manager.lookup(PortalService.ROLE);
                attributes = new AttributesImpl();
                CompositeLayout tabLayout = (CompositeLayout) layout;

                // selected tab
                Integer data = (Integer) layout.getAspectData("tab");
                int selected = data.intValue();
               
                // loop over all tabs
                for (int j = 0; j < tabLayout.getSize(); j++) {
                    NamedItem tab = (NamedItem) tabLayout.getItem(j);

                    // open named-item tag
                    attributes.clear();
                    attributes.addCDATAAttribute("name", String.valueOf(tab.getName()));
                    if (j == selected) {
                        attributes.addCDATAAttribute("selected", "true");
                    } else {
                        LayoutAspectDataEvent event = new LayoutAspectDataEvent(tabLayout, "tab", new Integer(j));
                        attributes.addCDATAAttribute("parameter", portalService.getLinkService().getLinkURI(event));
                    }
                    XMLUtils.startElement(handler, "named-item", attributes);
                    if (j == selected) {
                        this.processLayout(tab.getLayout(), service, handler);
                    }
View Full Code Here

                        Layout layout,
                        PortalService service,
                        ContentHandler handler)
    throws SAXException {

        AttributesImpl attributes = new AttributesImpl();
        Map parameter = layout.getParameters();
        for (Iterator iter = parameter.values().iterator(); iter.hasNext();) {
            Parameter param = (Parameter) iter.next();
            attributes.addCDATAAttribute(param.getName(), param.getValue());
        }
        XMLUtils.startElement(handler, this.getTagName(context), attributes);
        super.toSAX(context, layout, service, handler);
        XMLUtils.endElement(handler, this.getTagName(context));
View Full Code Here

        Map parameters = item.getParameters();
        if (parameters.size() == 0) {
            XMLUtils.startElement(handler, ITEM_STRING);
        } else {
            AttributesImpl attributes = new AttributesImpl();

            for (Iterator iter = parameters.values().iterator(); iter.hasNext();) {
                Parameter param = (Parameter) iter.next();
                attributes.addCDATAAttribute(param.getName(), param.getValue());
            }
            XMLUtils.startElement(handler, ITEM_STRING, attributes);
        }
        processLayout(layout, service, handler);
        XMLUtils.endElement(handler, ITEM_STRING);
View Full Code Here

                        Layout layout,
                        PortalService service,
                        ContentHandler contenthandler)
    throws SAXException {
        final CopletInstanceData copletInstanceData = ((CopletLayout)layout).getCopletInstanceData();
        AttributesImpl attributes = new AttributesImpl();
        Map parameter = layout.getParameters();
        for (Iterator iter = parameter.values().iterator(); iter.hasNext();) {
            Parameter param = (Parameter) iter.next();
            attributes.addCDATAAttribute(param.getName(), param.getValue());
        }
        XMLUtils.startElement(contenthandler, this.getTagName(context), attributes);
        int status = copletInstanceData.getStatus();
        XMLUtils.createElement(contenthandler, "title", copletInstanceData.getCopletData().getTitle());
        XMLUtils.createElement(contenthandler, "status", "" + status);
View Full Code Here

    public static final String VALUE_ATTRIBUTE = "value";

    public void generate() throws IOException, SAXException,
            ProcessingException {
        this.contentHandler.startDocument();
        AttributesImpl attr = new AttributesImpl();
        attr.addAttribute("", MODULE_PARAM, MODULE_PARAM, "CDATA", module);
        this.contentHandler.startPrefixMapping(NS_PREFIX, PROP_NS);
        this.contentHandler.startElement(PROP_NS, ROOT_ELEMENT, ROOT_ELEMENT,
                attr);
        if (!(iterator == null)) {
            createProperty(attr);
View Full Code Here

    throws SAXException {
        try {
            contentHandler.startElement(FormsConstants.INSTANCE_NS, SELECTION_LIST_EL, FormsConstants.INSTANCE_PREFIX_COLON + SELECTION_LIST_EL, XMLUtils.EMPTY_ATTRIBUTES);
            // Create void element
            if (nullable) {
                AttributesImpl voidAttrs = new AttributesImpl();
                voidAttrs.addCDATAAttribute("value", "");
                contentHandler.startElement(FormsConstants.INSTANCE_NS, ITEM_EL, FormsConstants.INSTANCE_PREFIX_COLON + ITEM_EL, voidAttrs);
                if (this.nullText != null) {
                    contentHandler.startElement(FormsConstants.INSTANCE_NS, LABEL_EL, FormsConstants.INSTANCE_PREFIX_COLON + LABEL_EL, XMLUtils.EMPTY_ATTRIBUTES);
                    contentHandler.startElement(FormsConstants.I18N_NS, TEXT_EL, FormsConstants.I18N_PREFIX_COLON + TEXT_EL, XMLUtils.EMPTY_ATTRIBUTES);
                    contentHandler.characters(nullText.toCharArray(), 0, nullText.length());
View Full Code Here

     * @param stringValue The string name of the item, composed by FQN and enum item.
     * @throws SAXException
     */
    private void generateItem(ContentHandler contentHandler, String stringValue) throws SAXException {
        // Output this item
        AttributesImpl itemAttrs = new AttributesImpl();
        itemAttrs.addCDATAAttribute("value", stringValue);
        contentHandler.startElement(FormsConstants.INSTANCE_NS, ITEM_EL, FormsConstants.INSTANCE_PREFIX_COLON + ITEM_EL, itemAttrs);
        contentHandler.startElement(FormsConstants.INSTANCE_NS, LABEL_EL, FormsConstants.INSTANCE_PREFIX_COLON + LABEL_EL, XMLUtils.EMPTY_ATTRIBUTES);
        // TODO: make i18n element optional
        contentHandler.startElement(FormsConstants.I18N_NS, TEXT_EL, FormsConstants.I18N_PREFIX_COLON + TEXT_EL, XMLUtils.EMPTY_ATTRIBUTES);
        contentHandler.characters(stringValue.toCharArray(), 0, stringValue.length());
View Full Code Here

        Map objectModel = ContextHelper.getObjectModel(this.avalonContext);
        HttpSession session = ObjectModelHelper.getRequest(objectModel).getSession(true);
        String secret = generateSecret();
        session.setAttribute(SESSION_ATTR_PREFIX + id, secret);
        this.setAttribute("secret", secret);
        AttributesImpl attrs = new AttributesImpl();
        attrs.addAttribute("", "id", "id", "PCDATA", id);
        contentHandler.startElement(FormsConstants.INSTANCE_NS, IMAGE_EL, FormsConstants.INSTANCE_PREFIX_COLON + IMAGE_EL, attrs);
        contentHandler.endElement(FormsConstants.INSTANCE_NS, IMAGE_EL, FormsConstants.INSTANCE_PREFIX_COLON + IMAGE_EL);
    }
View Full Code Here

    private static final String HEADING_EL = "heading";
    private static final String LABEL_EL = "label";
    private static final String REPEATER_SIZE_EL = "repeater-size";

    public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException {
        AttributesImpl repeaterAttrs = new AttributesImpl();
        repeaterAttrs.addCDATAAttribute("id", getFullyQualifiedId());
        repeaterAttrs.addCDATAAttribute("size", String.valueOf(getSize()));
        contentHandler.startElement(Constants.WI_NS, REPEATER_EL, Constants.WI_PREFIX_COLON + REPEATER_EL, repeaterAttrs);

        // the repeater's label
        contentHandler.startElement(Constants.WI_NS, LABEL_EL, Constants.WI_PREFIX_COLON + LABEL_EL, Constants.EMPTY_ATTRS);
        definition.generateLabel(contentHandler);
View Full Code Here

TOP

Related Classes of org.apache.cocoon.xml.AttributesImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.