From: <ha...@us...> - 2013-03-07 13:57:09
|
Revision: 17964 http://jmol.svn.sourceforge.net/jmol/?rev=17964&view=rev Author: hansonr Date: 2013-03-07 13:56:59 +0000 (Thu, 07 Mar 2013) Log Message: ----------- JSmol resizeApplet; Short.valueOf Modified Paths: -------------- trunk/Jmol/src/org/jmol/export/_ObjExporter.java trunk/Jmol/src/org/jmol/viewer/StatusManager.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/export/_ObjExporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/_ObjExporter.java 2013-03-03 14:10:43 UTC (rev 17963) +++ trunk/Jmol/src/org/jmol/export/_ObjExporter.java 2013-03-07 13:56:59 UTC (rev 17964) @@ -192,7 +192,7 @@ // Ignore ptX and pyY as they are passed null from __CartesianExporter.draw if (debug) { debugPrint("outputCylinder: colix=" - + String.format("%04x", new Short(colix))); + + String.format("%04x", Short.valueOf(colix))); debugPrint(" ptCenter=" + ptCenter); debugPrint(" pt1=" + pt1); debugPrint(" endcaps=" + endcaps + " NONE=" + GData.ENDCAPS_NONE @@ -236,7 +236,7 @@ protected void outputEllipsoid(P3 center, P3[] points, short colix) { if (debug) { debugPrint("outputEllipsoid: colix=" - + String.format("%04x", new Short(colix))); + + String.format("%04x", Short.valueOf(colix))); debugPrint(" center=" + center); debugPrint(" points[0]=" + points[0]); debugPrint(" points[1]=" + points[1]); @@ -265,7 +265,7 @@ // Atom extends Point3fi extends Point3f, so this may be passed an Atom if (debug) { debugPrint("outputSphere: colix=" - + String.format("%04x", new Short(colix))); + + String.format("%04x", Short.valueOf(colix))); debugPrint(" center.getClass().getName()=" + center.getClass().getName()); debugPrint(" center=" + center); debugPrint(" center.x=" + center.x); @@ -860,7 +860,7 @@ * @param name TODO */ private void addTexture(short colix, String name) { - Short scolix = new Short(colix); + Short scolix = Short.valueOf(colix); if (name == null && textures.contains(scolix)) { return; } Modified: trunk/Jmol/src/org/jmol/viewer/StatusManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/StatusManager.java 2013-03-03 14:10:43 UTC (rev 17963) +++ trunk/Jmol/src/org/jmol/viewer/StatusManager.java 2013-03-07 13:56:59 UTC (rev 17964) @@ -28,14 +28,14 @@ import org.jmol.util.P3; import org.jmol.util.TextFormat; -//import org.jmol.util.List; +import org.jmol.util.JmolList; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.Hashtable; import java.util.List; +//import java.util.List; import java.util.Map; @@ -185,8 +185,8 @@ * */ - private Map<String, List<List<Object>>> messageQueue = new Hashtable<String, List<List<Object>>>(); - Map<String, List<List<Object>>> getMessageQueue() { + private Map<String, JmolList<JmolList<Object>>> messageQueue = new Hashtable<String, JmolList<JmolList<Object>>>(); + Map<String, JmolList<JmolList<Object>>> getMessageQueue() { return messageQueue; } @@ -204,20 +204,20 @@ int intInfo, Object statusInfo, boolean isReplace) { if (!recordStatus(statusName)) return; - List<Object> msgRecord = new ArrayList<Object>(); - msgRecord.add(Integer.valueOf(++statusPtr)); - msgRecord.add(statusName); - msgRecord.add(Integer.valueOf(intInfo)); - msgRecord.add(statusInfo); - List<List<Object>> statusRecordSet = (isReplace ? null : messageQueue.get(statusName)); + JmolList<Object> msgRecord = new JmolList<Object>(); + msgRecord.addLast(Integer.valueOf(++statusPtr)); + msgRecord.addLast(statusName); + msgRecord.addLast(Integer.valueOf(intInfo)); + msgRecord.addLast(statusInfo); + JmolList<JmolList<Object>> statusRecordSet = (isReplace ? null : messageQueue.get(statusName)); if (statusRecordSet == null) - messageQueue.put(statusName, statusRecordSet = new ArrayList<List<Object>>()); + messageQueue.put(statusName, statusRecordSet = new JmolList<JmolList<Object>>()); else if (statusRecordSet.size() == MAXIMUM_QUEUE_LENGTH) statusRecordSet.remove(0); - statusRecordSet.add(msgRecord); + statusRecordSet.addLast(msgRecord); } - synchronized List<List<List<Object>>> getStatusChanged( + synchronized List<JmolList<JmolList<Object>>> getStatusChanged( String newStatusList) { /* * returns a Vector of statusRecordSets, one per status type, @@ -248,10 +248,10 @@ Logger.debug("StatusManager messageQueue = " + statusList); } } - Collection<List<List<Object>>> m = messageQueue.values(); - Enumeration<List<List<Object>>> e = Collections.enumeration(m); - List<List<List<Object>>> msgList = (getList ? Collections.list(e) - : new ArrayList<List<List<Object>>>()); + Collection<JmolList<JmolList<Object>>> m = messageQueue.values(); + Enumeration<JmolList<JmolList<Object>>> e = Collections.enumeration(m); + List<JmolList<JmolList<Object>>> msgList = (getList ? Collections.list(e) + : new JmolList<JmolList<JmolList<Object>>>()); messageQueue.clear(); statusPtr = 0; return msgList; Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2013-03-03 14:10:43 UTC (rev 17963) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2013-03-07 13:56:59 UTC (rev 17964) @@ -602,6 +602,12 @@ stateManager.setJmolDefaults(); } + public void setDisplay(Object canvas) { + // used in JavaScript when a canvas is resized + display = canvas; + apiPlatform.setViewer(this, canvas); + } + private JmolScriptManager getScriptManager() { if (allowScripting && scriptManager == null) { scriptManager = (JmolScriptManager) Interface.getOptionInterface("viewer.ScriptManager"); @@ -4999,12 +5005,12 @@ statusManager.setJmolStatusListener(jmolStatusListener, null); } - public Map<String, List<List<Object>>> getMessageQueue() { + public Map<String, JmolList<JmolList<Object>>> getMessageQueue() { // called by PropertyManager.getPropertyAsObject for "messageQueue" return statusManager.getMessageQueue(); } - List<List<List<Object>>> getStatusChanged(String statusNameList) { + List<JmolList<JmolList<Object>>> getStatusChanged(String statusNameList) { return statusManager.getStatusChanged(statusNameList); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |