Example usage for java.util Vector addElement

List of usage examples for java.util Vector addElement

Introduction

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

Prototype

public synchronized void addElement(E obj) 

Source Link

Document

Adds the specified component to the end of this vector, increasing its size by one.

Usage

From source file:cm.aptoide.pt.ManageRepo.java

@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {

    LayoutInflater li = LayoutInflater.from(this);

    switch (item.getItemId()) {
    case ADD_REPO:
        View view = li.inflate(R.layout.addrepo, null);

        final TextView sec_msg = (TextView) view.findViewById(R.id.sec_msg);
        final TextView sec_msg2 = (TextView) view.findViewById(R.id.sec_msg2);

        final EditText sec_user = (EditText) view.findViewById(R.id.sec_user);
        final EditText sec_pwd = (EditText) view.findViewById(R.id.sec_pwd);

        final CheckBox sec = (CheckBox) view.findViewById(R.id.secure_chk);
        sec.setOnCheckedChangeListener(new OnCheckedChangeListener() {
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    sec_user.setEnabled(true);
                    sec_pwd.setEnabled(true);
                } else {
                    sec_user.setEnabled(false);
                    sec_pwd.setEnabled(false);
                }//from w  w  w  .  ja v a 2s . c  o  m
            }
        });

        Builder p = new AlertDialog.Builder(this).setView(view);
        alrt = p.create();
        alrt.setIcon(android.R.drawable.ic_menu_add);
        alrt.setTitle("Add new repository");

        alrt.setButton("Add", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                Message msg = new Message();
                EditText uri = (EditText) alrt.findViewById(R.id.edit_uri);
                String uri_str = uri.getText().toString();
                sec_msg.setVisibility(View.GONE);
                sec_msg2.setVisibility(View.GONE);
                if (sec.isChecked()) {
                    String user = sec_user.getText().toString();
                    String pwd = sec_pwd.getText().toString();
                    int result = checkServer(uri_str, user, pwd);
                    if (result == 200) {
                        msg.obj = 0;
                        db.addServer(uri_str);
                        db.addLogin(user, pwd, uri_str);
                        change = true;
                        redraw();
                    } else if (result == 401) {
                        sec_msg2.setText("Login is wrong");
                        sec_msg2.setVisibility(View.VISIBLE);
                        msg.obj = 1;
                    } else {
                        sec_msg.setText("Can't connect to server");
                        sec_msg.setVisibility(View.VISIBLE);
                        msg.obj = 1;
                    }
                } else {
                    int result = checkServer(uri_str, null, null);
                    if (result == 200) {
                        msg.obj = 0;
                        db.addServer(uri_str);
                        change = true;
                        redraw();
                    } else if (result == 401) {
                        sec_msg2.setText("Login required");
                        sec_msg2.setVisibility(View.VISIBLE);
                        msg.obj = 1;
                    } else {
                        sec_msg.setText("Can't connect to server");
                        sec_msg.setVisibility(View.VISIBLE);
                        msg.obj = 1;
                    }
                }
                new_repo.sendMessage(msg);
            }
        });

        alrt.setButton2("Cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                alrt.dismiss();
            }
        });
        alrt.show();
        break;

    case REM_REPO:
        final Vector<String> rem_lst = new Vector<String>();
        CharSequence[] b = new CharSequence[server_lst.size()];
        for (int i = 0; i < server_lst.size(); i++) {
            b[i] = server_lst.get(i).uri;
        }

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Chose repository to remove");
        builder.setIcon(android.R.drawable.ic_menu_close_clear_cancel);
        builder.setMultiChoiceItems(b, null, new DialogInterface.OnMultiChoiceClickListener() {
            public void onClick(DialogInterface dialog, int whichButton, boolean isChecked) {
                if (isChecked) {
                    rem_lst.addElement(server_lst.get(whichButton).uri);
                } else {
                    rem_lst.removeElement(server_lst.get(whichButton).uri);
                }
            }
        });
        builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                db.removeServer(rem_lst);
                change = true;
                redraw();
            }
        });
        builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                return;
            }
        });
        AlertDialog alert = builder.create();
        alert.show();
        break;

    case EDIT_REPO:
        CharSequence[] b2 = new CharSequence[server_lst.size()];
        for (int i = 0; i < server_lst.size(); i++) {
            b2[i] = server_lst.get(i).uri;
        }

        AlertDialog.Builder builder2 = new AlertDialog.Builder(this);
        builder2.setTitle("Chose repository to edit");
        builder2.setIcon(android.R.drawable.ic_menu_edit);
        builder2.setSingleChoiceItems(b2, -1, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                updt_repo = server_lst.get(which).uri;
            }
        });
        builder2.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                editRepo(updt_repo);
                return;
            }
        });
        builder2.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                return;
            }
        });
        alert2 = builder2.create();
        alert2.show();
        break;
    }
    return super.onMenuItemSelected(featureId, item);
}

