Example usage for java.util Vector Vector

List of usage examples for java.util Vector Vector

Introduction

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

Prototype

public Vector() 

Source Link

Document

Constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero.

Usage

From source file:CreatingTreeModel.java

public FileSystemModel() {

    root = System.getProperty("user.home");
    File tempFile = new File(root);
    root = tempFile.getParent();/*w ww  . j  a v  a 2 s  . c  o  m*/

    listeners = new Vector();
}

From source file:controller.FeedbackControllerManager.java

@RequestMapping(method = RequestMethod.GET)
public String feedbackManager(ModelMap mm) {
    Vector data = new Vector();
    Vector column = new Vector();
    List<Feedback> list = feedModel.getAll();
    column.add("Feedback ID");
    column.add("Customer");
    column.add("Title");
    column.add("Content");
    column.add("Feedback Date");
    column.add("Reply");
    column.add("Status");
    for (Feedback feed : list) {
        Vector tmp = new Vector();
        tmp.add(feed.getFeedId());/*from  w w w .j a v  a  2s  .  co m*/
        tmp.add(feed.getCustomer().getCusName());
        tmp.add("id://" + feed.getFeedId());
        tmp.add(feed.getFeedTitle());
        tmp.add(feed.getFeedContent());
        tmp.add(feed.getFeedDate());
        tmp.add(feed.getFeedReply());

        tmp.add(feed.getStatus() == 1 ? "Replied" : "Non-reply");
        data.add(tmp);
    }
    mm.put("column", column);
    mm.put("data", data);
    mm.put("title", "Feedback Manager");
    return "feedbackManager";
}

From source file:de.awisus.refugeeaidleipzig.models.Kategorie.java

private Kategorie() {
    this.subkategorien = new Vector<>();
}

From source file:net.firstpartners.nounit.utility.XmlUtil.java

/**
 * indexes the nodes in the document that is passed in , via a HashMap mapping
 * mapping is in the format <index> as String , handle to <element> of node<BR>
 * Strings are used as they are better lookup in the hashmap.
 * @param inXmlDocument to generated the hashmap from
 * @param uniqueAttribute to do the index on (i.e. key in HashMap). Examples
 *        of uniqueAttributes are id's or names.
 * @return HashMap containing mappings/*w w  w.ja v a  2  s .c o m*/
 */
public static HashMap getNodeIndex(Document inXmlDocument, String uniqueAttribute) {

    //Internal Variables
    int stackPointer = 0;
    String locationId = null;
    Attribute tmpAttribute = null;
    Element thisElement = null;
    ListIterator deepestList = null;

    HashMap mappings = new HashMap();
    List stack = new Vector();

    //Get the list information for the entire document
    stack.add(inXmlDocument.getContent().listIterator());

    //Loop though the elements on list
    while (!stack.isEmpty()) {

        //Get the last list on the stack
        deepestList = (ListIterator) stack.get(stack.size() - 1);

        //Does this list have more elements?
        if (deepestList.hasNext()) {

            //if so Get Next element from this list
            thisElement = (Element) deepestList.next();

            //Add Mapping for this element to hashtable
            tmpAttribute = thisElement.getAttribute(uniqueAttribute);

            //Attibute can be null for non folder elements (e.g. root element) - if so ignore
            if (tmpAttribute != null) {
                locationId = tmpAttribute.getValue();
                if ((locationId != null) && (locationId != "")) {
                    mappings.put(locationId.toString(), thisElement);

                }
            } //end add mapping

            //does this list have children ?
            if (thisElement.hasChildren()) {

                //if so add to the stack
                stackPointer++;
                stack.add(thisElement.getChildren().listIterator());
            }
        } else {
            //if not , remove this list from the stack
            stack.remove(stackPointer);
            stackPointer--;

        } // end if stack has more elements

    }

    return mappings;
}

From source file:controller.FAQManagerController.java

private void initData(ModelMap mm) {
    Vector data = new Vector();
    Vector column = new Vector();
    List<Faq> list = faqModel.getAll();
    if (list.size() == 0) {
        Faq f = new Faq("Auto Generate", "Auto Generate", Byte.valueOf("0"));
        faqModel.addOrUpdate(f);//from  w  w w  . j  ava2 s.  co  m
        list.add(f);
    }

    column.add("ID");
    column.add("Question");
    column.add("Answer");
    column.add("Status");
    for (Faq f : list) {
        Vector tmp = new Vector();
        tmp.add(f.getFaqId());
        tmp.add(f.getFaqQestion());
        tmp.add(f.getFaqAnswer());
        tmp.add(f.getStatus() == 1 ? "Active" : "Non-Active");
        tmp.add("id://" + f.getFaqId());
        data.add(tmp);
    }
    mm.put("column", column);
    mm.put("data", data);

}

