Example usage for java.util Hashtable values

List of usage examples for java.util Hashtable values

Introduction

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

Prototype

Collection values

To view the source code for java.util Hashtable values.

Click Source Link

Usage

From source file:edu.csun.ecs.cs.multitouchj.ui.graphic.WindowManagerCalibratorDefault.java

@Override
protected void presentCalibrationTarget(Position position) {
    Size displaySize = getDisplaySize();
    Size controlSize = getControlSize();

    Point controlPosition = new Point();
    Point destinationPosition = new Point();
    if (Position.TopLeft.equals(position)) {
        controlPosition.set((controlSize.getWidth() / 2.0f), (controlSize.getHeight() / 2.0f));
        destinationPosition.set((controlSize.getWidth() / 2.0f), (controlSize.getHeight() / 2.0f));
    } else if (Position.TopRight.equals(position)) {
        controlPosition.set((displaySize.getWidth() - (controlSize.getWidth() / 2.0f)),
                (controlSize.getHeight() / 2.0f));
        destinationPosition.set((displaySize.getWidth() - (controlSize.getWidth() / 2.0f)),
                (controlSize.getHeight() / 2.0f));
    } else if (Position.BottomRight.equals(position)) {
        controlPosition.set((displaySize.getWidth() - (controlSize.getWidth() / 2.0f)),
                (displaySize.getHeight() - (controlSize.getHeight() / 2.0f)));
        destinationPosition.set((displaySize.getWidth() - (controlSize.getWidth() / 2.0f)),
                (displaySize.getHeight() - (controlSize.getHeight() / 2.0f)));
    } else {//from w w w .j  a v a 2 s. co m
        controlPosition.set((controlSize.getWidth() / 2.0f),
                (displaySize.getHeight() - (controlSize.getHeight() / 2.0f)));
        destinationPosition.set((controlSize.getWidth() / 2.0f),
                (displaySize.getHeight() - (controlSize.getHeight() / 2.0f)));
    }

    getDestinationPositions().put(position, new Point(destinationPosition));

    Hashtable<String, TexturedControl> targetControls = controls.get(position);
    for (TexturedControl control : targetControls.values()) {
        control.setPosition(controlPosition);
    }
    targetControls.get(URI_IMAGE_WAITING).setVisible(true);
}

From source file:edu.ku.brc.ui.skin.SkinsMgr.java

/**
 * @return// www.  j  a  v a2s  .c o m
 */
public List<Skin> getSkinList() {
    List<Skin> skinsList = new Vector<Skin>();

    if (hasSkins) {
        Hashtable<String, Skin> skinHash = load();
        skinsList.addAll(skinHash.values());
        Collections.sort(skinsList);
    }

    return skinsList;
}

From source file:org.hdiv.web.multipart.HDIVMultipartResolver.java

/**
 * Return the multipart files as Map of field name to MultipartFile instance.
 *//* w  w w .j a v a 2  s  . co  m*/
public Collection<MultipartFile> getMultipartFileValues(Hashtable fileElements) {

    Collection<MultipartFile> multipartFileValues = new ArrayList<MultipartFile>();
    multipartFileValues.addAll(fileElements.values());

    return multipartFileValues;
}

From source file:com.openmeap.http.FileHandlingHttpRequestExecuterImpl.java

@Override
public HttpResponse postData(String url, Hashtable getParams, Hashtable postParams)
        throws HttpRequestException {

    // test to determine whether this is a file upload or not.
    Boolean isFileUpload = false;
    for (Object o : postParams.values()) {
        if (o instanceof File) {
            isFileUpload = true;//w  w w  .j av  a  2  s.  co  m
            break;
        }
    }

    if (isFileUpload) {
        try {
            HttpPost httpPost = new HttpPost(createUrl(url, getParams));

            httpPost.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);

            MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);

            for (Object o : postParams.entrySet()) {
                Map.Entry<String, Object> entry = (Map.Entry<String, Object>) o;

                if (entry.getValue() instanceof File) {

                    // For File parameters
                    File file = (File) entry.getValue();
                    FileNameMap fileNameMap = URLConnection.getFileNameMap();
                    String type = fileNameMap.getContentTypeFor(file.toURL().toString());

                    entity.addPart(entry.getKey(), new FileBody(((File) entry.getValue()), type));
                } else {

                    // For usual String parameters
                    entity.addPart(entry.getKey(), new StringBody(entry.getValue().toString(), "text/plain",
                            Charset.forName(FormConstants.CHAR_ENC_DEFAULT)));
                }
            }

            httpPost.setEntity(entity);

            return execute(httpPost);
        } catch (Exception e) {
            throw new HttpRequestException(e);
        }
    } else {

        return super.postData(url, getParams, postParams);
    }
}

From source file:org.apache.axis.providers.BasicProvider.java

public String[] getOperationNames() {
    Hashtable operations = (Hashtable) getOption("Operations");
    if (operations == null)
        return null;
    Object[] values = operations.values().toArray();
    String[] names = new String[values.length];
    System.arraycopy(values, 0, names, 0, values.length);
    return names;
}

From source file:helma.swarm.SwarmSessionManager.java