From source file:com.github.maven_nar.cpptasks.compiler.CommandLineCompiler.java

protected void buildDefineArguments(final CompilerDef[] defs, final Vector<String> args) {
    ///*from  w w  w.  ja  v  a 2s . c  o  m*/
    // assume that we aren't inheriting defines from containing <cc>
    //
    UndefineArgument[] merged = defs[0].getActiveDefines();
    for (int i = 1; i < defs.length; i++) {
        //
        // if we are inheriting, merge the specific defines with the
        // containing defines
        merged = UndefineArgument.merge(defs[i].getActiveDefines(), merged);
    }
    final StringBuffer buf = new StringBuffer(30);
    for (final UndefineArgument current : merged) {
        buf.setLength(0);
        if (current.isDefine()) {
            getDefineSwitch(buf, current.getName(), current.getValue());
        } else {
            getUndefineSwitch(buf, current.getName());
        }
        args.addElement(buf.toString());
    }
}

From source file:com.duroty.application.files.actions.UploadAction.java

protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    ActionMessages errors = new ActionMessages();

    try {//from w ww . ja v a  2 s .c o m
        boolean isMultipart = FileUpload.isMultipartContent(request);

        Store storeInstance = getStoreInstance(request);

        if (isMultipart) {
            Map fields = new HashMap();
            Vector files = new Vector();

            //Parse the request
            List items = diskFileUpload.parseRequest(request);

            //Process the uploaded items
            Iterator iter = items.iterator();

            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();

                if (item.isFormField()) {
                    fields.put(item.getFieldName(), item.getString());
                } else {
                    if (!StringUtils.isBlank(item.getName())) {
                        ByteArrayOutputStream baos = null;

                        try {
                            baos = new ByteArrayOutputStream();

                            IOUtils.copy(item.getInputStream(), baos);

                            MailPartObj part = new MailPartObj();
                            part.setAttachent(baos.toByteArray());
                            part.setContentType(item.getContentType());
                            part.setName(item.getName());
                            part.setSize(item.getSize());

                            files.addElement(part);
                        } catch (Exception ex) {
                        } finally {
                            IOUtils.closeQuietly(baos);
                        }
                    }
                }
            }

            if (files.size() > 0) {
                //Integer label = new Integer((String) fields.get("label"));
                storeInstance.send(files, 0, Charset.defaultCharset().displayName());
            }
        } else {
            errors.add("general",
                    new ActionMessage(ExceptionCode.ERROR_MESSAGES_PREFIX + "mail.send", "The form is null"));
            request.setAttribute("exception", "The form is null");
            request.setAttribute("newLocation", null);
            doTrace(request, DLog.ERROR, getClass(), "The form is null");
        }
    } catch (Exception ex) {
        String errorMessage = ExceptionUtilities.parseMessage(ex);

        if (errorMessage == null) {
            errorMessage = "NullPointerException";
        }

        errors.add("general", new ActionMessage(ExceptionCode.ERROR_MESSAGES_PREFIX + "general", errorMessage));
        request.setAttribute("exception", errorMessage);
        doTrace(request, DLog.ERROR, getClass(), errorMessage);
    } finally {
    }

    if (errors.isEmpty()) {
        doTrace(request, DLog.INFO, getClass(), "OK");

        return mapping.findForward(Constants.ACTION_SUCCESS_FORWARD);
    } else {
        saveErrors(request, errors);

        return mapping.findForward(Constants.ACTION_FAIL_FORWARD);
    }
}

From source file:com.netscape.kra.StorageKeyUnit.java

/**
 * Returns a list of recovery agent identifiers.
 *//*from   www.j  a v  a2 s  .c  o  m*/
