List of usage examples for java.util Vector Vector
public Vector()
From source file:Main.java
/** * Method getDropDownOptions.//from w w w . j av a 2s . c om * * @param vector Vector * @param valueGetter String * @param textGetter String * @param selectedValue Object * @return String * @throws NoSuchMethodException * @throws IllegalAccessException * @throws InvocationTargetException */ public static String getDropDownOptions(Vector vector, String valueGetter, String textGetter, Object selectedValue) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Vector selectedValues = new Vector(); if (selectedValue != null) { selectedValues.add(selectedValue); } return getDropDownOptions(vector, valueGetter, textGetter, selectedValues); }
From source file:com.yahoo.messenger.data.json.UserList.java
public void unserializeJSON(JSONArray a) throws JSONException { Vector v = new Vector(); // Mandatory fields for (int i = 0; i < a.length(); i++) { JSONObject o = a.getJSONObject(i); User c = new User(); c.unserializeJSON(o.getJSONObject("user")); v.addElement(c);//from w w w .ja v a 2 s .c o m } users = new User[v.size()]; v.copyInto(users); }
From source file:GroupRadio.java
public static Enumeration getSelectedElements(Container container) { Vector selections = new Vector(); Component components[] = container.getComponents(); for (int i = 0, n = components.length; i < n; i++) { if (components[i] instanceof AbstractButton) { AbstractButton button = (AbstractButton) components[i]; if (button.isSelected()) { selections.addElement(button.getText()); }//from w w w. j av a 2 s .com } } return selections.elements(); }
From source file:com.yahoo.messenger.data.json.ContactList.java
public void unserializeJSON(JSONArray a) throws JSONException { Vector v = new Vector(); // Mandatory fields for (int i = 0; i < a.length(); i++) { JSONObject o = a.getJSONObject(i); Contact c = new Contact(); c.unserializeJSON(o.getJSONObject("contact")); v.addElement(c);/* w ww.j av a 2s .c o m*/ } contacts = new Contact[v.size()]; v.copyInto(contacts); }
From source file:es.deustotech.piramide.utils.net.JSONParser.java
public static Vector<Point> parseFromUrl(HttpEntity httpEntity) { if (httpEntity != null) { InputStream inStream;/* www . ja va2 s .c om*/ try { inStream = httpEntity.getContent(); result = convertStreamToString(inStream); points = new Vector<Point>(); final JSONObject jsonObj = new JSONObject(result); final JSONObject result = jsonObj.getJSONObject(Constants.JSON_RESPONSE_DATA); //show 8 results for (int i = 0; i < 8; i++) { final JSONObject resultAux = (JSONObject) result.getJSONArray(Constants.JSON_RESULTS).get(i); // final JSONObject phoneAux = (JSONObject) resultAux.getJSONArray(Constants.JSON_PHONE_NUMBERS).get(0); final Point point = new Point(resultAux.getString(Constants.JSON_TITLE), resultAux.getString(Constants.JSON_STREET), resultAux.getString(Constants.JSON_LAT), resultAux.getString(Constants.JSON_LNG) /*new PhoneNumbers(phoneAux.getString(Constants.JSON_TYPE), phoneAux.getString(Constants.JSON_NUMBER)), resultAux.getString(Constants.JSON_CITY), resultAux.getString(Constants.JSON_TITLE), resultAux.getString(Constants.JSON_REGION), resultAux.getString(Constants.JSON_TITLE_NO_FORMATTING), resultAux.getString(Constants.JSON_STREET), resultAux.getJSONArray(Constants.JSON_ADDRESS_LINES).getString(0), resultAux.getString(Constants.JSON_COUNTRY), resultAux.getString(Constants.JSON_LAT), resultAux.getString(Constants.JSON_LNG), resultAux.getString(Constants.JSON_TO_HERE), resultAux.getString(Constants.JSON_FROM_HERE)*/); points.add(point); } // final JSONObject phoneAux = (JSONObject) result.getJSONArray(Constants.JSON_PHONE_NUMBERS).get(0); /* Log.i(Constants.TAG, "<jsonobject>\n" + jsonObj.toString() + "\n</jsonobject>"); final JSONArray nameArray = jsonObj.names(); final JSONArray valArray = jsonObj.toJSONArray(nameArray); for(int i=0; i<valArray.length(); i++) { Log.e(Constants.TAG, "<jsonname" + i + ">\n" + nameArray.getString(i) + "\n</jsonname" + i + ">\n" + "<jsonvalue" + i + ">\n" + valArray.getString(i) + "\n</jsonvalue" + i + ">"); } jsonObj.put(Constants.SAMPLE_KEY, Constants.SAMPLE_VALUE); Log.i(Constants.TAG, "<jsonobject>\n" + jsonObj.toString() + "\n</jsonobject>"); */ inStream.close(); } catch (IllegalStateException ise) { Log.d(Constants.TAG, ise.getMessage()); } catch (IOException ioe) { Log.d(Constants.TAG, ioe.getMessage()); } catch (JSONException je) { Log.d(Constants.TAG, je.getMessage()); } } // If the response does not enclose an entity, there is no need // to worry about connection release return points; }
From source file:com.yahoo.messenger.data.json.GroupList.java
public void unserializeJSON(JSONArray a) throws JSONException { Vector v = new Vector(); // Mandatory fields for (int i = 0; i < a.length(); i++) { JSONObject o = a.getJSONObject(i); Group c = new Group(); c.unserializeJSON(o.getJSONObject("group")); v.addElement(c);//w ww . j ava2s . c o m } groups = new Group[v.size()]; v.copyInto(groups); }
From source file:com.instantme.model.PhotoEntryModel.java
public PhotoEntryModel() { data = new Vector(); cursor = new Stack(); }
From source file:com.yahoo.messenger.data.json.PreferenceList.java
public void unserializeJSON(JSONArray a) throws JSONException { Vector v = new Vector(); // Mandatory fields for (int i = 0; i < a.length(); i++) { JSONObject o = a.getJSONObject(i); Preference c = new Preference(); c.unserializeJSON(o.getJSONObject("preference")); v.addElement(c);/*from w w w .j a va2s. c om*/ } preferences = new Preference[v.size()]; v.copyInto(preferences); }
From source file:com.yahoo.messenger.data.notification.json.ResponseList.java
public void unserializeJSON(JSONArray a) throws JSONException { Vector v = new Vector(); // Mandatory fields for (int i = 0; i < a.length(); i++) { JSONObject o = a.getJSONObject(i); if (o.has("message")) { Message c = new Message(); c.unserializeJSON(o.getJSONObject("message")); v.addElement(c);/* www . j a v a2s. com*/ } if (o.has("buddyInfo")) { BuddyInfo c = new BuddyInfo(); c.unserializeJSON(o.getJSONObject("buddyInfo")); v.addElement(c); } } responses = new Response[v.size()]; v.copyInto(responses); }
From source file:com.bt.aloha.mockphones.Main.java
public static ClassPathXmlApplicationContext start(String[] args) { List<String> appCtx = new Vector<String>(); appCtx.add("applicationContext.xml"); if (args.length == 1) { if ("database".equals(args[0])) { appCtx.add("database-collections-ctx.xml"); appCtx.add("database-sipstone-datasource-ctx.xml"); } else if ("memory".equals(args[0])) { appCtx.add("memory-collections-ctx.xml"); } else if ("ha-database".equals(args[0])) { appCtx.add("database-collections-ctx.xml"); appCtx.add("database-ha-datasource-ctx.xml"); } else {/*www.jav a 2s . co m*/ throw new IllegalArgumentException( "args[0] not understood: need one of 'memory' or 'database']. Default is memory"); } } else { appCtx.add("memory-collections-ctx.xml"); } ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext( appCtx.toArray(new String[appCtx.size()])); applicationContext.registerShutdownHook(); printStartupScreen(applicationContext); return applicationContext; }