public void setState(byte[] bytes) {
    if (bytes != null) {
        try {//from www.ja  v a2  s .  com
            Hashtable map = (Hashtable) bytesToObject(bytes);
            Iterator it = map.values().iterator();
            while (it.hasNext()) {
                SwarmSession session = (SwarmSession) it.next();
                session.setApp(app);
                session.sessionMgr = SwarmSessionManager.this;
            }
            sessions = map;
            if (debug) {
                log.debug("Received session map: " + map);
            }
        } catch (Exception x) {
            log.error("Error in setState()", x);
        }
    }
}

From source file:edu.ku.brc.specify.tasks.subpane.security.PrefsPermissionEnumerator.java

/**
 * Loads the Prefs and the Default Permissions from XML.
 *//*from   ww  w  .j ava  2s  .  co m*/
protected void loadPrefs() {
    prefOptions = new ArrayList<SecurityOptionIFace>();
    try {
        Element root = XMLHelper.readDOMFromConfigDir("prefs_init.xml"); //$NON-NLS-1$
        if (root != null) {
            Hashtable<String, Hashtable<String, PermissionOptionPersist>> mainHash = BaseTask
                    .readDefaultPermsFromXML("prefsperms.xml");

            Node prefsNode = root.selectSingleNode("/prefs");
            String i18NResourceName = getAttr((Element) prefsNode, "i18nresname", (String) null);
            ResourceBundle resBundle = null;

            if (StringUtils.isNotEmpty(i18NResourceName)) {
                resBundle = UIRegistry.getResourceBundle(i18NResourceName);
            }

            List<?> sections = root.selectNodes("/prefs/section/pref"); //$NON-NLS-1$
            for (Iterator<?> iter = sections.iterator(); iter.hasNext();) {
                org.dom4j.Element pref = (org.dom4j.Element) iter.next();

                String name = getAttr(pref, "name", null);
                String title = getAttr(pref, "title", null);
                String iconName = getAttr(pref, "icon", null);

                if (StringUtils.isNotEmpty(name)) {
                    if (resBundle != null) {
                        try {
                            title = resBundle.getString(title);

                        } catch (MissingResourceException ex) {
                            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                            edu.ku.brc.exceptions.ExceptionTracker.getInstance()
                                    .capture(PrefsPermissionEnumerator.class, ex);
                            //log.error("Couldn't find key["+title+"]"); 
                        }
                    }

                    SecurityOption securityOption = new SecurityOption(name, title, "Prefs", iconName);
                    prefOptions.add(securityOption);

                    if (mainHash != null) {
                        Hashtable<String, PermissionOptionPersist> hash = mainHash.get(name);
                        if (hash != null) {
                            for (PermissionOptionPersist pp : hash.values()) {
                                PermissionIFace defPerm = pp.getDefaultPerms();
                                securityOption.addDefaultPerm(pp.getUserType(), defPerm);
                            }
                        }
                    }
                }
            }
        }
    } catch (Exception ex) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(PrefsPermissionEnumerator.class, ex);
        ex.printStackTrace();
    }
}

From source file:com.flexive.faces.FxJsfUtils.java

/**
 * Gets all faces messages grouped by a equal summary and wrapped as
 * FxFacesMessage (which gives access to the clientId). In case of a grouped message
 * the details of the original FacesMessage can be retrieved by calling getDetails() of
 * the FxFacesMessage.//  ww  w  .ja v  a 2  s  . c  o  m
 *
 * @return a array holding all (grouped) messages
 */
public static List<FxFacesMessages> getGroupedFxMessages() {
    ArrayList<FxFacesMessage> ffm = getFxMessages();
    Hashtable<String, FxFacesMessages> grouped = new Hashtable<String, FxFacesMessages>(ffm.size());
    for (FxFacesMessage msg : ffm) {
        String key = msg.getSeverity() + ":" + msg.getSummary();
        FxFacesMessages exists = grouped.get(key);
        if (exists != null) {
            exists.addMessage(msg);
        } else {
            grouped.put(key, new FxFacesMessages(msg.getSummary(), msg.getSeverity(), msg));
        }
    }
    return new ArrayList<FxFacesMessages>(grouped.values());
}

From source file:net.timbusproject.extractors.rpmsoftwareextractor.Engine.java

private JSONObject extractInstalledPackages()
        throws JSchException, InterruptedException, JSONException, IOException {
    if (isSsh()) {
        log.info("Connecting to " + sshManager.getHost() + ":" + sshManager.getPort() + "...");
        try {/* w  w  w .j ava 2  s . c o  m*/
            sshManager.connect();
        } catch (JSchException e) {
            log.error("Connection failed.");
            throw e;
        }
    }
    log.info("Starting installed packages extraction...");

    if (((ch.qos.logback.classic.Logger) log).getLevel().equals(Level.INFO))
        log.info("Extracting...");
    log.debug("Extracting installed packages...");
    Hashtable<String, JSONObject> table = extractAllRpmPackages();
    log.debug("Extracting installers...");
    extractInstallers(table);
    JSONObject extraction = newExtraction(table.values());

    log.info("Extraction finished.");
    if (isSsh()) {
        log.info("Closing connection from " + sshManager.getHost() + ":" + sshManager.getPort() + "...");
        sshManager.disconnect();
    }

    return extraction;
}

From source file:cgview.java

private CompressionStream getStream(Scene scene) {
    Hashtable objs = scene.getNamedObjects();
    Shape3D shapes[] = new Shape3D[objs.size()];

    objs.values().toArray(shapes);
    return new CompressionStream(positionQuant, colorQuant, normalQuant, shapes);
}