public Enumeration<String> getAgentIdentifiers() {
    Vector<String> v = new Vector<String>();

    for (int i = 0;; i++) {
        try {
            String uid = mStorageConfig.getString(PROP_UID + i);

            if (uid == null)
                break;
            v.addElement(uid);
        } catch (EBaseException e) {
            break;
        }
    }
    return v.elements();
}

From source file:com.toughra.mlearnplayer.EXEStrMgr.java

/**
 * Gets a list of the keys that need replicated to the cloud
 *///w  w w  . j  a  v  a2  s .c  o  m
public String[] getReplicateList() {
    Vector repList = new Vector();
    String prefListStr = prefs.getPref(KEY_REPLIST);
    if (prefListStr == null) {
        return new String[] {};//zero length string means nothing to replicate
    }

    int pos = 0;
    while (pos < prefListStr.length()) {
        //search for the next property - all property names start with a :
        int nextPos = prefListStr.indexOf(':', pos + 1);
        String propName = prefListStr.substring(pos + 1, nextPos);
        repList.addElement(propName);
        pos = nextPos + 1;//e.g. after the ending : for that property
    }
    String[] repArr = new String[repList.size()];
    repList.copyInto(repArr);

    return repArr;
}

From source file:Maze.java

/**
 * internal to createMaze.  Checks the four squares surrounding 
 * the chosen square.  Of those that are already connected to 
 * the maze, one is randomly selected to be joined to the 
 * current square (to attach the current square to the 
 * growing maze).  Those squares that were not previously in 
 * a position to be joined to the maze are added to the list 
 * of "possible" squares (that could be chosen to be attached 
 * to the maze in the next round).//from   w  ww  . ja  va 2s. co  m
 */
private void link(int[] chosenSquare, Vector possibleSquares) {
    int linkCount = 0;
    int i = chosenSquare[0];
    int j = chosenSquare[1];
    int[] links = new int[8];
    if (i >= 3) {
        if (mySquares[i - 2][j] == 1) {
            links[2 * linkCount] = i - 1;
            links[2 * linkCount + 1] = j;
            linkCount++;
        } else if (mySquares[i - 2][j] == 3) {
            mySquares[i - 2][j] = 2;
            int[] newSquare = new int[2];
            newSquare[0] = i - 2;
            newSquare[1] = j;
            possibleSquares.addElement(newSquare);
        }
    }
    if (j + 3 <= mySquares[i].length) {
        if (mySquares[i][j + 2] == 3) {
            mySquares[i][j + 2] = 2;
            int[] newSquare = new int[2];
            newSquare[0] = i;
            newSquare[1] = j + 2;
            possibleSquares.addElement(newSquare);
        } else if (mySquares[i][j + 2] == 1) {
            links[2 * linkCount] = i;
            links[2 * linkCount + 1] = j + 1;
            linkCount++;
        }
    }
    if (j >= 3) {
        if (mySquares[i][j - 2] == 3) {
            mySquares[i][j - 2] = 2;
            int[] newSquare = new int[2];
            newSquare[0] = i;
            newSquare[1] = j - 2;
            possibleSquares.addElement(newSquare);
        } else if (mySquares[i][j - 2] == 1) {
            links[2 * linkCount] = i;
            links[2 * linkCount + 1] = j - 1;
            linkCount++;
        }
    }
    if (i + 3 <= mySquares.length) {
        if (mySquares[i + 2][j] == 3) {
            mySquares[i + 2][j] = 2;
            int[] newSquare = new int[2];
            newSquare[0] = i + 2;
            newSquare[1] = j;
            possibleSquares.addElement(newSquare);
        } else if (mySquares[i + 2][j] == 1) {
            links[2 * linkCount] = i + 1;
            links[2 * linkCount + 1] = j;
            linkCount++;
        }
    }
    if (linkCount > 0) {
        int linkChoice = getRandomInt(linkCount);
        int linkX = links[2 * linkChoice];
        int linkY = links[2 * linkChoice + 1];
        mySquares[linkX][linkY] = 1;
        int[] removeSquare = new int[2];
        removeSquare[0] = linkX;
        removeSquare[1] = linkY;
        possibleSquares.removeElement(removeSquare);
    }
}

From source file:com.sshtools.common.ui.SshToolsApplicationPanel.java

/**
 * Rebuild all the action components such as toobar, context menu
 *//*from   w  w  w  .j ava  2s .c  o m*/

