Example usage for java.util Vector elements

List of usage examples for java.util Vector elements

Introduction

In this page you can find the example usage for java.util Vector elements.

Prototype

public Enumeration<E> elements() 

Source Link

Document

Returns an enumeration of the components of this vector.

Usage

From source file:org.opencms.flex.CmsFlexRequest.java

/**
 * Return the names of all defined request attributes for this request.<p>
 * /*from w  w w.  jav a  2s . c  om*/
 * @return the names of all defined request attributes for this request
 * 
 * @see javax.servlet.ServletRequest#getAttributeNames
 */
@Override
public Enumeration<String> getAttributeNames() {

    Vector<String> v = new Vector<String>();
    v.addAll(m_attributes.keySet());
    return v.elements();
}

From source file:org.opencms.flex.CmsFlexRequest.java

/**
 * Return the names of all defined request parameters for this request.<p>
 * //from   www .j av  a2  s .c o m
 * @return the names of all defined request parameters for this request
 * 
 * @see javax.servlet.ServletRequest#getParameterNames()
 */
@Override
public Enumeration<String> getParameterNames() {

    Vector<String> v = new Vector<String>();
    v.addAll(m_parameters.keySet());
    return (v.elements());
}

From source file:org.apereo.portal.layout.simple.SimpleLayout.java

@Override
public Enumeration getNodeIds() throws PortalException {
    Vector v = new Vector();
    try {/*  ww  w.jav  a  2  s.co  m*/
        String expression = "*";
        XPathFactory fac = XPathFactory.newInstance();
        XPath xpath = fac.newXPath();
        NodeList nl = (NodeList) xpath.evaluate(expression, layout, XPathConstants.NODESET);
        for (int i = 0; i < nl.getLength(); i++) {
            Node node = nl.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                Element e = (Element) node;
                v.add(e.getAttribute("ID"));
            }
        }
    } catch (Exception e) {
        log.error("Exception getting node ids.", e);
    }
    return v.elements();
}

From source file:com.verisign.epp.codec.gen.EPPUtil.java

/**
 * Encode a <code>Vector</code> of <code>EPPCodecComponent</code>'s in XML.
 * Each <code>aVector</code> element will be encoded and added to
 * <code>aRoot</code>.//from  w  w  w  .jav a2s.c  o m
 * 
 * @param aDocument
 *            DOM Document of <code>aRoot</code>. This parameter also acts
 *            as a factory for XML elements.
 * @param aRoot
 *            XML Element to add children nodes to. For example, the root
 *            node could be &ltdomain:update&gt
 * @param aVector
 *            <code>Vector</code> of <code>EPPCodecComponent's</code> to add.
 * @exception EPPEncodeException
 *                Error encoding the <code>Vector</code> of
 *                <code>EPPCodecComponent</code>'s.
 */
public static void encodeCompVector(Document aDocument, Element aRoot, Vector aVector)
        throws EPPEncodeException {
    if (aVector != null) {
        Enumeration elms = aVector.elements();

        while (elms.hasMoreElements()) {
            EPPCodecComponent currComp = (EPPCodecComponent) elms.nextElement();

            aRoot.appendChild(currComp.encode(aDocument));
        }

        // End while (elms.hasMoreElements())
    }
}

From source file:org.openflexo.foundation.ie.menu.FlexoItemMenu.java

/**
 * @param menuLabel/*  w  w w  . ja  va  2  s. c  om*/
 * @return
 */
public FlexoItemMenu getMenuLabeled(String menuLabel) {
    if (this.getMenuLabel() != null && this.getMenuLabel().equals(menuLabel)) {
        return this;
    }
    Vector<FlexoItemMenu> v = getSubItems();
    Enumeration<FlexoItemMenu> en = v.elements();
    while (en.hasMoreElements()) {
        FlexoItemMenu menu = en.nextElement();
        FlexoItemMenu ret = menu.getMenuLabeled(menuLabel);
        if (ret != null) {
            return ret;
        }
    }
    return null;
}

From source file:org.hdiv.filter.RequestWrapper.java

/**
 * Returns all the values of the specified request header as an Enumeration of String objects.
 * //  w ww  . jav a2 s  .c om
 * @param name
 *            a String specifying the header name
 * @return an Enumeration containing the values of the requested header. If the request does not have any headers of
 *         that name return an empty enumeration. If the container does not allow access to header information,
 *         return null.
 * @since HDIV 1.1.1
 */
public Enumeration getHeaders(String name) {

    Enumeration headerValues = super.getHeaders(name);

    if (name.equalsIgnoreCase(COOKIE) && Boolean.TRUE.equals(this.confidentiality)
            && this.cookiesConfidentiality) {

        Vector values = new Vector();
        Hashtable sessionCookies = (Hashtable) super.getSession().getAttribute(Constants.HDIV_COOKIES_KEY);

        if (sessionCookies != null) {
            while (headerValues.hasMoreElements()) {
                String element = (String) headerValues.nextElement();
                String replaced = this.replaceCookieString(element, sessionCookies);
                values.add(replaced);
            }
        }
        return values.elements();
    }
    return headerValues;
}

From source file:com.fiorano.openesb.application.aps.ApplicationContext.java

/**
 * Gets the extNames of Structures of ApplicationContext object
 *
 * @return The extNamespaces value//from  w  w w  .  ja  v  a2s .  c  om
 */