From source file:net.sourceforge.jwbf.actions.mw.util.MWAction.java

/**
 * 
 * 
 */
public MWAction() {
    msgs = new Vector<HttpMethod>();

}

From source file:com.adito.agent.client.ProxyUtil.java

/**
 * Attempt to proxy settings from Firefox.
 * //from   w ww .ja v a2 s  .co m
 * @return firefox proxy settings
 * @throws IOException if firefox settings could not be obtained for some
 *         reason
 */
public static BrowserProxySettings lookupFirefoxProxySettings() throws IOException {

    try {

        Vector proxies = new Vector();
        Vector bypassAddr = new Vector();

        File home = new File(Utils.getHomeDirectory());
        File firefoxAppData;

        if (System.getProperty("os.name") != null && System.getProperty("os.name").startsWith("Windows")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            firefoxAppData = new File(home, "Application Data\\Mozilla\\Firefox\\profiles.ini"); //$NON-NLS-1$
        } else {
            firefoxAppData = new File(home, ".mozilla/firefox/profiles.ini"); //$NON-NLS-1$
        }

        // Look for Path elements in the profiles.ini
        BufferedReader reader = null;
        Hashtable profiles = new Hashtable();
        String line;
        try {
            reader = new BufferedReader(new InputStreamReader(new FileInputStream(firefoxAppData)));
            String currentProfileName = ""; //$NON-NLS-1$

            while ((line = reader.readLine()) != null) {
                line = line.trim();
                if (line.startsWith("[") && line.endsWith("]")) { //$NON-NLS-1$ //$NON-NLS-2$
                    currentProfileName = line.substring(1, line.length() - 1);
                    continue;
                }

                if (line.startsWith("Path=")) { //$NON-NLS-1$
                    profiles.put(currentProfileName, new File(firefoxAppData.getParent(), line.substring(5)));
                }
            }
        } finally {
            if (reader != null) {
                reader.close();
            }
        }

        // Iterate through all the profiles and load the proxy infos from
        // the prefs.js file

        File prefsJS;
        String profileName;
        for (Enumeration e = profiles.keys(); e.hasMoreElements();) {
            profileName = (String) e.nextElement();
            prefsJS = new File((File) profiles.get(profileName), "prefs.js"); //$NON-NLS-1$
            Properties props = new Properties();
            reader = null;
            try {
                if (!prefsJS.exists()) {
                    // needed to defend against un-initialised profiles.
                    // #ifdef DEBUG
                    log.info("The file " + prefsJS.getAbsolutePath() + " does not exist."); //$NON-NLS-1$
                    // #endif
                    // now remove it from the map.
                    profiles.remove(profileName);
                    continue;
                }
                reader = new BufferedReader(new InputStreamReader(new FileInputStream(prefsJS)));
                while ((line = reader.readLine()) != null) {
                    line = line.trim();
                    if (line.startsWith("user_pref(\"")) { //$NON-NLS-1$
                        int idx = line.indexOf("\"", 11); //$NON-NLS-1$
                        if (idx == -1)
                            continue;
                        String pref = line.substring(11, idx);

                        // Save this position
                        int pos = idx + 1;

                        // Look for another quote
                        idx = line.indexOf("\"", idx + 1); //$NON-NLS-1$

                        String value;
                        if (idx == -1) {
                            // No more quotes
                            idx = line.indexOf(" ", pos); //$NON-NLS-1$

                            if (idx == -1)
                                continue;

                            int idx2 = line.indexOf(")", pos); //$NON-NLS-1$

                            if (idx2 == -1)
                                continue;

                            value = line.substring(idx + 1, idx2);

                        } else {

                            // String value
                            int idx2 = line.indexOf("\"", idx + 1); //$NON-NLS-1$

                            if (idx2 == -1)
                                continue;

                            value = line.substring(idx + 1, idx2);
                        }

                        props.put(pref, value);

                    }
                }
            } finally {
                if (reader != null) {
                    reader.close();
                }
            }
            ProxyInfo p;
            /**
             * Extract some proxies from the properites, if the proxy is
             * enabled
             */
            if ("1".equals(props.get("network.proxy.type"))) { //$NON-NLS-1$ //$NON-NLS-2$
                boolean isProfileActive = checkProfileActive(prefsJS);
                if (props.containsKey("network.proxy.ftp")) { //$NON-NLS-1$
                    p = createProxyInfo(
                            "ftp=" + props.get("network.proxy.ftp") + ":" + props.get("network.proxy.ftp_port"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                            "Firefox Profile [" + profileName + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                    p.setActiveProfile(isProfileActive);
                    proxies.addElement(p);
                }

                if (props.containsKey("network.proxy.http")) { //$NON-NLS-1$
                    p = createProxyInfo(
                            "http=" + props.get("network.proxy.http") + ":" //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
                                    + props.get("network.proxy.http_port"), //$NON-NLS-1$
                            "Firefox Profile [" + profileName + "]"); //$NON-NLS-1$ //$NON-NLS-2$
                    p.setActiveProfile(isProfileActive);
                    proxies.addElement(p);
                }

                if (props.containsKey("network.proxy.ssl")) { //$NON-NLS-1$
                    p = createProxyInfo(
                            "ssl=" + props.get("network.proxy.ssl") + ":" + props.get("network.proxy.ssl_port"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                            "Firefox Profile [" + profileName + "]"); //$NON-NLS-1$ //$NON-NLS-2$
                    p.setActiveProfile(isProfileActive);
                    proxies.addElement(p);
                }

                if (props.containsKey("network.proxy.socks")) { //$NON-NLS-1$
                    p = createProxyInfo("socks=" + props.get("network.proxy.socks") + ":" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                            + props.get("network.proxy.socks_port"), "Firefox Profile [" + profileName + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                    p.setActiveProfile(isProfileActive);
                    proxies.addElement(p);
                }

                if (props.containsKey("network.proxy.no_proxies_on")) { //$NON-NLS-1$

                    StringTokenizer tokens = new StringTokenizer(
                            props.getProperty("network.proxy.no_proxies_on"), ","); //$NON-NLS-1$ //$NON-NLS-2$

                    while (tokens.hasMoreTokens()) {
                        bypassAddr.addElement(((String) tokens.nextToken()).trim());
                    }

                }
            }
        }

        // need to ensure that the returned values are sorted correctly...
        BrowserProxySettings bps = new BrowserProxySettings();
        bps.setBrowser("Mozilla Firefox"); //$NON-NLS-1$
        bps.setProxiesActiveFirst(proxies);
        bps.setBypassAddr(new String[bypassAddr.size()]);
        bypassAddr.copyInto(bps.getBypassAddr());
        return bps;

    } catch (Throwable t) {
        throw new IOException("Failed to get proxy information from Firefox profiles: " + t.getMessage()); //$NON-NLS-1$
    }
}

From source file:com.iucosoft.eavertizare.gui.models.FirmaTableModel.java

public void refreshModel() {
    clearModel();/*  ww  w  .j  ava2s . c  om*/
    List<Firma> listaFirme = firmaDao.findAll();
    List<Client> listaClienti;
    SimpleDateFormat sdf = new SimpleDateFormat("dd/M/yyyy");
    int nr = 1;

    //   rowAllClients();
    for (Firma firma : listaFirme) {

        Vector rowData = new Vector();
        rowData.addElement(nr++);
        rowData.addElement(firma.getNumeFirma());
        rowData.addElement(firma.getAdresaFirma());
        rowData.addElement(firma.getDescriereFirma());
        rowData.addElement(firma.getMesajPentruClienti());
        super.addRow(rowData);
    }
}

From source file:controller.ChanelManagerController.java

private void initData(ModelMap mm) {
    Vector data = new Vector();
    Vector column = new Vector();
    List<Chanel> list = chanelModel.getAll();
    column.add("ID");
    column.add("Chanel Name");
    column.add("Chanel Price");
    column.add("Content");

    for (Chanel cl : list) {
        Vector tmp = new Vector();
        tmp.add(cl.getChanelId());//from   ww w.ja  v  a2 s  .  c o m
        tmp.add(cl.getChanelName());
        tmp.add(MyUtils.getCurrencyFormat().format(cl.getChanelPrice()));
        tmp.add(cl.getChanelContent());
        tmp.add("id://" + cl.getChanelId());
        data.add(tmp);
    }
    mm.put("column", column);
    mm.put("data", data);
}

From source file:com.epam.dlab.mongo.ResourceItemList.java

/** Constructs an empty list of resources.
  */
public ResourceItemList() {
    list = new Vector<>();
}