public void rebuildActionComponents() {
    //  Clear the current state of the component
    log.debug("Rebuild action components");
    toolBar.removeAll();
    //
    Vector enabledActions = new Vector();
    for (Iterator i = actions.iterator(); i.hasNext();) {
        StandardAction a = (StandardAction) i.next();
        String n = (String) a.getValue(Action.NAME);
        Boolean s = (Boolean) actionsVisible.get(n);
        if (s == null) {
            s = Boolean.TRUE;
        }
        if (Boolean.TRUE.equals(s)) {
            log.debug("Action " + n + " is enabled.");
            enabledActions.add(a);
        } else {
            log.debug("Action " + n + " not enabled.");
        }
    }
    //  Build the tool bar, grouping the actions
    Vector v = new Vector();
    for (Iterator i = enabledActions.iterator(); i.hasNext();) {
        StandardAction a = (StandardAction) i.next();
        if (Boolean.TRUE.equals((Boolean) a.getValue(StandardAction.ON_TOOLBAR))) {
            v.addElement(a);
        }
    }

    Collections.sort(v, new ToolBarActionComparator());
    Integer grp = null;
    for (Iterator i = v.iterator(); i.hasNext();) {
        StandardAction z = (StandardAction) i.next();
        if ((grp != null) && !grp.equals((Integer) z.getValue(StandardAction.TOOLBAR_GROUP))) {
            toolBar.add(new ToolBarSeparator());
        }
        if (Boolean.TRUE.equals((Boolean) z.getValue(StandardAction.IS_TOGGLE_BUTTON))) {
            ToolToggleButton tBtn = new ToolToggleButton(z);
            toolBar.add(tBtn);
        } else {
            ToolButton btn = new ToolButton(z);
            toolBar.add(btn);
        }
        grp = (Integer) z.getValue(StandardAction.TOOLBAR_GROUP);
    }
    toolBar.revalidate();
    toolBar.repaint();
    //  Build the context menu, grouping the actions
    Vector c = new Vector();
    contextMenu.removeAll();
    for (Iterator i = enabledActions.iterator(); i.hasNext();) {
        StandardAction a = (StandardAction) i.next();
        if (Boolean.TRUE.equals((Boolean) a.getValue(StandardAction.ON_CONTEXT_MENU))) {
            c.addElement(a);
        }
    }
    Collections.sort(c, new ContextActionComparator());
    grp = null;
    for (Iterator i = c.iterator(); i.hasNext();) {
        StandardAction z = (StandardAction) i.next();
        if ((grp != null) && !grp.equals((Integer) z.getValue(StandardAction.CONTEXT_MENU_GROUP))) {
            contextMenu.addSeparator();
        }
        contextMenu.add(z);
        grp = (Integer) z.getValue(StandardAction.CONTEXT_MENU_GROUP);
    }
    contextMenu.revalidate();
    //  Build the menu bar
    menuBar.removeAll();
    v.removeAllElements();
    for (Enumeration e = enabledActions.elements(); e.hasMoreElements();) {
        StandardAction a = (StandardAction) e.nextElement();

        if (Boolean.TRUE.equals((Boolean) a.getValue(StandardAction.ON_MENUBAR))) {
            v.addElement(a);
        }
    }
    Vector menus = (Vector) actionMenus.clone();
    Collections.sort(menus);
    HashMap map = new HashMap();
    for (Iterator i = v.iterator(); i.hasNext();) {
        StandardAction z = (StandardAction) i.next();
        String menuName = (String) z.getValue(StandardAction.MENU_NAME);
        if (menuName == null) {
            log.error("Action " + z.getName() + " doesnt specify a value for " + StandardAction.MENU_NAME);
        } else {
            String m = (String) z.getValue(StandardAction.MENU_NAME);
            ActionMenu menu = getActionMenu(menus.iterator(), m);
            if (menu == null) {
                log.error("Action menu " + z.getName() + " does not exist");
            } else {
                Vector x = (Vector) map.get(menu.name);
                if (x == null) {
                    x = new Vector();
                    map.put(menu.name, x);
                }
                x.addElement(z);
            }
        }
    }

    for (Iterator i = menus.iterator(); i.hasNext();) {
        ActionMenu m = (ActionMenu) i.next();
        Vector x = (Vector) map.get(m.name);
        if (x != null) {
            Collections.sort(x, new MenuItemActionComparator());
            JMenu menu = new JMenu(m.displayName);
            menu.setMnemonic(m.mnemonic);
            grp = null;
            for (Iterator j = x.iterator(); j.hasNext();) {
                StandardAction a = (StandardAction) j.next();
                Integer g = (Integer) a.getValue(StandardAction.MENU_ITEM_GROUP);
                if ((grp != null) && !g.equals(grp)) {
                    menu.addSeparator();
                }
                grp = g;
                if (a instanceof MenuAction) {
                    JMenu mnu = (JMenu) a.getValue(MenuAction.MENU);
                    menu.add(mnu);
                } else {
                    JMenuItem item = new JMenuItem(a);
                    menu.add(item);
                }
            }
            menuBar.add(menu);
        } else {
            log.error("Can't find menu " + m.name);
        }
    }
    menuBar.validate();
    menuBar.repaint();
}

