List of usage examples for java.util Vector elements
public Enumeration<E> elements()
From source file:org.openflexo.foundation.ie.IEWOComponent.java
/** * Implements/*w ww. j a v a 2 s . c o m*/ * * @see org.openflexo.foundation.rm.FlexoResourceData#receiveRMNotification(org.openflexo.foundation.rm.RMNotification) Receive a * notification that has been propagated by the ResourceManager scheme and coming from a modification on an other resource * * Handles ComponentNameChanged notifications * * @see org.openflexo.foundation.rm.FlexoResourceData#receiveRMNotification(org.openflexo.foundation.rm.RMNotification) */ @Override public void receiveRMNotification(RMNotification aNotification) throws FlexoException { if (aNotification instanceof ComponentNameChanged) { ComponentNameChanged notification = (ComponentNameChanged) aNotification; Vector instances = getAllComponentInstances(); for (Enumeration en = instances.elements(); en.hasMoreElements();) { ComponentInstance ci = (ComponentInstance) en.nextElement(); if (ci.getComponentName().equals(notification.oldValue())) { ci.notifyComponentNameChanged(notification.component); } } } if (aNotification instanceof ComponentDeleteRequest) { ComponentDeleteRequest notification = (ComponentDeleteRequest) aNotification; for (Enumeration en = getAllComponentInstances().elements(); en.hasMoreElements();) { ComponentInstance ci = (ComponentInstance) en.nextElement(); if (ci.getComponentName().equals(notification.component.getComponentName())) { notification .addToWarnings(notification.component.getComponentName() + " is used by " + getName()); } } } if (aNotification instanceof ComponentDeleted) { ComponentDeleted notification = (ComponentDeleted) aNotification; for (Enumeration en = getAllComponentInstances().elements(); en.hasMoreElements();) { ComponentInstance ci = (ComponentInstance) en.nextElement(); if (ci.getComponentName().equals(notification.component.getComponentName())) { IEReusableWidget[] reusable = findReusableWidgetForComponentInstance(ci); for (int i = 0; i < reusable.length; i++) { reusable[i].delete(); } IEHyperlinkWidget[] hyperlink = findHyperlinksForComponentInstance(ci); for (int i = 0; i < hyperlink.length; i++) { hyperlink[i].setPopupComponentDefinition(null); } } } } }
From source file:de.dmarcini.submatix.pclogger.gui.spx42LogGraphPanel.java
/** * Erzeuge ein XY-Dataset aus einem Vector Project: SubmatixBTForPC Package: de.dmarcini.submatix.pclogger.gui * /*w w w . j a v a2s . co m*/ * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 03.07.2012 * @param diveList * @param x * X-Achse (Sekundenoffset) * @param y * Y-Achse * @return Datenset */ private XYDataset createXYDataset(String scalaTitle, Vector<Integer[]> diveList, int unitToConvert, int x, int y) { final XYSeries series = new XYSeries(scalaTitle); double secounds = 0; Integer[] dataSet; // // alle Datenstze abklappern // for (Enumeration<Integer[]> enu = diveList.elements(); enu.hasMoreElements();) { dataSet = enu.nextElement(); if (y == LogDerbyDatabaseUtil.DEPTH) { double fDepth = new Double(dataSet[y]); fDepth = 0.00 - (fDepth / 10.00); // muss konvertiert werden? if (unitToConvert == ProjectConst.UNITS_IMPERIAL) { // metrisch-> imperial konvertieren // 1 foot == 30,48 cm == 0.3048 Meter fDepth = fDepth / 0.3048; } else if (unitToConvert == ProjectConst.UNITS_METRIC) { // imperial -> metrisch // 1 foot == 30,48 cm == 0.3048 Meter fDepth = fDepth * 0.3048; } series.add(secounds, fDepth); } else if (y == LogDerbyDatabaseUtil.PPO2 || y == LogDerbyDatabaseUtil.PPO2_01 || y == LogDerbyDatabaseUtil.PPO2_02 || y == LogDerbyDatabaseUtil.PPO2_03) { double fPpo2 = new Double(dataSet[y] / 1000.00); if (unitToConvert == ProjectConst.UNITS_IMPERIAL) { // metrisch -> imperial // 1 bar = 14,504 psi fPpo2 = fPpo2 * 14.504; } else if (unitToConvert == ProjectConst.UNITS_METRIC) { // imperial -> metrisch // 1 psi = 0,0689 bar fPpo2 = fPpo2 * 0.0689; } series.add(secounds, fPpo2); } else if (y == LogDerbyDatabaseUtil.SETPOINT) { double fSetPoint = new Double(dataSet[y] / 10.00); if (unitToConvert == ProjectConst.UNITS_IMPERIAL) { // metrisch -> imperial // 1 bar = 14,504 psi fSetPoint = fSetPoint * 14.504; } else if (unitToConvert == ProjectConst.UNITS_METRIC) { // imperial -> metrisch // 1 psi = 0,0689 bar fSetPoint = fSetPoint * 0.0689; } series.add(secounds, fSetPoint); } else if (y == LogDerbyDatabaseUtil.TEMPERATURE) { double fTemp = new Double(dataSet[y]); // muss konvertiert werden? if (unitToConvert == ProjectConst.UNITS_IMPERIAL) { // metrisch-> imperial konvertieren // t F = 5?9 (t 32) C fTemp = (5.0 / 9.0) * (fTemp - 32.0); } else if (unitToConvert == ProjectConst.UNITS_METRIC) { // imperial -> metrisch // t C = (9?5 t + 32) F fTemp = ((5.0 / 9.0) * fTemp) + 32.0; } series.add(secounds, fTemp); } else { series.add(secounds, new Double(dataSet[y])); } // das offset/schrittweite ist in Sekunden gespeichert secounds += (dataSet[x]); } final XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series); return dataset; }
From source file:org.openflexo.foundation.ie.IEWOComponent.java
private IEReusableWidget[] findReusableWidgetForComponentInstance(ComponentInstance ci) { Vector allIEObjects = getAllEmbeddedIEObjects(); Vector<IEReusableWidget> returned = new Vector<IEReusableWidget>(); for (Enumeration en = allIEObjects.elements(); en.hasMoreElements();) { IEObject next = (IEObject) en.nextElement(); if (next instanceof IEReusableWidget) { if (((IEReusableWidget) next).getReusableComponentInstance().equals(ci)) { returned.add((IEReusableWidget) next); }/*from ww w .j a v a2s . c o m*/ } } IEReusableWidget[] answer = new IEReusableWidget[returned.size()]; int i = 0; Enumeration en = returned.elements(); while (en.hasMoreElements()) { answer[i] = (IEReusableWidget) en.nextElement(); i++; } return answer; }
From source file:org.openflexo.foundation.ie.IEWOComponent.java
private IEHyperlinkWidget[] findHyperlinksForComponentInstance(ComponentInstance ci) { Vector allIEObjects = getAllEmbeddedIEObjects(); Vector<IEHyperlinkWidget> returned = new Vector<IEHyperlinkWidget>(); for (Enumeration en = allIEObjects.elements(); en.hasMoreElements();) { IEObject next = (IEObject) en.nextElement(); if (next instanceof IEHyperlinkWidget) { if (((IEHyperlinkWidget) next).getPopupComponentDefinition() != null && ((IEHyperlinkWidget) next) .getPopupComponentDefinition().equals(ci.getComponentDefinition())) { returned.add((IEHyperlinkWidget) next); }//w w w. ja v a 2 s. c o m } } IEHyperlinkWidget[] answer = new IEHyperlinkWidget[returned.size()]; int i = 0; Enumeration en = returned.elements(); while (en.hasMoreElements()) { answer[i] = (IEHyperlinkWidget) en.nextElement(); i++; } return answer; }
From source file:org.ecoinformatics.seek.datasource.darwincore.DarwinCoreDataSource.java
/** * Append a header row describing the columns * /*from w w w. ja v a 2 s . c o m*/ * @param aStrBuf * @param aColumns * @param aDelim */ private void appendHeaderRow(StringBuffer aStrBuf, Vector aColumns, String aColDelim, String aRowDelim) { if (aStrBuf != null && aColumns != null) { StringBuffer headerRow = new StringBuffer(); Enumeration colEnum = aColumns.elements(); while (colEnum.hasMoreElements()) { DSTableFieldIFace colDef = (DSTableFieldIFace) colEnum.nextElement(); if (headerRow.length() > 0) { headerRow.append(aColDelim); } headerRow.append(colDef.getName()); } aStrBuf.append(headerRow); aStrBuf.append(aRowDelim); } }
From source file:com.alfaariss.oa.profile.aselect.business.requestor.RequestorService.java
private String serializeAttributes(IAttributes oAttributes) throws OAException { String sReturn = null;// w ww.jav a2 s . co m try { StringBuffer sbCGI = new StringBuffer(); Enumeration enumGatheredAttributes = oAttributes.getNames(); while (enumGatheredAttributes.hasMoreElements()) { StringBuffer sbPart = new StringBuffer(); String sKey = (String) enumGatheredAttributes.nextElement(); Object oValue = oAttributes.get(sKey); if (oValue instanceof Vector) {// it's a multivalue attribute Vector vValue = (Vector) oValue; Enumeration eEnum = vValue.elements(); while (eEnum.hasMoreElements()) { String sValue = (String) eEnum.nextElement(); sbPart.append(URLEncoder.encode(sKey + "[]", ASelectProcessor.CHARSET)); sbPart.append("="); sbPart.append(URLEncoder.encode(sValue, ASelectProcessor.CHARSET)); if (eEnum.hasMoreElements()) sbPart.append("&"); } } else if (oValue instanceof String) {// it's a single value attribute String sValue = (String) oValue; sbPart.append(URLEncoder.encode(sKey, ASelectProcessor.CHARSET)); sbPart.append("="); sbPart.append(URLEncoder.encode(sValue, ASelectProcessor.CHARSET)); } else { StringBuffer sbDebug = new StringBuffer("Attribute '"); sbDebug.append(sKey); sbDebug.append("' has an unsupported value; is not a String: "); sbDebug.append(oValue); _logger.debug(sbDebug.toString()); } if (sbPart.length() > 0 && sbCGI.length() > 0) sbCGI.append("&"); sbCGI.append(sbPart); } if (sbCGI.length() > 0) { byte[] baCGI = Base64.encodeBase64(sbCGI.toString().getBytes(ASelectProcessor.CHARSET)); sReturn = new String(baCGI, ASelectProcessor.CHARSET); } } catch (Exception e) { _logger.fatal("Could not serialize attributes: " + oAttributes.toString(), e); throw new OAException(SystemErrors.ERROR_INTERNAL); } return sReturn; }
From source file:org.apache.flex.forks.velocity.runtime.configuration.Configuration.java
/** * Save the properties to the given outputstream. * * @param output An OutputStream.//from ww w.j a v a 2s . c o m * @param header A String. * @exception IOException. */ public synchronized void save(OutputStream output, String Header) throws IOException { if (output != null) { PrintWriter theWrtr = new PrintWriter(output); if (Header != null) { theWrtr.println(Header); } Enumeration theKeys = keys(); while (theKeys.hasMoreElements()) { String key = (String) theKeys.nextElement(); Object value = get((Object) key); if (value != null) { if (value instanceof String) { StringBuffer currentOutput = new StringBuffer(); currentOutput.append(key); currentOutput.append("="); currentOutput.append((String) value); theWrtr.println(currentOutput.toString()); } else if (value instanceof Vector) { Vector values = (Vector) value; Enumeration valuesEnum = values.elements(); while (valuesEnum.hasMoreElements()) { String currentElement = (String) valuesEnum.nextElement(); StringBuffer currentOutput = new StringBuffer(); currentOutput.append(key); currentOutput.append("="); currentOutput.append(currentElement); theWrtr.println(currentOutput.toString()); } } } theWrtr.println(); theWrtr.flush(); } } }
From source file:org.agnitas.web.MailingComponentsAction.java
/** * Saves components.//from ww w. java2 s .c o m */ protected boolean saveComponent(MailingComponentsForm aForm, HttpServletRequest req) { MailingComponent aComp = null; Vector<MailingComponent> deleteEm = new Vector<MailingComponent>(); Mailing aMailing = mailingDao.getMailing(aForm.getMailingID(), this.getCompanyID(req)); addUploadedImage(aForm, aMailing, req, null); Iterator<MailingComponent> it = aMailing.getComponents().values().iterator(); while (it.hasNext()) { aComp = it.next(); switch (aComp.getType()) { case MailingComponent.TYPE_IMAGE: if (AgnUtils.parameterNotEmpty(req, "update" + aComp.getId())) { aComp.loadContentFromURL(); } break; case MailingComponent.TYPE_HOSTED_IMAGE: if (AgnUtils.parameterNotEmpty(req, "delete" + aComp.getId())) { deleteEm.add(aComp); if (AgnUtils.isProjectEMM()) { MailingComponent amComponent = componentDao.getMailingComponentByName(aComp.getMailingID(), aComp.getCompanyID(), aComp.getComponentName()); componentDao.deleteMailingComponent(amComponent); } } break; } } Enumeration<MailingComponent> en = deleteEm.elements(); while (en.hasMoreElements()) { aMailing.getComponents().remove(en.nextElement().getComponentName()); } mailingDao.saveMailing(aMailing); if (deleteEm.size() == 0) { return true; } else { return false; } }
From source file:edu.ku.brc.specify.config.Scriptlet.java
/** * Creates a formated label from a given datasource * @param dataSource the WorkbenchJRDataSource * @return label string value/*from w w w . ja v a2 s . c om*/ */ public String formatDetermination(Object dataSource) { String label = new String(); String data = new String(); String styleInfo = new String(); if (dataSource instanceof WorkbenchJRDataSource) { WorkbenchJRDataSource rowDataSource = (WorkbenchJRDataSource) dataSource; String isCurrent1 = rowDataSource.getFieldValue("isCurrent1").toString(); String isCurrent2 = rowDataSource.getFieldValue("isCurrent2").toString(); //assume 1 if isCurrent has no value if ((isCurrent1.equals("true")) || ((isCurrent1.equals("")) && (isCurrent2.equals("")))) { Vector<String> labelNames = isCurrent1Labels(); //create label for (Enumeration<?> e = labelNames.elements(); e.hasMoreElements();) { data = rowDataSource.getFieldValue((String) e.nextElement()).toString(); try { if (StringUtils.isNotEmpty(data)) { styleInfo = (String) e.nextElement(); //if there is specific style info if (styleInfo.startsWith("<style")) { label = label.concat(styleInfo + StringEscapeUtils.escapeHtml(data) + " </style>"); } else //no style { label = label.concat(styleInfo + data + " "); } } } catch (NoSuchElementException ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(Scriptlet.class, ex); log.error(ex); return label; } } } else if (isCurrent2.equals("true"))//use isCurrent 2 values { Vector<String> labelNames = isCurrent2Labels(); //create label for (Enumeration<?> e = labelNames.elements(); e.hasMoreElements();) { data = rowDataSource.getFieldValue((String) e.nextElement()).toString(); try { if (StringUtils.isNotEmpty(data)) { styleInfo = (String) e.nextElement(); //if there is specific style info if (styleInfo.startsWith("<style")) { label = label.concat(styleInfo + data + " </style>"); } else //no style { label = label.concat(styleInfo + data + " "); } } } catch (NoSuchElementException ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(Scriptlet.class, ex); log.error(ex); return label; } } } } //else return label; }
From source file:org.osaf.caldav4j.CalDAVCalendarCollection.java
/** * Returns all the ticket ID's from all tickets the requesting user has * permision to view on a resource.//from w w w. ja va 2 s . c om * * @param httpClient the httpClient which will make the request * @param relativePath the path, relative to the collection path for which * to get the tickets * @return * @throws CalDAV4JException * @throws HttpException * @throws IOException */ public List<String> getTicketsIDs(HttpClient httpClient, String relativePath) throws CalDAV4JException, HttpException, IOException { Vector<PropertyName> properties = new Vector<PropertyName>(); PropertyName ticketDiscoveryProperty = new PropertyName(CalDAVConstants.NS_XYTHOS, CalDAVConstants.ELEM_TICKETDISCOVERY); PropertyName ownerProperty = new PropertyName(CalDAVConstants.NS_DAV, "owner"); properties.add(ticketDiscoveryProperty); properties.add(ownerProperty); PropFindMethod propFindMethod = methodFactory.createPropFindMethod(); propFindMethod.setDepth(0); propFindMethod.setType(0); propFindMethod.setPath(getAbsolutePath(relativePath)); propFindMethod.setPropertyNames(properties.elements()); httpClient.executeMethod(hostConfiguration, propFindMethod); int statusCode = propFindMethod.getStatusCode(); if (statusCode != CaldavStatus.SC_MULTI_STATUS) { throw new CalDAV4JException("PropFind Failed with Status: " + statusCode + " and body: \n" + propFindMethod.getResponseBodyAsString()); } String href = getHref(getAbsolutePath(relativePath)); Enumeration responses = propFindMethod.getResponseProperties(href); List<String> ticketIDList = new ArrayList<String>(); while (responses.hasMoreElements()) { org.apache.webdav.lib.Property item = (org.apache.webdav.lib.Property) responses.nextElement(); if (item.getLocalName().equals(CalDAVConstants.ELEM_TICKETDISCOVERY)) { TicketDiscoveryProperty ticketDiscoveryProp = (TicketDiscoveryProperty) item; ticketIDList.addAll(ticketDiscoveryProp.getTicketIDs()); } } return ticketIDList; }