public Enumeration getExternalStructureNames() {
    Vector v = new Vector();
    int length = "External_".length();

    int size = m_params.size();

    for (int i = 0; i < size; i++) {
        Param param = (Param) m_params.get(i);

        if (param.getParamName().startsWith("External_")) {
            v.add(param.getParamName().substring(length));
        }
    }

    return v.elements();
}

From source file:org.apache.jk.server.JkMain.java

private void preProcessProperties() {
    Enumeration keys = props.keys();
    Vector v = new Vector();

    while (keys.hasMoreElements()) {
        String key = (String) keys.nextElement();
        Object newName = replacements.get(key);
        if (newName != null) {
            v.addElement(key);//w  ww . j  a va  2  s  .com
        }
    }
    keys = v.elements();
    while (keys.hasMoreElements()) {
        String key = (String) keys.nextElement();
        Object propValue = props.getProperty(key);
        String replacement = (String) replacements.get(key);
        props.put(replacement, propValue);
        if (log.isDebugEnabled())
            log.debug("Substituting " + key + " " + replacement + " " + propValue);
    }
}

From source file:at.ac.tuwien.ibk.biqini.pep.gui.PEPGUI.java

public PEPGUI(String arg0, Vector<IBandwidthTracer> qosRules) {
    super(arg0);/*from w w w .j a va 2  s .co  m*/

    // initiate all collections
    tsc = new TimeSeriesCollection[MAXCHARTS];
    charts = new JFreeChart[MAXCHARTS];
    positions = new Vector<Integer>();
    chartPosition = new Hashtable<String, Integer>();
    for (int i = 0; i < MAXCHARTS; i++)
        positions.add(i);
    allSessions = new Hashtable<String, IBandwidthTracer>();

    // fill the BandwidthGenerator with the ongoing QoSRules
    bandwidthGenerator = new BandwidthGenerator();
    Enumeration<IBandwidthTracer> enbandwidth = qosRules.elements();
    while (enbandwidth.hasMoreElements()) {
        IBandwidthTracer b = enbandwidth.nextElement();
        allSessions.put(b.getName(), b);
        bandwidthGenerator.add(b);
    }

    gridBagLayout = new GridBagLayout();

    //insert the list with all QoS rules
    GridBagConstraints c = new GridBagConstraints();
    c.weighty = 9;
    c.weightx = 2.0;
    c.gridheight = MAXCHARTS;
    c.fill = GridBagConstraints.BOTH;
    content = new JPanel(gridBagLayout);
    qoSRuleList = new JList(allSessions.keySet().toArray());
    qoSRuleList.setPreferredSize(new java.awt.Dimension(200, 600));
    qoSRuleList.setBorder(BorderFactory.createRaisedBevelBorder());

    // set a MouseListner on the List
    MouseListener mouseListener = new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {

            if (e.getButton() == MouseEvent.BUTTON1) {
                int index = qoSRuleList.locationToIndex(e.getPoint());
                addStream(allSessions.get(allSessions.keySet().toArray()[index]));
            }
            if (e.getButton() == MouseEvent.BUTTON3) {
                int index = qoSRuleList.locationToIndex(e.getPoint());
                removeStream(allSessions.get(allSessions.keySet().toArray()[index]));
            }
        }
    };
    qoSRuleList.addMouseListener(mouseListener);

    // place all parts at the content pane
    gridBagLayout.setConstraints(qoSRuleList, c);
    content.add(qoSRuleList);
    setContentPane(content);
    content.setSize(1000, 800);

    //create all GUI aspects for our Charts
    insertAllCharts();

    //Start the thread that fills up our time series
    periodicBandwidthReader = new Thread(bandwidthGenerator);
    periodicBandwidthReader.setName("data-collector");
    periodicBandwidthReader.start();
}

From source file:com.verisign.epp.codec.gen.EPPUtil.java

/**
 * Encode a <code>Vector</code> of <code>String</code>'s in XML with a given
 * XML namespace and tag name.//  www. j a va2s  . c  o m
 * 
 * @param aDocument
 *            DOM Document of <code>aRoot</code>. This parameter also acts
 *            as a factory for XML elements.
 * @param aRoot
 *            XML Element to add children nodes to. For example, the root
 *            node could be &ltdomain:update&gt
 * @param aVector
 *            <code>Vector</code> of <code>String's</code> to add.
 * @param aNS
 *            XML namespace of the elements. For example, for domain element
 *            this is "urn:iana:xmlns:domain".
 * @param aTagName
 *            Tag name of the element including an optional namespace
 *            prefix. For example, the tag name for the domain name servers
 *            is "domain:server".
 * @exception EPPEncodeException
 *                Error encoding the <code>Vector</code> of
 *                <code>String</code>'s.
 */
public static void encodeVector(Document aDocument, Element aRoot, Vector aVector, String aNS, String aTagName)
        throws EPPEncodeException {
    Element currElm;
    Text currVal;

    if (aVector != null) {
        Enumeration elms = aVector.elements();

        while (elms.hasMoreElements()) {
            currElm = aDocument.createElementNS(aNS, aTagName);
            currVal = aDocument.createTextNode(elms.nextElement().toString());

            currElm.appendChild(currVal);
            aRoot.appendChild(currElm);
        }

        // end while (elms.hasMoreElements())
    }

    // end if (aVector != null)
}