From source file:com.duroty.application.mail.actions.SaveDraftAction.java

protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    ActionMessages errors = new ActionMessages();

    try {/*from  w w w . ja  v a 2 s  .  c o m*/
        boolean isMultipart = FileUpload.isMultipartContent(request);

        if (isMultipart) {
            Map fields = new HashMap();
            Vector attachments = new Vector();

            //Parse the request
            List items = diskFileUpload.parseRequest(request);

            //Process the uploaded items
            Iterator iter = items.iterator();

            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();

                if (item.isFormField()) {
                    fields.put(item.getFieldName(), item.getString());
                } else {
                    if (!StringUtils.isBlank(item.getName())) {
                        ByteArrayOutputStream baos = null;

                        try {
                            baos = new ByteArrayOutputStream();

                            IOUtils.copy(item.getInputStream(), baos);

                            MailPartObj part = new MailPartObj();
                            part.setAttachent(baos.toByteArray());
                            part.setContentType(item.getContentType());
                            part.setName(item.getName());
                            part.setSize(item.getSize());

                            attachments.addElement(part);
                        } catch (Exception ex) {
                        } finally {
                            IOUtils.closeQuietly(baos);
                        }
                    }
                }
            }

            String body = "";

            if (fields.get("taBody") != null) {
                body = (String) fields.get("taBody");
            } else if (fields.get("taReplyBody") != null) {
                body = (String) fields.get("taReplyBody");
            }

            Preferences preferencesInstance = getPreferencesInstance(request);

            Send sendInstance = getSendInstance(request);

            String mid = (String) fields.get("mid");

            sendInstance.saveDraft(mid, Integer.parseInt((String) fields.get("identity")),
                    (String) fields.get("to"), (String) fields.get("cc"), (String) fields.get("bcc"),
                    (String) fields.get("subject"), body, attachments,
                    preferencesInstance.getPreferences().isHtmlMessage(),
                    Charset.defaultCharset().displayName(), (String) fields.get("priority"));
        } else {
            errors.add("general",
                    new ActionMessage(ExceptionCode.ERROR_MESSAGES_PREFIX + "mail.send", "The form is null"));
            request.setAttribute("exception", "The form is null");
            request.setAttribute("newLocation", null);
            doTrace(request, DLog.ERROR, getClass(), "The form is null");
        }
    } catch (Exception ex) {
        String errorMessage = ExceptionUtilities.parseMessage(ex);

        if (errorMessage == null) {
            errorMessage = "NullPointerException";
        }

        errors.add("general", new ActionMessage(ExceptionCode.ERROR_MESSAGES_PREFIX + "general", errorMessage));
        request.setAttribute("exception", errorMessage);
        doTrace(request, DLog.ERROR, getClass(), errorMessage);
    } finally {
    }

    if (errors.isEmpty()) {
        doTrace(request, DLog.INFO, getClass(), "OK");

        return mapping.findForward(Constants.ACTION_SUCCESS_FORWARD);
    } else {
        saveErrors(request, errors);

        return mapping.findForward(Constants.ACTION_FAIL_FORWARD);
    }
}

From source file:net.rim.ejde.internal.packaging.RAPCFile.java

