Exemplo n.º 1
0
 public static Hashtable ToHashtable(java.util.Map map)
 {
     if(map == null) return null;
     Hashtable table = new Hashtable();
     java.util.Iterator it = map.keySet().iterator();
     while(it.hasNext())
     {
         string key = (string)it.next();
         object val = map.get(key);
         table[key] = val;
     }
     return table;
 }
Exemplo n.º 2
0
		static internal java.util.Map DeriveStyle(java.util.Map attribs, FontStyle style, bool createNew) {
			java.util.Map newAttribs;
			if (createNew) {
				newAttribs = new java.util.Hashtable( attribs.size() );
				java.util.Iterator it = attribs.keySet().iterator();
				while (it.hasNext ()) {
					object key = it.next ();
					object value = attribs.get (key);
					if (value != null)
						newAttribs.put (key, value);
				}
			}
			else
				newAttribs = attribs;

			//Bold
			if((style & FontStyle.Bold) == FontStyle.Bold)
				newAttribs.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
			else
				newAttribs.remove(TextAttribute.WEIGHT);

			//Italic
			if((style & FontStyle.Italic) == FontStyle.Italic)
				newAttribs.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
			else
				newAttribs.put(TextAttribute.POSTURE, TextAttribute.POSTURE_REGULAR);

			//Underline
			if((style & FontStyle.Underline) == FontStyle.Underline)
				newAttribs.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
			else
				newAttribs.remove(TextAttribute.UNDERLINE);

			//Strikeout
			if((style & FontStyle.Strikeout) == FontStyle.Strikeout)
				newAttribs.put(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON);
			else
				newAttribs.remove(TextAttribute.STRIKETHROUGH);

			return newAttribs;
		}
 /**
  * Copies all of the keys and values from the specified map to this map.
  * Each key must be non-null and a MultiKey object.
  *
  * @param mapToCopy  to this map
  * @throws NullPointerException if the mapToCopy or any key within is null
  * @throws ClassCastException if any key in mapToCopy is not a MultiKey
  */
 public void putAll(java.util.Map<Object, Object> mapToCopy)
 {
     for (java.util.Iterator<Object> it = mapToCopy.keySet().iterator(); it.hasNext(); )
     {
         Object key = it.next();
         checkKey(key);
     }
     map.putAll(mapToCopy);
 }