Example usage for java.util Vector add

List of usage examples for java.util Vector add

Introduction

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

Prototype

public synchronized boolean add(E e) 

Source Link

Document

Appends the specified element to the end of this Vector.

Usage

From source file:BeanPropertyTableModel.java

public void refresh() throws RuntimeException {
    final Vector<Object> columnNames = new Vector<Object>();
    columnNames.add(_nameColumnName);
    columnNames.add(_valueColumnName);//w w w.  j ava2 s  .  co  m
    final Vector<Object> columnData = new Vector<Object>();
    if (_bean != null) {
        try {
            BeanInfo info = Introspector.getBeanInfo(_bean.getClass(), Introspector.USE_ALL_BEANINFO);
            processBeanInfo(info, columnData);
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }

    // Sort the rows by the property name.
    Collections.sort(columnData, new DataSorter());

    setDataVector(columnData, columnNames);
}

From source file:gda.device.scannable.ScannableUtils.java

/**
 * @param Detector//from  w ww  . j  a v a2s .  c  om
 * @return list of names ( channel names in case of CounterTimer ) from the provided list of Detector
 */
public static List<String> getDetectorFieldNames(List<Detector> Detector) {
    Vector<String> fieldNames = new Vector<String>();
    for (Detector d : Detector) {
        if (d.getExtraNames().length > 0) {
            for (int j = 0; j < d.getExtraNames().length; j++) {
                fieldNames.add(d.getExtraNames()[j]);
            }
        } else {
            fieldNames.add(d.getName());
        }
    }
    return fieldNames;
}

From source file:controller.PackageManagerController.java

private void initData(ModelMap mm) {
    Vector data = new Vector();
    Vector column = new Vector();
    List<Packages> list = packageModel.getAll();
    column.add("ID");
    column.add("Name");
    column.add("Content");
    column.add("Price");
    column.add("Status");
    column.add("Type");
    for (Packages pack : list) {
        Vector tmp = new Vector();
        tmp.add(pack.getPackageId());//from w  ww  .  j  a  v a2s .  com
        tmp.add(pack.getPackageName());
        tmp.add(pack.getPackageContent());
        tmp.add(MyUtils.getCurrencyFormat().format(pack.getPackagePrice()));
        tmp.add(pack.getStatus() == 1 ? "Active" : "Non-Active");
        tmp.add(pack.getType());
        tmp.add("id://" + pack.getPackageId());
        data.add(tmp);
    }
    mm.put("column", column);
    mm.put("data", data);
}

From source file:de.mpg.mpdl.inge.transformation.Util.java

/**
 * Merges a Vector of Format[] into Format[].
 * //from  w  w  w.j  a va 2s  .c om
 * @param allFormatsV as Format[] Vector
 * @return Format[]
 */
public static Format[] mergeFormats(Vector<Format[]> allFormatsV) {
    Vector<Format> tmpV = new Vector<Format>();
    Format[] tmpA;

    for (int i = 0; i < allFormatsV.size(); i++) {
        tmpA = allFormatsV.get(i);
        if (tmpA != null) {
            for (int x = 0; x < tmpA.length; x++) {
                tmpV.add(tmpA[x]);
                // System.out.println(tmpA[x].getName());
            }
        }
    }
    tmpV = getRidOfDuplicatesInVector(tmpV);
    return formatVectorToFormatArray(tmpV);
}

From source file:marytts.util.string.StringUtils.java

/**
 * @deprecated Unstable due to platform-specific behavior. Use {@link org.apache.commons.lang.StringUtils#split}
 *             or similar instead.//from w ww .  j  a  v a2s .c o m
 */
@Deprecated
public static String[] toStringArray(String allInOneLine) {
    if (allInOneLine != "") {
        Vector<String> result = new Vector<String>();

        StringTokenizer s = new StringTokenizer(allInOneLine, System.getProperty("line.separator"));
        String line = null;
        // Read until either end of file or an empty line
        while (s.hasMoreTokens() && ((line = s.nextToken()) != null) && (!line.equals("")))
            result.add(line);

        return result.toArray(new String[0]);
    } else
        return null;
}

From source file:aplicacion.herramientas.conexion.ftp.test.JakartaFtpWrapper.java

public Vector getFiles() throws IOException, FTPConnectionClosedException {
    FTPFile[] files = listFiles();/*  ww  w  .ja va  2  s.c o m*/
    Vector v = new Vector();
    for (int i = 0; i < files.length; i++) {
        v.add(files[i]);
    }
    return v;
}

From source file:com.swingtech.commons.util.ClassUtil.java

public static List getPropertyDescriptorsFromClass(final Class pClass, final String filterRegEx) {
    BeanInfo vBeanInfo = null;/*  ww w  .  j a v  a 2  s  .c  o m*/
    PropertyDescriptor[] vPropDescList = null;
    PropertyDescriptor vPropDesc = null;
    String vPropName = null;
    final Vector vPropertyNameList = new Vector();

    try {
        vBeanInfo = Introspector.getBeanInfo(pClass);
    } catch (final IntrospectionException e) {
        logger.warn("Utility.getPropertyNamesFromClass.  Error trying to use Introspector", e);
        return null;
    }

    vPropDescList = vBeanInfo.getPropertyDescriptors();

    for (int i = 0; i < vPropDescList.length; i++) {
        vPropDesc = vPropDescList[i];

        vPropName = vPropDesc.getName();

        if (Utility.isNullOrEmpty(filterRegEx) || vPropName.matches(filterRegEx)) {
            vPropertyNameList.add(vPropDesc);
        }
    }

    if (vPropertyNameList.isEmpty()) {
        return null;
    }

    return vPropertyNameList;
}

From source file:com.swingtech.commons.util.ClassUtil.java

/**
 * @param pClass//w w w.j  ava2  s.  c  o m
 * @param filterRegEx
 * @return
 */
public static List getPropertyNamesFromClass(final Class pClass, final String filterRegEx) {
    BeanInfo vBeanInfo = null;
    PropertyDescriptor vPropDescList[] = null;
    PropertyDescriptor vPropDesc = null;
    String vPropName = null;
    final Vector vPropertyNameList = new Vector();

    try {
        vBeanInfo = Introspector.getBeanInfo(pClass);
    } catch (final IntrospectionException e) {
        logger.warn("Utility.getPropertyNamesFromClass.  Error trying to use Introspector", e);
        return null;
    }

    vPropDescList = vBeanInfo.getPropertyDescriptors();

    for (int i = 0; i < vPropDescList.length; i++) {
        vPropDesc = vPropDescList[i];

        vPropName = vPropDesc.getName();

        if (Utility.isNullOrEmpty(filterRegEx) || vPropName.matches(filterRegEx)) {
            vPropertyNameList.add(vPropName);
        }
    }

    if (vPropertyNameList.isEmpty()) {
        return null;
    }

    return vPropertyNameList;
}

From source file:be.fedict.hsm.client.WSSecuritySOAPHandler.java

private void handleOutboundMessage(SOAPMessageContext context) throws SOAPException, WSSecurityException {

    if (null == this.privateKey) {
        LOG.warn("no adding a WS-Security header");
        return;//from  www .  java  2  s .c o m
    }

    SOAPMessage soapMessage = context.getMessage();
    SOAPPart soapPart = soapMessage.getSOAPPart();
    soapMessage.getSOAPHeader();
    WSSecHeader wsSecHeader = new WSSecHeader();
    wsSecHeader.setMustUnderstand(true);
    wsSecHeader.insertSecurityHeader(soapPart);

    WSSecTimestamp wsSecTimeStamp = new WSSecTimestamp();
    wsSecTimeStamp.prepare(soapPart);
    wsSecTimeStamp.prependToHeader(wsSecHeader);

    WSSecurityCrypto crypto = new WSSecurityCrypto(this.privateKey, this.certificate);
    WSSConfig wssConfig = new WSSConfig();
    WSSecSignature sign = new WSSecSignature(wssConfig);
    sign.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
    sign.prepare(soapPart, crypto, wsSecHeader);
    String bstId = sign.getBSTTokenId();
    sign.appendBSTElementToHeader(wsSecHeader);
    sign.setDigestAlgo("http://www.w3.org/2001/04/xmlenc#sha256");
    sign.setSignatureAlgorithm("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
    Vector<WSEncryptionPart> signParts = new Vector<WSEncryptionPart>();
    signParts.add(new WSEncryptionPart(wsSecTimeStamp.getId()));
    signParts.add(new WSEncryptionPart(WSConstants.ELEM_BODY, WSConstants.URI_SOAP12_ENV, ""));
    signParts.add(new WSEncryptionPart(bstId));
    sign.addReferencesToSign(signParts, wsSecHeader);
    List<Reference> referenceList = sign.addReferencesToSign(signParts, wsSecHeader);
    sign.computeSignature(referenceList, false, null);
}

From source file:com.nec.nsgui.taglib.nssorttab.ListSTModel.java

public void sort(String colName, boolean isAscend, String sideSortOrder, Hashtable comparators) {

    if (colName == null || colName.trim().equals("")) {
        return;/*w w  w  . j a va 2s .c o m*/
    }

    if (comparators == null) {
        return;
    }

    if (dataList.size() <= 1) {
        return;
    }
    Vector sortData = new Vector();

    sortData.add(colName);
    sortData.add((comparators.get(colName)));

    if (sideSortOrder != null) {
        String[] orders = sideSortOrder.split(" ");

        for (int i = 0; i < orders.length; i++) {
            String order = orders[i];
            if (!(order.trim().equals(""))) {
                sortData.add(order);
                sortData.add((comparators.get(order)));
            }
        }
    }

    SortComparator comp = new SortComparator(isAscend, sortData);
    Collections.sort(dataList, comp);

    return;
}