private void addMidletEntries(File projectFile, BlackBerryProperties properties, Vector<String> entries,
        int index) throws CoreException {
    StringBuffer sb = new StringBuffer();

    sb.append("MIDlet-").append(index);
    sb.append(": ");
    sb.append(properties._general.getTitle());
    sb.append(',');
    Icon[] icons = properties._resources.getIconFiles();
    for (int i = 0; i < icons.length; i++) {
        if (!icons[i].isFocus()) {
            // need to remove the source folder segment
            IPath iconFilePath = getSourceFolderRelativePath(icons[i].getCanonicalFileName());
            sb.append(convertToBackSlash(iconFilePath.toOSString()));
        }/* w ww .j  a v a2 s  . c om*/
    }
    sb.append(',');
    if (!StringUtils.isBlank(properties._application.getMainMIDletName().trim())) {
        sb.append(properties._application.getMainMIDletName());
    } else {
        sb.append(properties._application.getMainArgs());
    }
    entries.addElement(sb.toString());

    boolean hasFocusIcon = false;
    // set focus icon
    for (int i = 0; i < icons.length; ++i) {
        if (icons[i].isFocus()) {
            sb.setLength(0);
            // we only allow one focus icon
            sb.append("RIM-MIDlet-Icon-").append(index).append('-').append(1);
            sb.append(": ");
            // need to remove the source folder segment
            IPath iconFilePath = getSourceFolderRelativePath(icons[i].getCanonicalFileName());
            sb.append(convertToBackSlash(iconFilePath.toOSString()));
            sb.append(",focused");
            entries.addElement(sb.toString());
            hasFocusIcon = true;
        }
    }
    if (hasFocusIcon) {
        sb.setLength(0);
        sb.append("RIM-MIDlet-Icon-Count-").append(index);
        sb.append(": ");
        sb.append(1);
        entries.addElement(sb.toString());
    }
    sb.setLength(0);
    sb.append("RIM-MIDlet-Flags-").append(index);
    sb.append(": ");
    sb.append(getFlags(properties, false));
    entries.addElement(sb.toString());

    int ribbonPosition = properties._application.getHomeScreenPosition();
    if (ribbonPosition != 0) {
        sb.setLength(0);
        sb.append("RIM-MIDlet-Position-").append(index);
        sb.append(": ");
        sb.append(ribbonPosition);
        entries.addElement(sb.toString());
    }

    // we need to check all resource related properties to make sure the resource is valid
    String titleResourceBundleClassName = properties._resources.getTitleResourceBundleClassName();
    String titleResourceBundleKey = properties._resources.getTitleResourceBundleKey();
    if (properties._resources.hasTitleResource() && !StringUtils.isEmpty(titleResourceBundleClassName)
            && !StringUtils.isEmpty(titleResourceBundleKey)) {
        sb.setLength(0);
        sb.append("RIM-MIDlet-NameResourceBundle-").append(index);
        sb.append(": ");
        sb.append(titleResourceBundleClassName);
        entries.addElement(sb.toString());

        sb.setLength(0);
        sb.append("RIM-MIDlet-NameResourceId-").append(index);
        sb.append(": ");
        sb.append(getTitleResourceId(properties));
        entries.addElement(sb.toString());
    }
    // check kewword resources

    String keywordResourceBundleClassName = properties.getKeywordResources()
            .getKeywordTitleResourceBundleClassName();
    String keywordResourceBundleKey = properties.getKeywordResources().getKeywordResourceBundleKey();
    if (!StringUtils.isEmpty(keywordResourceBundleClassName)
            && !StringUtils.isEmpty(keywordResourceBundleKey)) {
        sb.setLength(0);
        sb.append("RIM-MIDlet-KeywordResourceBundle-").append(index);
        sb.append(": ");
        sb.append(keywordResourceBundleClassName);
        entries.addElement(sb.toString());

        sb.setLength(0);
        sb.append("RIM-MIDlet-KeywordResourceId-").append(index);
        sb.append(": ");
        sb.append(keywordResourceBundleKey);
        entries.addElement(sb.toString());
    }
}

From source file:JavaTron.AudioTron.java

/**
 * Tell the audiotron to play a file (same as queueFile but clears
 * the playlist first)//  w w  w .  ja  va 2  s .com
 *
 * type is the type of file to queue
 * file is the file to queue
 * @param playable A Playable Object - a file, or list
 */
public void playFile(Playable playable) {
    if (!playable.isPlayable()) {
        return;
    }

    Vector list = new Vector();
    list.addElement(playable);
    playFile(list.elements());
}