bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
public void next() { pause(); playingIndex--; play(); }
public void next() { pause(); playingIndex++; play(); }
1,119,147
public void pause() { if (player != null) { player.close(); try { stream.close(); } catch (Exception exc) { exc.printStackTrace(); } } }
public synchronized void pause() { if (player != null) { player.close(); try { stream.close(); } catch (Exception exc) { exc.printStackTrace(); } } }
1,119,148
public void pause() { if (player != null) { player.close(); try { stream.close(); } catch (Exception exc) { exc.printStackTrace(); } } }
public void pause() { if (player != null) { player.close(); try { stream.close(); } catch (Exception exc) { exc.printStackTrace(); } } }
1,119,149
public void play() { try { int playListSize = playList.size(); if (playListSize == 0) { return; } if (playingIndex == -1) { playingIndex = 0; } if (playingIndex >= playListSize) { playingIndex %= playListSize; } File file = (File)playList.get(playingIndex); stream = new FileInputStream(file); player = new Player(stream); player.play(); } catch (Exception exc) { exc.printStackTrace(); ExceptionDialog.show(exc); } }
public synchronized void play() { try { int playListSize = playList.size(); if (playListSize == 0) { return; } if (playingIndex == -1) { playingIndex = 0; } if (playingIndex >= playListSize) { playingIndex %= playListSize; } File file = (File)playList.get(playingIndex); stream = new FileInputStream(file); player = new Player(stream); player.play(); } catch (Exception exc) { exc.printStackTrace(); ExceptionDialog.show(exc); } }
1,119,150
public void play() { try { int playListSize = playList.size(); if (playListSize == 0) { return; } if (playingIndex == -1) { playingIndex = 0; } if (playingIndex >= playListSize) { playingIndex %= playListSize; } File file = (File)playList.get(playingIndex); stream = new FileInputStream(file); player = new Player(stream); player.play(); } catch (Exception exc) { exc.printStackTrace(); ExceptionDialog.show(exc); } }
public void play() { try { int playListSize = playList.size(); if (playListSize == 0) { return; } if (playingIndex < 0) { playingIndex = 0; } if (playingIndex >= playListSize) { playingIndex %= playListSize; } File file = (File)playList.get(playingIndex); stream = new FileInputStream(file); player = new Player(stream); player.play(); } catch (Exception exc) { exc.printStackTrace(); ExceptionDialog.show(exc); } }
1,119,151
public void play() { try { int playListSize = playList.size(); if (playListSize == 0) { return; } if (playingIndex == -1) { playingIndex = 0; } if (playingIndex >= playListSize) { playingIndex %= playListSize; } File file = (File)playList.get(playingIndex); stream = new FileInputStream(file); player = new Player(stream); player.play(); } catch (Exception exc) { exc.printStackTrace(); ExceptionDialog.show(exc); } }
public void play() { try { int playListSize = playList.size(); if (playListSize == 0) { return; } if (playingIndex == -1) { playingIndex = 0; } if (playingIndex >= playListSize) { playingIndex %= playListSize; } File file = (File)playList.get(playingIndex); stream = new FileInputStream(file); player = new Player(stream); Thread t = new Thread() { public void run() { try { player.play(); if (player.isComplete()) { next(); } } catch (Exception exc) { exc.printStackTrace(); ExceptionDialog.show(exc); } } }; t.setDaemon(true); t.start(); } catch (Exception exc) { exc.printStackTrace(); ExceptionDialog.show(exc); } }
1,119,152
public void prev() { pause(); playingIndex++; play(); }
public synchronized void prev() { pause(); playingIndex++; play(); }
1,119,153
public void prev() { pause(); playingIndex++; play(); }
public void prev() { pause(); playingIndex--; play(); }
1,119,154
public void addUser(BwUser user) throws CalFacadeException { checkOpen(); user.setCategoryAccess(access.getDefaultPersonalAccess()); user.setLocationAccess(access.getDefaultPersonalAccess()); user.setSponsorAccess(access.getDefaultPersonalAccess()); user.setQuota(getSyspars().getDefaultUserQuota()); sess.save(user); /* Add a user collection to the userCalendarRoot and then a default calendar collection. */ sess.namedQuery("getCalendarByPath"); String path = "/" + getSyspars().getUserCalendarRoot(); sess.setString("path", path); BwCalendar userrootcal = (BwCalendar)sess.getUnique(); if (userrootcal == null) { throw new CalFacadeException("No user root at " + path); } path += "/" + user.getAccount(); sess.namedQuery("getCalendarByPath"); sess.setString("path", path); BwCalendar usercal = (BwCalendar)sess.getUnique(); if (usercal != null) { throw new CalFacadeException("User calendar already exists at " + path); } /* Create a folder for the user */ usercal = new BwCalendar(); usercal.setName(user.getAccount()); usercal.setCreator(user); usercal.setOwner(user); usercal.setPublick(false); usercal.setPath(path); usercal.setCalendar(userrootcal); userrootcal.addChild(usercal); sess.save(userrootcal); /* Create a default calendar */ BwCalendar cal = new BwCalendar(); cal.setName(getSyspars().getUserDefaultCalendar()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserDefaultCalendar()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the trash calendar */ cal = new BwCalendar(); cal.setName(getSyspars().getDefaultTrashCalendar()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getDefaultTrashCalendar()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the inbox */ cal = new BwCalendar(); cal.setName(getSyspars().getUserInbox()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserInbox()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the outbox */ cal = new BwCalendar(); cal.setName(getSyspars().getUserOutbox()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserOutbox()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); sess.save(usercal); sess.save(user); }
public void addUser(BwUser user) throws CalFacadeException { checkOpen(); user.setCategoryAccess(access.getDefaultPersonalAccess()); user.setLocationAccess(access.getDefaultPersonalAccess()); user.setSponsorAccess(access.getDefaultPersonalAccess()); user.setQuota(getSyspars().getDefaultUserQuota()); sess.update(user); /* Add a user collection to the userCalendarRoot and then a default calendar collection. */ sess.namedQuery("getCalendarByPath"); String path = "/" + getSyspars().getUserCalendarRoot(); sess.setString("path", path); BwCalendar userrootcal = (BwCalendar)sess.getUnique(); if (userrootcal == null) { throw new CalFacadeException("No user root at " + path); } path += "/" + user.getAccount(); sess.namedQuery("getCalendarByPath"); sess.setString("path", path); BwCalendar usercal = (BwCalendar)sess.getUnique(); if (usercal != null) { throw new CalFacadeException("User calendar already exists at " + path); } /* Create a folder for the user */ usercal = new BwCalendar(); usercal.setName(user.getAccount()); usercal.setCreator(user); usercal.setOwner(user); usercal.setPublick(false); usercal.setPath(path); usercal.setCalendar(userrootcal); userrootcal.addChild(usercal); sess.save(userrootcal); /* Create a default calendar */ BwCalendar cal = new BwCalendar(); cal.setName(getSyspars().getUserDefaultCalendar()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserDefaultCalendar()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the trash calendar */ cal = new BwCalendar(); cal.setName(getSyspars().getDefaultTrashCalendar()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getDefaultTrashCalendar()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the inbox */ cal = new BwCalendar(); cal.setName(getSyspars().getUserInbox()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserInbox()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the outbox */ cal = new BwCalendar(); cal.setName(getSyspars().getUserOutbox()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserOutbox()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); sess.save(usercal); sess.update(user); }
1,119,155
private void logon(BwUser val) throws CalFacadeException { checkOpen(); Timestamp now = new Timestamp(System.currentTimeMillis()); val.setLogon(now); val.setLastAccess(now); sess.saveOrUpdate(val); }
private void logon(BwUser val) throws CalFacadeException { checkOpen(); Timestamp now = new Timestamp(System.currentTimeMillis()); val.setLogon(now); val.setLastAccess(now); sess.update(val); }
1,119,156
public BwOwnedDbentity(BwUser owner, boolean publick) { super(); this.owner = owner; this.publick = publick; }
public BwOwnedDbentity(BwUser owner, boolean publick) { super(); this.owner = owner; this.publick = publick; }
1,119,158
public BwOwnedDbentity(BwUser owner, boolean publick) { super(); this.owner = owner; this.publick = publick; }
public BwOwnedDbentity(BwUser owner, boolean publick) { super(); this.owner = owner; this.publick = publick; }
1,119,159
private void addProp(Vector v, QName tag, Object val) { if (val != null) { v.addElement(new WebdavProperty(tag, String.valueOf(val))); } }
private void addProp(Collection c, QName tag, Object val) { if (val != null) { v.addElement(new WebdavProperty(tag, String.valueOf(val))); } }
1,119,160
private void addProp(Vector v, QName tag, Object val) { if (val != null) { v.addElement(new WebdavProperty(tag, String.valueOf(val))); } }
private void addProp(Vector v, QName tag, Object val) { if (val != null) { c.add(new WebdavProperty(tag, String.valueOf(val))); } }
1,119,161
public void renderToGraphics(Graphics g, Dimension size) { PRINTING = true; boolean allHere = true; long totalWait = 0; Iterator seisIt = iterator(DrawableSeismogram.class); while(seisIt.hasNext()){ DrawableSeismogram cur = (DrawableSeismogram)seisIt.next(); if(cur.getDataStatus() == SeismogramContainer.GETTING_DATA){ cur.getData(); allHere = false; } } while(!allHere && totalWait < TWO_MIN){ seisIt = iterator(DrawableSeismogram.class); while(seisIt.hasNext()){ DrawableSeismogram cur = (DrawableSeismogram)seisIt.next(); if(cur.getDataStatus() == SeismogramContainer.GETTING_DATA){ try { Thread.sleep(100); totalWait += 100; if(totalWait%10000 == 0 && totalWait != 0){ logger.debug("Waiting for data to show before rendering. We've waited " + totalWait + " millis"); } } catch (InterruptedException e) {} break; } } logger.debug("Rendering to graphics after waiting " + totalWait + " millis for data to arrive"); allHere = true; } if(totalWait >= TWO_MIN){ logger.debug("GAVE UP WAITING ON DATA TO RENDER TO GRAPHICS! SOMEONE IS LYING OR REALLY REALLY SLOW! OR BOTH!!"); } super.renderToGraphics(g, size); PRINTING = false; }
public void renderToGraphics(Graphics g, Dimension size) { PRINTING = true; boolean allHere = true; long totalWait = 0; Iterator seisIt = iterator(DrawableSeismogram.class); while(seisIt.hasNext()){ DrawableSeismogram cur = (DrawableSeismogram)seisIt.next(); if(cur.getDataStatus() == SeismogramContainer.GETTING_DATA){ cur.getData(); allHere = false; } } while(!allHere && totalWait < TWO_MIN){ seisIt = iterator(DrawableSeismogram.class); while(seisIt.hasNext()){ DrawableSeismogram cur = (DrawableSeismogram)seisIt.next(); if(cur.getDataStatus() == SeismogramContainer.GETTING_DATA){ try { Thread.sleep(100); totalWait += 100; if(totalWait%10000 == 0 && totalWait != 0){ logger.debug("Waiting for data to show before rendering. We've waited " + totalWait + " millis"); } } catch (InterruptedException e) {} allHere = false; } } logger.debug("Rendering to graphics after waiting " + totalWait + " millis for data to arrive"); allHere = true; } if(totalWait >= TWO_MIN){ logger.debug("GAVE UP WAITING ON DATA TO RENDER TO GRAPHICS! SOMEONE IS LYING OR REALLY REALLY SLOW! OR BOTH!!"); } super.renderToGraphics(g, size); PRINTING = false; }
1,119,162
public void renderToGraphics(Graphics g, Dimension size) { PRINTING = true; boolean allHere = true; long totalWait = 0; Iterator seisIt = iterator(DrawableSeismogram.class); while(seisIt.hasNext()){ DrawableSeismogram cur = (DrawableSeismogram)seisIt.next(); if(cur.getDataStatus() == SeismogramContainer.GETTING_DATA){ cur.getData(); allHere = false; } } while(!allHere && totalWait < TWO_MIN){ seisIt = iterator(DrawableSeismogram.class); while(seisIt.hasNext()){ DrawableSeismogram cur = (DrawableSeismogram)seisIt.next(); if(cur.getDataStatus() == SeismogramContainer.GETTING_DATA){ try { Thread.sleep(100); totalWait += 100; if(totalWait%10000 == 0 && totalWait != 0){ logger.debug("Waiting for data to show before rendering. We've waited " + totalWait + " millis"); } } catch (InterruptedException e) {} break; } } logger.debug("Rendering to graphics after waiting " + totalWait + " millis for data to arrive"); allHere = true; } if(totalWait >= TWO_MIN){ logger.debug("GAVE UP WAITING ON DATA TO RENDER TO GRAPHICS! SOMEONE IS LYING OR REALLY REALLY SLOW! OR BOTH!!"); } super.renderToGraphics(g, size); PRINTING = false; }
public void renderToGraphics(Graphics g, Dimension size) { PRINTING = true; boolean allHere = true; long totalWait = 0; Iterator seisIt = iterator(DrawableSeismogram.class); while(seisIt.hasNext()){ DrawableSeismogram cur = (DrawableSeismogram)seisIt.next(); if(cur.getDataStatus() == SeismogramContainer.GETTING_DATA){ cur.getData(); allHere = false; } } while(!allHere && totalWait < TWO_MIN){ seisIt = iterator(DrawableSeismogram.class); while(seisIt.hasNext()){ DrawableSeismogram cur = (DrawableSeismogram)seisIt.next(); if(cur.getDataStatus() == SeismogramContainer.GETTING_DATA){ try { Thread.sleep(100); totalWait += 100; if(totalWait%10000 == 0 && totalWait != 0){ logger.debug("Waiting for data to show before rendering. We've waited " + totalWait + " millis"); } } catch (InterruptedException e) {} break; } } logger.debug("Rendering to graphics after waiting " + totalWait + " millis for data to arrive"); allHere = true; } if(totalWait >= TWO_MIN){ logger.debug("GAVE UP WAITING ON DATA TO RENDER TO GRAPHICS! SOMEONE IS LYING OR REALLY REALLY SLOW! OR BOTH!!"); } super.renderToGraphics(g, size); PRINTING = false; }
1,119,163
public void testPut() throws CodecException { Plottable plottable = createPlottable(); JDBCPlottable jdbcPlot = new JDBCPlottable(ConnMgr.createConnection(), new Properties()); int dbid = jdbcPlot.put(plottable); Plottable out = jdbcPlot.get(dbid); }
public void testPut() throws CodecException, SQLException { Plottable plottable = createPlottable(); JDBCPlottable jdbcPlot = new JDBCPlottable(ConnMgr.createConnection(), new Properties()); int dbid = jdbcPlot.put(plottable); Plottable out = jdbcPlot.get(dbid); }
1,119,165
public void testPut() throws CodecException { Plottable plottable = createPlottable(); JDBCPlottable jdbcPlot = new JDBCPlottable(ConnMgr.createConnection(), new Properties()); int dbid = jdbcPlot.put(plottable); Plottable out = jdbcPlot.get(dbid); }
public void testPut() throws CodecException { Plottable plottable = createPlottable(); JDBCPlottable jdbcPlot = new JDBCPlottable(ConnMgr.createConnection(), new Properties()); int dbid = jdbcPlot.put(plottable); Plottable out = jdbcPlot.get(dbid); }
1,119,166
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.fetchSvci(); String name = getReqPar(request, "name"); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "notAdded"; } boolean makeDefaultView = false; String str = getReqPar(request, "makedefaultview"); if (str != null) { makeDefaultView = str.equals("y"); } BwView view = new BwView(); view.setName(name); if (!svc.addView(view, makeDefaultView)) { form.getErr().emit("org.bedework.client.error.viewnotadded"); return "notAdded"; } form.setView(view); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.fetchSvci(); String name = getReqPar(request, "name"); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "notAdded"; } boolean makeDefaultView = false; String str = getReqPar(request, "makedefaultview"); if (str != null) { makeDefaultView = str.equals("y"); } BwView view = new BwView(); view.setName(name); if (!svc.addView(view, makeDefaultView)) { form.getErr().emit("org.bedework.client.error.viewnotadded"); return "notAdded"; } form.setView(view); return "success"; }
1,119,167
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; CalEnv env = getEnv(request, form); setConfig(request, form); setSessionAttr(request, "org.bedework.logprefix", form.retrieveConfig().getLogPrefix()); boolean guestMode = env.getAppBoolProperty("guestmode"); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = getReqPar(request, "adminUserId"); if (temp != null) { adminUserId = temp; } } BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } if (form.getNewSession()) { // Set to default view setView(null, form); } /* Set up ready for the action */ int temp = actionSetup(request, response, form); if (temp != forwardNoAction) { return forwards[temp]; } if (form.getNewSession()) { // Set the default skin BwPreferences prefs = form.fetchSvci().getUserPrefs(); String skinName = prefs.getSkinName(); form.getPresentationState().setSkinName(skinName); form.getPresentationState().setSkinNameSticky(true); } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } if (!getPublicAdmin(form)) { /* Set up or refresh frequently used information, */ getSubscriptions(form); } try { forward = doAction(request, response, s, form); if (!getPublicAdmin(form)) { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noAccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
public String performAction(HttpServletRequest request, HttpServletResponse response, UtilActionForm frm, MessageResources messages) throws Throwable { String forward = "success"; BwActionFormBase form = (BwActionFormBase)frm; String adminUserId = null; CalEnv env = getEnv(request, form); setConfig(request, form); setSessionAttr(request, "org.bedework.logprefix", form.retrieveConfig().getLogPrefix()); boolean guestMode = env.getAppBoolProperty("guestmode"); if (guestMode) { form.assignCurrentUser(null); } else { adminUserId = form.getCurrentAdminUser(); if (adminUserId == null) { adminUserId = form.getCurrentUser(); } } if (getPublicAdmin(form)) { /** We may want to masquerade as a different user */ String temp = getReqPar(request, "adminUserId"); if (temp != null) { adminUserId = temp; } } BwSession s = getState(request, form, messages, adminUserId, getPublicAdmin(form)); if (s == null) { /* An error should have been emitted. The superclass will return an error forward.*/ return forward; } form.setSession(s); form.setGuest(s.isGuest()); if (form.getGuest()) { // force public view on - off by default form.setPublicView(true); } String appBase = form.getAppBase(); if (appBase != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("org.bedework.action.appbase", appBase); } if (form.getNewSession() && !getPublicAdmin(form)) { // Set to default view setView(null, form); } /* Set up ready for the action */ int temp = actionSetup(request, response, form); if (temp != forwardNoAction) { return forwards[temp]; } if (form.getNewSession() && !getPublicAdmin(form)) { // Set the default skin BwPreferences prefs = form.fetchSvci().getUserPrefs(); String skinName = prefs.getSkinName(); form.getPresentationState().setSkinName(skinName); form.getPresentationState().setSkinNameSticky(true); } /* see if we got cancelled */ String reqpar = request.getParameter("cancelled"); if (reqpar != null) { /** Set the objects to null so we get new ones. */ initFields(form); form.getMsg().emit("org.bedework.client.message.cancelled"); return "cancelled"; } if (!getPublicAdmin(form)) { /* Set up or refresh frequently used information, */ getSubscriptions(form); } try { forward = doAction(request, response, s, form); if (!getPublicAdmin(form)) { /* See if we need to refresh */ checkRefresh(form); } } catch (CalFacadeAccessException cfae) { form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); forward="noAccess"; } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); } return forward; }
1,119,168
public void restoreFilter(BwFilter o) throws Throwable { openHibSess(); hibSave(o); closeHibSess(); }
public void restoreFilter(BwFilter o) throws Throwable { openHibSess(); hibSave(o); closeHibSess(); }
1,119,169
private void printInternal(Node node, boolean indentEndMarker) { // is there anything to do? if (node == null) { return; } // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false) { out.print("<?xml version='1.0'"); if (charsetName != null) out.print(" encoding='" + charsetName + "'"); out.println("?>"); wroteXMLDeclaration = true; } int type = node.getNodeType(); boolean hasChildNodes = node.getChildNodes().getLength() > 0; String nodeName = node.getNodeName(); switch (type) { // print document case Node.DOCUMENT_NODE: { NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { printInternal(children.item(iChild), false); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { Element element = (Element)node; if (prettyprint) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } prettyIndent++; } out.print('<'); out.print(nodeName); Map nsMap = new HashMap(); String elPrefix = node.getPrefix(); if (elPrefix != null) { String nsURI = getNamespaceURI(elPrefix, element, rootNode); nsMap.put(elPrefix, nsURI); } Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; String atPrefix = attr.getPrefix(); String atName = attr.getNodeName(); String atValue = normalize(attr.getNodeValue()); if (atPrefix != null && (atPrefix.equals("xmlns") || atPrefix.equals("xml")) == false) { String nsURI = getNamespaceURI(atPrefix, element, rootNode); nsMap.put(atPrefix, nsURI); } // Ignore xmlns='' if (atName.equals("xmlns") && atValue.equals("") == false) out.print(" " + atName + "='" + atValue + "'"); } // Add missing namespace declaration Iterator itPrefix = nsMap.keySet().iterator(); while (itPrefix.hasNext()) { String prefix = (String)itPrefix.next(); String nsURI = (String)nsMap.get(prefix); if (nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); } } if (hasChildNodes) { out.print('>'); } // Find out if the end marker is indented indentEndMarker = isEndMarkerIndented(node); if (indentEndMarker) { out.print('\n'); } NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node childNode = childNodes.item(i); printInternal(childNode, false); } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { printInternal(children.item(i), false); } } } else { out.print('&'); out.print(nodeName); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue())); } else { out.print("<![CDATA["); out.print(node.getNodeValue()); out.print("]]>"); } break; } // print text case Node.TEXT_NODE: { String text = normalize(node.getNodeValue()); if (prettyprint == false || text.trim().length() > 0) out.print(text); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print("<?"); out.print(nodeName); String data = node.getNodeValue(); if (data != null && data.length() > 0) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } out.print("<!--"); String data = node.getNodeValue(); if (data != null) { out.print(data); } out.print("-->"); if (prettyprint) { out.print('\n'); } break; } } if (type == Node.ELEMENT_NODE) { if (prettyprint) prettyIndent--; if (hasChildNodes == false) { out.print("/>"); } else { if (indentEndMarker) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } } out.print("</"); out.print(nodeName); out.print('>'); } if (prettyIndent > 0) { out.print('\n'); } } out.flush(); }
private void printInternal(Node node, boolean indentEndMarker) { // is there anything to do? if (node == null) { return; } // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false) { out.print("<?xml version='1.0'"); if (charsetName != null) out.print(" encoding='" + charsetName + "'"); out.println("?>"); wroteXMLDeclaration = true; } int type = node.getNodeType(); boolean hasChildNodes = node.getChildNodes().getLength() > 0; String nodeName = node.getNodeName(); switch (type) { // print document case Node.DOCUMENT_NODE: { NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { printInternal(children.item(iChild), false); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { Element element = (Element)node; if (prettyprint) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } prettyIndent++; } out.print('<'); out.print(nodeName); Map nsMap = new HashMap(); String elPrefix = node.getPrefix(); if (elPrefix != null) { String nsURI = getNamespaceURI(elPrefix, element, rootNode); nsMap.put(elPrefix, nsURI); } Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; String atPrefix = attr.getPrefix(); String atName = attr.getNodeName(); String atValue = normalize(attr.getNodeValue()); if (atPrefix != null && (atPrefix.equals("xmlns") || atPrefix.equals("xml")) == false) { String nsURI = getNamespaceURI(atPrefix, element, rootNode); nsMap.put(atPrefix, nsURI); } // Ignore xmlns='' if ((atName.equals("xmlns") && atValue.equals("")) == false) out.print(" " + atName + "='" + atValue + "'"); } // Add missing namespace declaration Iterator itPrefix = nsMap.keySet().iterator(); while (itPrefix.hasNext()) { String prefix = (String)itPrefix.next(); String nsURI = (String)nsMap.get(prefix); if (nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); } } if (hasChildNodes) { out.print('>'); } // Find out if the end marker is indented indentEndMarker = isEndMarkerIndented(node); if (indentEndMarker) { out.print('\n'); } NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node childNode = childNodes.item(i); printInternal(childNode, false); } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { printInternal(children.item(i), false); } } } else { out.print('&'); out.print(nodeName); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue())); } else { out.print("<![CDATA["); out.print(node.getNodeValue()); out.print("]]>"); } break; } // print text case Node.TEXT_NODE: { String text = normalize(node.getNodeValue()); if (prettyprint == false || text.trim().length() > 0) out.print(text); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print("<?"); out.print(nodeName); String data = node.getNodeValue(); if (data != null && data.length() > 0) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } out.print("<!--"); String data = node.getNodeValue(); if (data != null) { out.print(data); } out.print("-->"); if (prettyprint) { out.print('\n'); } break; } } if (type == Node.ELEMENT_NODE) { if (prettyprint) prettyIndent--; if (hasChildNodes == false) { out.print("/>"); } else { if (indentEndMarker) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } } out.print("</"); out.print(nodeName); out.print('>'); } if (prettyIndent > 0) { out.print('\n'); } } out.flush(); }
1,119,170
public void drawParticleMotion(ParticleMotion particleMotion, Graphics g) { Graphics2D graphics2D = (Graphics2D) g; Dimension dimension = super.getSize(); LocalSeismogramImpl hseis = particleMotion.hseis.getSeismogram(); LocalSeismogramImpl vseis = particleMotion.vseis.getSeismogram(); AmpConfigRegistrar vAmpConfigRegistrar = particleMotion.vAmpConfigRegistrar; AmpConfigRegistrar hAmpConfigRegistrar = particleMotion.hAmpConfigRegistrar; Color color = particleMotion.getColor(); if(color == null) { color = COLORS[RGBCOLOR]; particleMotion.setColor(color); RGBCOLOR++; if(RGBCOLOR == COLORS.length) RGBCOLOR = 0; } drawLabels(particleMotion, graphics2D); graphics2D.setColor(color); Insets insets = getInsets(); Dimension flipDimension = new Dimension(dimension.height, dimension.width); try { System.out.println("In PaintSeismogram hmax = "+hunitRangeImpl.getMaxValue()+ " hmin = "+hunitRangeImpl.getMinValue()); System.out.println("In PaintSeismogram vmax = "+vunitRangeImpl.getMaxValue()+ " vmin = "+vunitRangeImpl.getMinValue()); MicroSecondTimeRange microSecondTimeRange = null; if(particleMotion.timeRegistrar == null) { microSecondTimeRange = new MicroSecondTimeRange(new MicroSecondDate(hseis.getBeginTime()), new MicroSecondDate(hseis.getEndTime())); //System.out.println("beginTime = "+hseis.getBeginTime()); //System.out.println("endTime = "+hseis.getEndTime()); } else { microSecondTimeRange = particleMotion.getTimeRange(); } int[][] hPixels = SimplePlotUtil.compressYvalues(hseis, microSecondTimeRange, hunitRangeImpl, dimension); SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension); int[][] vPixels = SimplePlotUtil.compressYvalues(vseis, microSecondTimeRange, vunitRangeImpl, dimension); System.out.println("---------------------->Scaling THE Y VALUES "); SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); int len = vPixels[1].length; int[] x, y; x = new int[hPixels[1].length]; y = new int[vPixels[1].length]; x = hPixels[1]; y = vPixels[1]; if (hPixels[1].length < len) { len = hPixels.length; } Shape shape = getParticleMotionPath(hPixels[1], vPixels[1]); particleMotion.setShape(shape); System.out.println("After setting the shape"); if(shape == null) System.out.println("The shape is null"); graphics2D.draw(shape); System.out.println("The shape is drawn"); } catch(Exception e) { e.printStackTrace(); } }
public void drawParticleMotion(ParticleMotion particleMotion, Graphics g) { Graphics2D graphics2D = (Graphics2D) g; Dimension dimension = super.getSize(); LocalSeismogramImpl hseis = particleMotion.hseis.getSeismogram(); LocalSeismogramImpl vseis = particleMotion.vseis.getSeismogram(); AmpConfigRegistrar vAmpConfigRegistrar = particleMotion.vAmpConfigRegistrar; AmpConfigRegistrar hAmpConfigRegistrar = particleMotion.hAmpConfigRegistrar; Color color = particleMotion.getColor(); if(color == null) { color = COLORS[RGBCOLOR]; particleMotion.setColor(color); RGBCOLOR++; if(RGBCOLOR == COLORS.length) RGBCOLOR = 0; } drawLabels(particleMotion, graphics2D); graphics2D.setColor(color); Insets insets = getInsets(); Dimension flipDimension = new Dimension(dimension.height, dimension.width); try { System.out.println("In PaintSeismogram hmax = "+hunitRangeImpl.getMaxValue()+ " hmin = "+hunitRangeImpl.getMinValue()); System.out.println("In PaintSeismogram vmax = "+vunitRangeImpl.getMaxValue()+ " vmin = "+vunitRangeImpl.getMinValue()); MicroSecondTimeRange microSecondTimeRange = null; if(particleMotion.timeRegistrar == null) { microSecondTimeRange = new MicroSecondTimeRange(new MicroSecondDate(hseis.getBeginTime()), new MicroSecondDate(hseis.getEndTime())); //System.out.println("beginTime = "+hseis.getBeginTime()); //System.out.println("endTime = "+hseis.getEndTime()); } else { microSecondTimeRange = particleMotion.getTimeRange(); } int[][] hPixels = SimplePlotUtil.getPlottableSimple(hseis, hunitRangeImpl, microSecondTimeRange, dimension); /*SimplePlotUtil.compressYvalues(hseis, microSecondTimeRange, hunitRangeImpl, dimension); SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension); int[][] vPixels = SimplePlotUtil.compressYvalues(vseis, microSecondTimeRange, vunitRangeImpl, dimension); System.out.println("---------------------->Scaling THE Y VALUES "); SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); int len = vPixels[1].length; int[] x, y; x = new int[hPixels[1].length]; y = new int[vPixels[1].length]; x = hPixels[1]; y = vPixels[1]; if (hPixels[1].length < len) { len = hPixels.length; } Shape shape = getParticleMotionPath(hPixels[1], vPixels[1]); particleMotion.setShape(shape); System.out.println("After setting the shape"); if(shape == null) System.out.println("The shape is null"); graphics2D.draw(shape); System.out.println("The shape is drawn"); } catch(Exception e) { e.printStackTrace(); } }
1,119,175
public void drawParticleMotion(ParticleMotion particleMotion, Graphics g) { Graphics2D graphics2D = (Graphics2D) g; Dimension dimension = super.getSize(); LocalSeismogramImpl hseis = particleMotion.hseis.getSeismogram(); LocalSeismogramImpl vseis = particleMotion.vseis.getSeismogram(); AmpConfigRegistrar vAmpConfigRegistrar = particleMotion.vAmpConfigRegistrar; AmpConfigRegistrar hAmpConfigRegistrar = particleMotion.hAmpConfigRegistrar; Color color = particleMotion.getColor(); if(color == null) { color = COLORS[RGBCOLOR]; particleMotion.setColor(color); RGBCOLOR++; if(RGBCOLOR == COLORS.length) RGBCOLOR = 0; } drawLabels(particleMotion, graphics2D); graphics2D.setColor(color); Insets insets = getInsets(); Dimension flipDimension = new Dimension(dimension.height, dimension.width); try { System.out.println("In PaintSeismogram hmax = "+hunitRangeImpl.getMaxValue()+ " hmin = "+hunitRangeImpl.getMinValue()); System.out.println("In PaintSeismogram vmax = "+vunitRangeImpl.getMaxValue()+ " vmin = "+vunitRangeImpl.getMinValue()); MicroSecondTimeRange microSecondTimeRange = null; if(particleMotion.timeRegistrar == null) { microSecondTimeRange = new MicroSecondTimeRange(new MicroSecondDate(hseis.getBeginTime()), new MicroSecondDate(hseis.getEndTime())); //System.out.println("beginTime = "+hseis.getBeginTime()); //System.out.println("endTime = "+hseis.getEndTime()); } else { microSecondTimeRange = particleMotion.getTimeRange(); } int[][] hPixels = SimplePlotUtil.compressYvalues(hseis, microSecondTimeRange, hunitRangeImpl, dimension); SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension); int[][] vPixels = SimplePlotUtil.compressYvalues(vseis, microSecondTimeRange, vunitRangeImpl, dimension); System.out.println("---------------------->Scaling THE Y VALUES "); SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); int len = vPixels[1].length; int[] x, y; x = new int[hPixels[1].length]; y = new int[vPixels[1].length]; x = hPixels[1]; y = vPixels[1]; if (hPixels[1].length < len) { len = hPixels.length; } Shape shape = getParticleMotionPath(hPixels[1], vPixels[1]); particleMotion.setShape(shape); System.out.println("After setting the shape"); if(shape == null) System.out.println("The shape is null"); graphics2D.draw(shape); System.out.println("The shape is drawn"); } catch(Exception e) { e.printStackTrace(); } }
public void drawParticleMotion(ParticleMotion particleMotion, Graphics g) { Graphics2D graphics2D = (Graphics2D) g; Dimension dimension = super.getSize(); LocalSeismogramImpl hseis = particleMotion.hseis.getSeismogram(); LocalSeismogramImpl vseis = particleMotion.vseis.getSeismogram(); AmpConfigRegistrar vAmpConfigRegistrar = particleMotion.vAmpConfigRegistrar; AmpConfigRegistrar hAmpConfigRegistrar = particleMotion.hAmpConfigRegistrar; Color color = particleMotion.getColor(); if(color == null) { color = COLORS[RGBCOLOR]; particleMotion.setColor(color); RGBCOLOR++; if(RGBCOLOR == COLORS.length) RGBCOLOR = 0; } drawLabels(particleMotion, graphics2D); graphics2D.setColor(color); Insets insets = getInsets(); Dimension flipDimension = new Dimension(dimension.height, dimension.width); try { System.out.println("In PaintSeismogram hmax = "+hunitRangeImpl.getMaxValue()+ " hmin = "+hunitRangeImpl.getMinValue()); System.out.println("In PaintSeismogram vmax = "+vunitRangeImpl.getMaxValue()+ " vmin = "+vunitRangeImpl.getMinValue()); MicroSecondTimeRange microSecondTimeRange = null; if(particleMotion.timeRegistrar == null) { microSecondTimeRange = new MicroSecondTimeRange(new MicroSecondDate(hseis.getBeginTime()), new MicroSecondDate(hseis.getEndTime())); //System.out.println("beginTime = "+hseis.getBeginTime()); //System.out.println("endTime = "+hseis.getEndTime()); } else { microSecondTimeRange = particleMotion.getTimeRange(); } int[][] hPixels = SimplePlotUtil.compressYvalues(hseis, microSecondTimeRange, hunitRangeImpl, dimension); SimplePlotUtil.scaleYvalues(hPixels, hseis, microSecondTimeRange, hunitRangeImpl, dimension); int[][] vPixels = SimplePlotUtil.getPlottableSimple(vseis, vunitRangeImpl, microSecondTimeRange, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); Date utilEndTime = Calendar.getInstance().getTime(); System.out.println("The UTIL TIME is ******* "+ (utilEndTime.getTime() - utilStartTime.getTime())); /* SimplePlotUtil.compressYvalues(vseis, microSecondTimeRange, vunitRangeImpl, dimension); System.out.println("---------------------->Scaling THE Y VALUES "); SimplePlotUtil.scaleYvalues(vPixels, vseis, microSecondTimeRange, vunitRangeImpl, dimension); SimplePlotUtil.flipArray(vPixels[1], dimension.height); int len = vPixels[1].length; int[] x, y; x = new int[hPixels[1].length]; y = new int[vPixels[1].length]; x = hPixels[1]; y = vPixels[1]; if (hPixels[1].length < len) { len = hPixels.length; } Shape shape = getParticleMotionPath(hPixels[1], vPixels[1]); particleMotion.setShape(shape); System.out.println("After setting the shape"); if(shape == null) System.out.println("The shape is null"); graphics2D.draw(shape); System.out.println("The shape is drawn"); } catch(Exception e) { e.printStackTrace(); } }
1,119,177
public Shape getParticleMotionPath(int[] x, int[] y) { int len = x.length; if(y.length < len) { len = y.length;} GeneralPath generalPath = new GeneralPath(GeneralPath.WIND_EVEN_ODD); if(len != 0) { generalPath.moveTo(x[0], y[0]); } for(int counter = 1; counter < len; counter++) { generalPath.lineTo(x[counter], y[counter]); } for(int counter = 0; counter < len; counter++) { generalPath.append(new Rectangle2D.Float(x[counter]-2, y[counter]-2, 4, 4), false); } System.out.println("Before returning from the getParticleMotionPath"); return (Shape)generalPath; }
public Shape getParticleMotionPath(int[] x, int[] y) { int len = x.length; if(y.length < len) { len = y.length;} GeneralPath generalPath = new GeneralPath(GeneralPath.WIND_EVEN_ODD); if(len != 0) { generalPath.moveTo(x[0], y[0]); } for(int counter = 1; counter < len; counter++) { generalPath.lineTo(x[counter], y[counter]); } /*for(int counter = 0; counter < len; counter++) { generalPath.append(new Rectangle2D.Float(x[counter]-2, y[counter]-2, 4, 4), false); } System.out.println("Before returning from the getParticleMotionPath"); return (Shape)generalPath; }
1,119,178
public Shape getParticleMotionPath(int[] x, int[] y) { int len = x.length; if(y.length < len) { len = y.length;} GeneralPath generalPath = new GeneralPath(GeneralPath.WIND_EVEN_ODD); if(len != 0) { generalPath.moveTo(x[0], y[0]); } for(int counter = 1; counter < len; counter++) { generalPath.lineTo(x[counter], y[counter]); } for(int counter = 0; counter < len; counter++) { generalPath.append(new Rectangle2D.Float(x[counter]-2, y[counter]-2, 4, 4), false); } System.out.println("Before returning from the getParticleMotionPath"); return (Shape)generalPath; }
public Shape getParticleMotionPath(int[] x, int[] y) { int len = x.length; if(y.length < len) { len = y.length;}*/ GeneralPath generalPath = new GeneralPath(GeneralPath.WIND_EVEN_ODD); if(len != 0) { generalPath.moveTo(x[0], y[0]); }*/ for(int counter = 1; counter < len; counter++) { generalPath.lineTo(x[counter], y[counter]); }*/ for(int counter = 0; counter < len; counter++) { generalPath.append(new Rectangle2D.Float(x[counter]-2, y[counter]-2, 4, 4), false); }*/ System.out.println("Before returning from the getParticleMotionPath"); return (Shape)generalPath; }*/
1,119,179
public void addParameterRef(URL paramURL, String name, AuditInfo[] audit) { Document doc = config.getOwnerDocument(); Element param = doc.createElement("parameterRef"); param.setAttributeNS(xlinkNS, "type", "simple"); param.setAttributeNS(xlinkNS, "href", paramURL.toString()); Text text = doc.createTextNode(name); param.appendChild(text); config.appendChild(param); }
public void addParameterRef(URL paramURL, String name, AuditInfo[] audit) { Document doc = config.getOwnerDocument(); Element param = doc.createElement("parameterRef"); param.setAttributeNS(xlinkNS, "type", "simple"); param.setAttributeNS(xlinkNS, "href", paramURL.toString()); Text text = doc.createTextNode(name); param.appendChild(text); config.appendChild(param); }
1,119,183
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.getCalSvcI(); String name = request.getParameter("name"); if (name == null) { form.getErr().emit("org.bedework.client.missingfield", "name"); return "error"; } boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("y"); } BwView view = new BwView(); view.setName(name); if (!svc.addView(view, makeDefaultView)) { form.getErr().emit("org.bedework.client.notadded"); return "notAdded"; } form.setView(view); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.getCalSvcI(); String name = request.getParameter("name"); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "error"; } boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("y"); } BwView view = new BwView(); view.setName(name); if (!svc.addView(view, makeDefaultView)) { form.getErr().emit("org.bedework.client.notadded"); return "notAdded"; } form.setView(view); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
1,119,184
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.getCalSvcI(); String name = request.getParameter("name"); if (name == null) { form.getErr().emit("org.bedework.client.missingfield", "name"); return "error"; } boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("y"); } BwView view = new BwView(); view.setName(name); if (!svc.addView(view, makeDefaultView)) { form.getErr().emit("org.bedework.client.notadded"); return "notAdded"; } form.setView(view); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.getCalSvcI(); String name = request.getParameter("name"); if (name == null) { form.getErr().emit("org.bedework.client.missingfield", "name"); return "error"; } boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("y"); } BwView view = new BwView(); view.setName(name); if (!svc.addView(view, makeDefaultView)) { form.getErr().emit("org.bedework.client.error.viewnotadded"); return "notAdded"; } form.setView(view); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
1,119,185
public SeismogramIterator(LocalSeismogramImpl[] seismograms){ this(seismograms, DisplayUtils.getFullTime(seismograms)); }
public SeismogramIterator(LocalSeismogramImpl[] seismograms){ this(seismograms, DisplayUtils.getFullTime(seismograms)); }
1,119,186
private Statistics getStatistics(LocalSeismogramImpl seis){ SoftReference softStat = (SoftReference)statisticsMap.get(seis); Statistics stat; if(softStat == null){ stat = new Statistics(seis); statisticsMap.put(seis, new SoftReference(stat)); }else{ stat = (Statistics)softStat.get(); if(stat == null){ stat = new Statistics(seis); statisticsMap.put(seis, new SoftReference(stat)); } } return stat; }
private Statistics getStatistics(LocalSeismogramImpl seis){ SoftReference softStat = (SoftReference)statisticsMap.get(seis); Statistics stat; if(softStat == null){ stat = new Statistics(seis); statisticsMap.put(seis, new SoftReference(stat)); }else{ stat = (Statistics)softStat.get(); if(stat == null){ stat = new Statistics(seis); statisticsMap.put(seis, new SoftReference(stat)); } } return stat; }
1,119,187
private Statistics getStatistics(LocalSeismogramImpl seis){ SoftReference softStat = (SoftReference)statisticsMap.get(seis); Statistics stat; if(softStat == null){ stat = new Statistics(seis); statisticsMap.put(seis, new SoftReference(stat)); }else{ stat = (Statistics)softStat.get(); if(stat == null){ stat = new Statistics(seis); statisticsMap.put(seis, new SoftReference(stat)); } } return stat; }
private Statistics getStatistics(LocalSeismogramImpl seis){ SoftReference softStat = (SoftReference)statisticsMap.get(seis); Statistics stat; if(softStat == null){ stat = new Statistics(seis); statisticsMap.put(seis, new SoftReference(stat)); }else{ stat = (Statistics)softStat.get(); if(stat == null){ stat = new Statistics(seis); statisticsMap.put(seis, new SoftReference(stat)); } } return stat; }
1,119,188
public double[] minMaxMean(int startPoint, int endPoint){ double max = Double.NEGATIVE_INFINITY; double min = Double.POSITIVE_INFINITY; double meanStore = 0; for(int i = startPoint; i < endPoint; i++){ Object[] array = getSeisAtWithInternal(startPoint); LocalSeismogramImpl current = (LocalSeismogramImpl)array[0]; int internalStartPoint = ((Integer)array[1]).intValue(); if(!(current instanceof Gap)){ int lastPoint = ((int[])points.get(current))[1]; if((lastPoint - internalStartPoint) + i >= endPoint){ lastPoint = internalStartPoint + (endPoint - i); } Statistics curStat = getStatistics(current); double[] curMinMaxMean = curStat.minMaxMean(internalStartPoint, lastPoint); if(curMinMaxMean[0] < min){ min = curMinMaxMean[0]; } if(curMinMaxMean[1] > max){ max = curMinMaxMean[1]; } meanStore += curMinMaxMean[2]*(lastPoint-i); i +=lastPoint - internalStartPoint; } } double[] minMaxMean = {min, max, meanStore/(endPoint - startPoint)}; return minMaxMean; }
public double[] minMaxMean(int startPoint, int endPoint){ double max = Double.NEGATIVE_INFINITY; double min = Double.POSITIVE_INFINITY; double meanStore = 0; for(int i = startPoint; i < endPoint; i++){ Object[] array = getSeisAtWithInternal(startPoint); LocalSeismogramImpl current = (LocalSeismogramImpl)array[0]; int internalStartPoint = ((Integer)array[1]).intValue(); if(!(current instanceof Gap)){ int lastPoint = ((int[])points.get(current))[1]; if((lastPoint - internalStartPoint) + i >= endPoint){ lastPoint = internalStartPoint + (endPoint - i); } Statistics curStat = getStatistics(current); double[] curMinMaxMean = curStat.minMaxMean(internalStartPoint, lastPoint); if(curMinMaxMean[0] < min){ min = curMinMaxMean[0]; } if(curMinMaxMean[1] > max){ max = curMinMaxMean[1]; } meanStore += curMinMaxMean[2]*(lastPoint-i); i +=lastPoint - internalStartPoint; } } double[] minMaxMean = {min, max, meanStore/(endPoint - startPoint)}; return minMaxMean; }
1,119,189
public void setTimeRange(MicroSecondTimeRange timeRange){ this.timeRange = timeRange; if(timeRange.getBeginTime().equals(seisTimeRange.getBeginTime())){ currentPoint = 0; }else{ currentPoint = (int)DisplayUtils.linearInterp(seisTimeRange.getBeginTime().getMicroSecondTime(), seisTimeRange.getEndTime().getMicroSecondTime(), numPoints, timeRange.getBeginTime().getMicroSecondTime()); } if(timeRange.getEndTime().equals(seisTimeRange.getEndTime())){ lastPoint = numPoints; }else{ lastPoint = (int)DisplayUtils.linearInterp(seisTimeRange.getBeginTime().getMicroSecondTime(), seisTimeRange.getEndTime().getMicroSecondTime(), numPoints, timeRange.getEndTime().getMicroSecondTime()); } }
public void setTimeRange(MicroSecondTimeRange timeRange){ this.timeRange = timeRange; if(timeRange == DisplayUtils.ZERO_TIME){ currentPoint = 0; }else{ currentPoint = (int)DisplayUtils.linearInterp(seisTimeRange.getBeginTime().getMicroSecondTime(), seisTimeRange.getEndTime().getMicroSecondTime(), numPoints, timeRange.getBeginTime().getMicroSecondTime()); } if(timeRange.getEndTime().equals(seisTimeRange.getEndTime())){ lastPoint = numPoints; }else{ lastPoint = (int)DisplayUtils.linearInterp(seisTimeRange.getBeginTime().getMicroSecondTime(), seisTimeRange.getEndTime().getMicroSecondTime(), numPoints, timeRange.getEndTime().getMicroSecondTime()); } }
1,119,190
public void setTimeRange(MicroSecondTimeRange timeRange){ this.timeRange = timeRange; if(timeRange.getBeginTime().equals(seisTimeRange.getBeginTime())){ currentPoint = 0; }else{ currentPoint = (int)DisplayUtils.linearInterp(seisTimeRange.getBeginTime().getMicroSecondTime(), seisTimeRange.getEndTime().getMicroSecondTime(), numPoints, timeRange.getBeginTime().getMicroSecondTime()); } if(timeRange.getEndTime().equals(seisTimeRange.getEndTime())){ lastPoint = numPoints; }else{ lastPoint = (int)DisplayUtils.linearInterp(seisTimeRange.getBeginTime().getMicroSecondTime(), seisTimeRange.getEndTime().getMicroSecondTime(), numPoints, timeRange.getEndTime().getMicroSecondTime()); } }
public void setTimeRange(MicroSecondTimeRange timeRange){ this.timeRange = timeRange; if(timeRange.getBeginTime().equals(seisTimeRange.getBeginTime())){ currentPoint = 0; }else{ currentPoint = (int)DisplayUtils.linearInterp(seisTimeRange.getBeginTime().getMicroSecondTime(), seisTimeRange.getEndTime().getMicroSecondTime(), numPoints, timeRange.getBeginTime().getMicroSecondTime()); } if(timeRange.getEndTime().equals(seisTimeRange.getEndTime())){ lastPoint = numPoints; }else{ lastPoint = (int)DisplayUtils.linearInterp(seisTimeRange.getBeginTime().getMicroSecondTime(), seisTimeRange.getEndTime().getMicroSecondTime(), numPoints, timeRange.getEndTime().getMicroSecondTime()); } }
1,119,191
public void field(String name) throws Exception { BwOrganizer ent = (BwOrganizer)top(); if (taggedEntityId(ent, name)) { return; } if (name.equals("cn")) { ent.setCn(stringFld()); } else if (name.equals("dir")) { ent.setDir(stringFld()); } else if (name.equals("lang")) { ent.setLanguage(stringFld()); } else if (name.equals("sent-by")) { ent.setSentBy(stringFld()); } else if (name.equals("organizer-uri")) { ent.setOrganizerUri(stringFld()); } else if (name.equals("orgseq")) { ent.setSeq(intFld()); } else { unknownTag(name); } }
public void field(String name) throws Exception { BwOrganizer ent = (BwOrganizer)top(); if (ownedEntityTags(ent, name)) { return; } if (name.equals("cn")) { ent.setCn(stringFld()); } else if (name.equals("dir")) { ent.setDir(stringFld()); } else if (name.equals("lang")) { ent.setLanguage(stringFld()); } else if (name.equals("sent-by")) { ent.setSentBy(stringFld()); } else if (name.equals("organizer-uri")) { ent.setOrganizerUri(stringFld()); } else if (name.equals("orgseq")) { ent.setSeq(intFld()); } else { unknownTag(name); } }
1,119,192
public static boolean validateEvent(CalSvcI svci, BwEvent ev, boolean descriptionRequired, MessageEmit err) throws CalFacadeException { boolean ok = true; ev.setSummary(checkNull(ev.getSummary())); ev.setDescription(checkNull(ev.getDescription())); if (ev.getCalendar() == null) { err.emit("org.bedework.validation.error.nocalendar"); ok = false; } if (ev.getSummary() == null) { err.emit("org.bedework.validation.error.notitle"); ok = false; } if (ev.getDescription() == null) { if (descriptionRequired) { err.emit("org.bedework.validation.error.nodescription"); ok = false; } } else if (ev.getDescription().length() > BwEvent.maxDescriptionLength) { err.emit("org.bedework.validation.error.toolong.description", String.valueOf(BwEvent.maxDescriptionLength)); ok = false; } BwDateTime evstart = ev.getDtstart(); DtStart start = evstart.makeDtStart(); DtEnd end = null; Duration dur = null; char endType = ev.getEndType(); if (endType == BwEvent.endTypeNone) { } else if (endType == BwEvent.endTypeDate) { BwDateTime evend = ev.getDtend(); if (evstart.after(evend)) { err.emit("org.bedework.validation.error.event.startafterend"); ok = false; } else { end = evend.makeDtEnd(); } } else if (endType == BwEvent.endTypeDuration) { dur = new Duration(new Dur(ev.getDuration())); } else { err.emit("org.bedework.validation.error.invalid.endtype"); ok = false; } if (ok) { BwEventUtil.setDates(svci.getTimezones(), ev, start, end, dur); } return ok; }
public static boolean validateEvent(CalSvcI svci, BwEvent ev, boolean publicEvent, MessageEmit err) throws CalFacadeException { boolean ok = true; ev.setSummary(checkNull(ev.getSummary())); ev.setDescription(checkNull(ev.getDescription())); if (ev.getCalendar() == null) { err.emit("org.bedework.validation.error.nocalendar"); ok = false; } if (ev.getSummary() == null) { err.emit("org.bedework.validation.error.notitle"); ok = false; } if (ev.getDescription() == null) { if (descriptionRequired) { err.emit("org.bedework.validation.error.nodescription"); ok = false; } } else if (ev.getDescription().length() > BwEvent.maxDescriptionLength) { err.emit("org.bedework.validation.error.toolong.description", String.valueOf(BwEvent.maxDescriptionLength)); ok = false; } BwDateTime evstart = ev.getDtstart(); DtStart start = evstart.makeDtStart(); DtEnd end = null; Duration dur = null; char endType = ev.getEndType(); if (endType == BwEvent.endTypeNone) { } else if (endType == BwEvent.endTypeDate) { BwDateTime evend = ev.getDtend(); if (evstart.after(evend)) { err.emit("org.bedework.validation.error.event.startafterend"); ok = false; } else { end = evend.makeDtEnd(); } } else if (endType == BwEvent.endTypeDuration) { dur = new Duration(new Dur(ev.getDuration())); } else { err.emit("org.bedework.validation.error.invalid.endtype"); ok = false; } if (ok) { BwEventUtil.setDates(svci.getTimezones(), ev, start, end, dur); } return ok; }
1,119,193
public static boolean validateEvent(CalSvcI svci, BwEvent ev, boolean descriptionRequired, MessageEmit err) throws CalFacadeException { boolean ok = true; ev.setSummary(checkNull(ev.getSummary())); ev.setDescription(checkNull(ev.getDescription())); if (ev.getCalendar() == null) { err.emit("org.bedework.validation.error.nocalendar"); ok = false; } if (ev.getSummary() == null) { err.emit("org.bedework.validation.error.notitle"); ok = false; } if (ev.getDescription() == null) { if (descriptionRequired) { err.emit("org.bedework.validation.error.nodescription"); ok = false; } } else if (ev.getDescription().length() > BwEvent.maxDescriptionLength) { err.emit("org.bedework.validation.error.toolong.description", String.valueOf(BwEvent.maxDescriptionLength)); ok = false; } BwDateTime evstart = ev.getDtstart(); DtStart start = evstart.makeDtStart(); DtEnd end = null; Duration dur = null; char endType = ev.getEndType(); if (endType == BwEvent.endTypeNone) { } else if (endType == BwEvent.endTypeDate) { BwDateTime evend = ev.getDtend(); if (evstart.after(evend)) { err.emit("org.bedework.validation.error.event.startafterend"); ok = false; } else { end = evend.makeDtEnd(); } } else if (endType == BwEvent.endTypeDuration) { dur = new Duration(new Dur(ev.getDuration())); } else { err.emit("org.bedework.validation.error.invalid.endtype"); ok = false; } if (ok) { BwEventUtil.setDates(svci.getTimezones(), ev, start, end, dur); } return ok; }
public static boolean validateEvent(CalSvcI svci, BwEvent ev, boolean descriptionRequired, MessageEmit err) throws CalFacadeException { boolean ok = true; ev.setSummary(checkNull(ev.getSummary())); ev.setDescription(checkNull(ev.getDescription())); if (ev.getCalendar() == null) { err.emit("org.bedework.validation.error.nocalendar"); ok = false; } if (ev.getSummary() == null) { err.emit("org.bedework.validation.error.notitle"); ok = false; } if (ev.getDescription() == null) { if (publicEvent) { err.emit("org.bedework.validation.error.nodescription"); ok = false; } } else if (ev.getDescription().length() > BwEvent.maxDescriptionLength) { err.emit("org.bedework.validation.error.toolong.description", String.valueOf(BwEvent.maxDescriptionLength)); ok = false; } BwDateTime evstart = ev.getDtstart(); DtStart start = evstart.makeDtStart(); DtEnd end = null; Duration dur = null; char endType = ev.getEndType(); if (endType == BwEvent.endTypeNone) { } else if (endType == BwEvent.endTypeDate) { BwDateTime evend = ev.getDtend(); if (evstart.after(evend)) { err.emit("org.bedework.validation.error.event.startafterend"); ok = false; } else { end = evend.makeDtEnd(); } } else if (endType == BwEvent.endTypeDuration) { dur = new Duration(new Dur(ev.getDuration())); } else { err.emit("org.bedework.validation.error.invalid.endtype"); ok = false; } if (ok) { BwEventUtil.setDates(svci.getTimezones(), ev, start, end, dur); } return ok; }
1,119,194
public static boolean validateEvent(CalSvcI svci, BwEvent ev, boolean descriptionRequired, MessageEmit err) throws CalFacadeException { boolean ok = true; ev.setSummary(checkNull(ev.getSummary())); ev.setDescription(checkNull(ev.getDescription())); if (ev.getCalendar() == null) { err.emit("org.bedework.validation.error.nocalendar"); ok = false; } if (ev.getSummary() == null) { err.emit("org.bedework.validation.error.notitle"); ok = false; } if (ev.getDescription() == null) { if (descriptionRequired) { err.emit("org.bedework.validation.error.nodescription"); ok = false; } } else if (ev.getDescription().length() > BwEvent.maxDescriptionLength) { err.emit("org.bedework.validation.error.toolong.description", String.valueOf(BwEvent.maxDescriptionLength)); ok = false; } BwDateTime evstart = ev.getDtstart(); DtStart start = evstart.makeDtStart(); DtEnd end = null; Duration dur = null; char endType = ev.getEndType(); if (endType == BwEvent.endTypeNone) { } else if (endType == BwEvent.endTypeDate) { BwDateTime evend = ev.getDtend(); if (evstart.after(evend)) { err.emit("org.bedework.validation.error.event.startafterend"); ok = false; } else { end = evend.makeDtEnd(); } } else if (endType == BwEvent.endTypeDuration) { dur = new Duration(new Dur(ev.getDuration())); } else { err.emit("org.bedework.validation.error.invalid.endtype"); ok = false; } if (ok) { BwEventUtil.setDates(svci.getTimezones(), ev, start, end, dur); } return ok; }
public static boolean validateEvent(CalSvcI svci, BwEvent ev, boolean descriptionRequired, MessageEmit err) throws CalFacadeException { boolean ok = true; ev.setSummary(checkNull(ev.getSummary())); ev.setDescription(checkNull(ev.getDescription())); if (ev.getCalendar() == null) { err.emit("org.bedework.validation.error.nocalendar"); ok = false; } if (ev.getSummary() == null) { err.emit("org.bedework.validation.error.notitle"); ok = false; } if (ev.getDescription() == null) { if (descriptionRequired) { err.emit("org.bedework.validation.error.nodescription"); ok = false; } } else if (ev.getDescription().length() > BwEvent.maxDescriptionLength) { err.emit("org.bedework.validation.error.toolong.description", String.valueOf(BwEvent.maxDescriptionLength)); ok = false; } BwDateTime evstart = ev.getDtstart(); DtStart start = evstart.makeDtStart(); DtEnd end = null; Duration dur = null; char endType = ev.getEndType(); if (endType == BwEvent.endTypeNone) { } else if (endType == BwEvent.endTypeDate) { BwDateTime evend = ev.getDtend(); if (evstart.after(evend)) { err.emit("org.bedework.validation.error.event.startafterend"); ok = false; } else { end = evend.makeDtEnd(); } } else if (endType == BwEvent.endTypeDuration) { dur = new Duration(new Dur(ev.getDuration())); } else { err.emit("org.bedework.validation.error.invalid.endtype"); ok = false; } if (ok) { BwEventUtil.setDates(svci.getTimezones(), ev, start, end, dur); } return ok; }
1,119,195
public MainPanel(final AudioPlayer owner) { super(new BorderLayout()); playlist.setPlayAll(Configuration.isPlayAll()); playlist.setRandom(Configuration.isRandom()); list = new JList(playlist.getListModel()); list.setCellRenderer(new ListCellRenderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { File file = (File)value; if (!labeltable.containsKey(file)) { ListComponent label = new ListComponent(file.toString()); labeltable.put(file, label); } ListComponent comp = (ListComponent)labeltable.get(file); if (isSelected) { comp.setForeground(Color.BLUE); } else { comp.setForeground(list.getForeground()); } return comp; } }); list.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { int index = list.getSelectedIndex(); if (index != -1) { playlist.play(index); } } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } }); playlist.addListener(new PlaylistListener() { public void playbackStarted(Player player) { File file = player.getFile(); updatePlayingLabel(file); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, true); } public void playbackStopped(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, false); } public void playbackCompleted(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, false); } }); JButton add = new JButton(Messages.getString("MainPanel.ADD_FILE")); //$NON-NLS-1$ add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setSelectedFile(Configuration.getLastFile()); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory() || Util.isAudioFile(f); } public String getDescription() { return Messages.getString("MainPanel.DOT_MP3_FILES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.add(f[i]); } if (f.length > 0) { Configuration.setLastFile(f[0]); } } } }); JButton addDir = new JButton(Messages.getString("MainPanel.ADD_DIR")); //$NON-NLS-1$ addDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setSelectedFile(Configuration.getLastDirectory()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory(); } public String getDescription() { return Messages.getString("MainPanel.DIRECTORIES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.addDirectory(f[i]); } if (f.length > 0) { Configuration.setLastDirectory(f[0]); } } } }); JButton del = new JButton(Messages.getString("MainPanel.DELETE_FILE")); //$NON-NLS-1$ del.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int[] arr = list.getSelectedIndices(); if (arr != null) { for (int i = arr.length - 1; i >= 0; i--) { playlist.remove(arr[i]); } } } }); JButton delAll = new JButton(Messages.getString("MainPanel.DELETE_ALL")); //$NON-NLS-1$ delAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { playlist.removeAll(); } }); JPanel p, sub; p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(); sub.add(add); sub.add(addDir); sub.add(del); sub.add(delAll); p.add(sub); updatePlayingLabel(null); p.add(playingLabel); add(p, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(list); add(scrollPane, BorderLayout.CENTER); p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(new BorderLayout()); sub.add(new JLabel(Messages.getString("MainPanel.SEARCH") +":"), BorderLayout.WEST); //$NON-NLS-1$ //$NON-NLS-2$ sub.add(searchField, BorderLayout.CENTER); JButton searchButton = new JButton(Messages.getString("MainPanel.SEARCHBUTTON")); //$NON-NLS-1$ searchButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { playlist.fireListModelEvent(0, playlist.size() - 1); } }); sub.add(searchButton, BorderLayout.EAST); p.add(sub); p.add(new ControlPanel(owner)); add(p, BorderLayout.SOUTH); }
public MainPanel(final AudioPlayer owner) { super(new BorderLayout()); playlist.setPlayAll(Configuration.isPlayAll()); playlist.setRandom(Configuration.isRandom()); list = new JList(playlist.getListModel()); list.setCellRenderer(new ListCellRenderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { File file = (File)value; if (!labeltable.containsKey(file)) { ListComponent label = new ListComponent(file.toString()); labeltable.put(file, label); } ListComponent comp = (ListComponent)labeltable.get(file); if (isSelected) { comp.setForeground(Color.BLUE); } else { comp.setForeground(list.getForeground()); } return comp; } }); list.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { int index = list.getSelectedIndex(); if (index != -1) { playlist.play(index); } } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } }); playlist.addListener(new PlaylistListener() { public void playbackStarted(Player player) { File file = player.getFile(); updatePlayingLabel(file); ListComponent comp = (ListComponent)labeltable.get(file); if (comp != null) { comp.update(file, true); } } public void playbackStopped(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, false); } public void playbackCompleted(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, false); } }); JButton add = new JButton(Messages.getString("MainPanel.ADD_FILE")); //$NON-NLS-1$ add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setSelectedFile(Configuration.getLastFile()); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory() || Util.isAudioFile(f); } public String getDescription() { return Messages.getString("MainPanel.DOT_MP3_FILES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.add(f[i]); } if (f.length > 0) { Configuration.setLastFile(f[0]); } } } }); JButton addDir = new JButton(Messages.getString("MainPanel.ADD_DIR")); //$NON-NLS-1$ addDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setSelectedFile(Configuration.getLastDirectory()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory(); } public String getDescription() { return Messages.getString("MainPanel.DIRECTORIES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.addDirectory(f[i]); } if (f.length > 0) { Configuration.setLastDirectory(f[0]); } } } }); JButton del = new JButton(Messages.getString("MainPanel.DELETE_FILE")); //$NON-NLS-1$ del.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int[] arr = list.getSelectedIndices(); if (arr != null) { for (int i = arr.length - 1; i >= 0; i--) { playlist.remove(arr[i]); } } } }); JButton delAll = new JButton(Messages.getString("MainPanel.DELETE_ALL")); //$NON-NLS-1$ delAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { playlist.removeAll(); } }); JPanel p, sub; p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(); sub.add(add); sub.add(addDir); sub.add(del); sub.add(delAll); p.add(sub); updatePlayingLabel(null); p.add(playingLabel); add(p, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(list); add(scrollPane, BorderLayout.CENTER); p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(new BorderLayout()); sub.add(new JLabel(Messages.getString("MainPanel.SEARCH") +":"), BorderLayout.WEST); //$NON-NLS-1$ //$NON-NLS-2$ sub.add(searchField, BorderLayout.CENTER); JButton searchButton = new JButton(Messages.getString("MainPanel.SEARCHBUTTON")); //$NON-NLS-1$ searchButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { playlist.fireListModelEvent(0, playlist.size() - 1); } }); sub.add(searchButton, BorderLayout.EAST); p.add(sub); p.add(new ControlPanel(owner)); add(p, BorderLayout.SOUTH); }
1,119,196
public MainPanel(final AudioPlayer owner) { super(new BorderLayout()); playlist.setPlayAll(Configuration.isPlayAll()); playlist.setRandom(Configuration.isRandom()); list = new JList(playlist.getListModel()); list.setCellRenderer(new ListCellRenderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { File file = (File)value; if (!labeltable.containsKey(file)) { ListComponent label = new ListComponent(file.toString()); labeltable.put(file, label); } ListComponent comp = (ListComponent)labeltable.get(file); if (isSelected) { comp.setForeground(Color.BLUE); } else { comp.setForeground(list.getForeground()); } return comp; } }); list.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { int index = list.getSelectedIndex(); if (index != -1) { playlist.play(index); } } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } }); playlist.addListener(new PlaylistListener() { public void playbackStarted(Player player) { File file = player.getFile(); updatePlayingLabel(file); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, true); } public void playbackStopped(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, false); } public void playbackCompleted(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, false); } }); JButton add = new JButton(Messages.getString("MainPanel.ADD_FILE")); //$NON-NLS-1$ add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setSelectedFile(Configuration.getLastFile()); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory() || Util.isAudioFile(f); } public String getDescription() { return Messages.getString("MainPanel.DOT_MP3_FILES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.add(f[i]); } if (f.length > 0) { Configuration.setLastFile(f[0]); } } } }); JButton addDir = new JButton(Messages.getString("MainPanel.ADD_DIR")); //$NON-NLS-1$ addDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setSelectedFile(Configuration.getLastDirectory()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory(); } public String getDescription() { return Messages.getString("MainPanel.DIRECTORIES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.addDirectory(f[i]); } if (f.length > 0) { Configuration.setLastDirectory(f[0]); } } } }); JButton del = new JButton(Messages.getString("MainPanel.DELETE_FILE")); //$NON-NLS-1$ del.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int[] arr = list.getSelectedIndices(); if (arr != null) { for (int i = arr.length - 1; i >= 0; i--) { playlist.remove(arr[i]); } } } }); JButton delAll = new JButton(Messages.getString("MainPanel.DELETE_ALL")); //$NON-NLS-1$ delAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { playlist.removeAll(); } }); JPanel p, sub; p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(); sub.add(add); sub.add(addDir); sub.add(del); sub.add(delAll); p.add(sub); updatePlayingLabel(null); p.add(playingLabel); add(p, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(list); add(scrollPane, BorderLayout.CENTER); p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(new BorderLayout()); sub.add(new JLabel(Messages.getString("MainPanel.SEARCH") +":"), BorderLayout.WEST); //$NON-NLS-1$ //$NON-NLS-2$ sub.add(searchField, BorderLayout.CENTER); JButton searchButton = new JButton(Messages.getString("MainPanel.SEARCHBUTTON")); //$NON-NLS-1$ searchButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { playlist.fireListModelEvent(0, playlist.size() - 1); } }); sub.add(searchButton, BorderLayout.EAST); p.add(sub); p.add(new ControlPanel(owner)); add(p, BorderLayout.SOUTH); }
public MainPanel(final AudioPlayer owner) { super(new BorderLayout()); playlist.setPlayAll(Configuration.isPlayAll()); playlist.setRandom(Configuration.isRandom()); list = new JList(playlist.getListModel()); list.setCellRenderer(new ListCellRenderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { File file = (File)value; if (!labeltable.containsKey(file)) { ListComponent label = new ListComponent(file.toString()); labeltable.put(file, label); } ListComponent comp = (ListComponent)labeltable.get(file); if (isSelected) { comp.setForeground(Color.BLUE); } else { comp.setForeground(list.getForeground()); } return comp; } }); list.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { int index = list.getSelectedIndex(); if (index != -1) { playlist.play(index); } } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } }); playlist.addListener(new PlaylistListener() { public void playbackStarted(Player player) { File file = player.getFile(); updatePlayingLabel(file); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, true); } public void playbackStopped(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); if (comp != null) { comp.update(file, false); } } public void playbackCompleted(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); if (comp != null) { comp.update(file, false); } } }); JButton add = new JButton(Messages.getString("MainPanel.ADD_FILE")); //$NON-NLS-1$ add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setSelectedFile(Configuration.getLastFile()); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory() || Util.isAudioFile(f); } public String getDescription() { return Messages.getString("MainPanel.DOT_MP3_FILES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.add(f[i]); } if (f.length > 0) { Configuration.setLastFile(f[0]); } } } }); JButton addDir = new JButton(Messages.getString("MainPanel.ADD_DIR")); //$NON-NLS-1$ addDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setSelectedFile(Configuration.getLastDirectory()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory(); } public String getDescription() { return Messages.getString("MainPanel.DIRECTORIES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.addDirectory(f[i]); } if (f.length > 0) { Configuration.setLastDirectory(f[0]); } } } }); JButton del = new JButton(Messages.getString("MainPanel.DELETE_FILE")); //$NON-NLS-1$ del.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int[] arr = list.getSelectedIndices(); if (arr != null) { for (int i = arr.length - 1; i >= 0; i--) { playlist.remove(arr[i]); } } } }); JButton delAll = new JButton(Messages.getString("MainPanel.DELETE_ALL")); //$NON-NLS-1$ delAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { playlist.removeAll(); } }); JPanel p, sub; p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(); sub.add(add); sub.add(addDir); sub.add(del); sub.add(delAll); p.add(sub); updatePlayingLabel(null); p.add(playingLabel); add(p, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(list); add(scrollPane, BorderLayout.CENTER); p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(new BorderLayout()); sub.add(new JLabel(Messages.getString("MainPanel.SEARCH") +":"), BorderLayout.WEST); //$NON-NLS-1$ //$NON-NLS-2$ sub.add(searchField, BorderLayout.CENTER); JButton searchButton = new JButton(Messages.getString("MainPanel.SEARCHBUTTON")); //$NON-NLS-1$ searchButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { playlist.fireListModelEvent(0, playlist.size() - 1); } }); sub.add(searchButton, BorderLayout.EAST); p.add(sub); p.add(new ControlPanel(owner)); add(p, BorderLayout.SOUTH); }
1,119,197
public void playbackCompleted(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, false); }
public void playbackCompleted(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); if (comp != null) { comp.update(file, false); } }
1,119,198
public void playbackStarted(Player player) { File file = player.getFile(); updatePlayingLabel(file); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, true); }
public void playbackStarted(Player player) { File file = player.getFile(); updatePlayingLabel(file); ListComponent comp = (ListComponent)labeltable.get(file); if (comp != null) { comp.update(file, true); } }
1,119,199
public void playbackStopped(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); comp.update(file, false); }
public void playbackStopped(Player player) { File file = player.getFile(); updatePlayingLabel(null); ListComponent comp = (ListComponent)labeltable.get(file); if (comp != null) { comp.update(file, false); } }
1,119,200
void process() throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); String userName = System.getProperty("user.name"); dataset = new XMLDataSet(docBuilder, base, "genid"+Math.round(Math.random()*Integer.MAX_VALUE), dsName, userName); Iterator it = paramRefs.keySet().iterator(); while (it.hasNext()) { String key = (String)it.next(); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName, "Added parameter "+key); try { URL dirURL = new URL(base, directory.getName()); dataset.addParameterRef(new URL(dirURL, (String)paramRefs.get(key)), key, audit); } catch (MalformedURLException e) { //can't happen? e.printStackTrace(); System.err.println("Caught exception on parameterRef " +key+", continuing..."); } // end of try-catch } // end of while (it.hasNext()) File[] sacFiles = directory.listFiles(); //SacTimeSeries sac = new SacTimeSeries(); for (int i=0; i<sacFiles.length; i++) { if (excludes.contains(sacFiles[i].getName())) { continue; } // end of if (excludes.contains(sacFiles[i].getName())) if (paramRefs.containsValue(sacFiles[i].getName())) { continue; } // end of if (excludes.contains(sacFiles[i].getName())) try { //sac.read(sacFiles[i].getCanonicalPath()); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName+" via SacDirToDataSet", "seismogram loaded from sacFiles[i].getCanonicalPath()"); URL seisURL = new URL(base, sacFiles[i].getName()); dataset.addSeismogramRef(seisURL, sacFiles[i].getName(), new Property[0], new ParameterRef[0], audit); } catch (Exception e) { e.printStackTrace(); System.err.println("Caught exception on " +sacFiles[i].getName()+", continuing..."); } // end of try-catch } // end of for (int i=0; i<sacFiles.length; i++) }
void process() throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); String userName = System.getProperty("user.name"); dataset = new XMLDataSet(docBuilder, base, "genid"+Math.round(Math.random()*Integer.MAX_VALUE), dsName, userName); Iterator it = paramRefs.keySet().iterator(); while (it.hasNext()) { String key = (String)it.next(); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName, "Added parameter "+key); try { URL dirURL = new URL(base, directory.getName()+"/"); dataset.addParameterRef(new URL(dirURL, (String)paramRefs.get(key)), key, audit); } catch (MalformedURLException e) { //can't happen? e.printStackTrace(); System.err.println("Caught exception on parameterRef " +key+", continuing..."); } // end of try-catch } // end of while (it.hasNext()) File[] sacFiles = directory.listFiles(); //SacTimeSeries sac = new SacTimeSeries(); for (int i=0; i<sacFiles.length; i++) { if (excludes.contains(sacFiles[i].getName())) { continue; } // end of if (excludes.contains(sacFiles[i].getName())) if (paramRefs.containsValue(sacFiles[i].getName())) { continue; } // end of if (excludes.contains(sacFiles[i].getName())) try { //sac.read(sacFiles[i].getCanonicalPath()); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName+" via SacDirToDataSet", "seismogram loaded from sacFiles[i].getCanonicalPath()"); URL seisURL = new URL(base, sacFiles[i].getName()); dataset.addSeismogramRef(seisURL, sacFiles[i].getName(), new Property[0], new ParameterRef[0], audit); } catch (Exception e) { e.printStackTrace(); System.err.println("Caught exception on " +sacFiles[i].getName()+", continuing..."); } // end of try-catch } // end of for (int i=0; i<sacFiles.length; i++) }
1,119,201
public boolean isSelectionSelected(int currx, int curry) { if( (currx > (endx - 10) && currx < (endx + 10) && curry >= beginy && curry <= endy) || (currx > (beginx - 10) && currx < (beginx + 10) && curry >= beginy && curry <= endy) ) { System.out.println("returning true"); return true; } System.out.println("return false"); return false; }
public boolean isSelectionSelected(int currx, int curry) { if( (currx > (endx - 10) && currx < (endx + 10) && curry >= beginy && curry <= endy) || (currx > (beginx - 10) && currx < (beginx + 10) && curry >= beginy && curry <= endy) ) { return true; } System.out.println("return false"); return false; }
1,119,202
public boolean isSelectionSelected(int currx, int curry) { if( (currx > (endx - 10) && currx < (endx + 10) && curry >= beginy && curry <= endy) || (currx > (beginx - 10) && currx < (beginx + 10) && curry >= beginy && curry <= endy) ) { System.out.println("returning true"); return true; } System.out.println("return false"); return false; }
public boolean isSelectionSelected(int currx, int curry) { if( (currx > (endx - 10) && currx < (endx + 10) && curry >= beginy && curry <= endy) || (currx > (beginx - 10) && currx < (beginx + 10) && curry >= beginy && curry <= endy) ) { System.out.println("returning true"); return true; } return false; }
1,119,203
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access and set request parameters */ if (!form.getAuthorisedUser()) { return "noAccess"; } /** Set the objects to null so we get new ones. */ form.initFields(); form.setEvent(null); form.assignAlertEvent(false); form.assignAddingEvent(true); form.resetEvent(); return "continue"; }
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access and set request parameters */ if (!form.getAuthorisedUser()) { return "noAccess"; } /** Set the objects to null so we get new ones. */ form.initFields(); form.setEvent(null); form.assignAlertEvent(false); form.assignAddingEvent(true); form.resetEvent(); return "continue"; }
1,119,204
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access and set request parameters */ if (!form.getAuthorisedUser()) { return "noAccess"; } /** Set the objects to null so we get new ones. */ form.initFields(); form.setEvent(null); form.assignAlertEvent(false); form.assignAddingEvent(true); form.resetEvent(); return "continue"; }
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access and set request parameters */ if (!form.getAuthorisedUser()) { return "noAccess"; } /** Set the objects to null so we get new ones. */ form.initFields(); form.setEvent(null); form.assignAlertEvent(false); form.assignAddingEvent(true); return "continue"; }
1,119,205
public Console() { final PrintStream oldOut = System.out; final PrintStream oldErr = System.err; final SimpleAttributeSet attr = new SimpleAttributeSet(); final DefaultStyledDocument doc = new DefaultStyledDocument(); StyleConstants.setFontFamily(attr, "Monospaced"); PrintStream newOut = new PrintStream(new OutputStream() { public void write(int i) throws IOException { oldOut.write(i); try { StyleConstants.setForeground(attr, Color.BLACK); doc.insertString(doc.getLength(), Character.toString((char)i), attr); } catch (Exception exc) { exc.printStackTrace(); } } }); System.setOut(newOut); PrintStream newErr = new PrintStream(new OutputStream() { public void write(int i) throws IOException { oldErr.write(i); try { StyleConstants.setForeground(attr, Color.RED); doc.insertString(doc.getLength(), Character.toString((char)i), attr); } catch (Exception exc) { exc.printStackTrace(); } } }); System.setErr(newErr); JTextPane pane = new JTextPane(doc); pane.setEditable(false); RightClickMenu.addRightClickMenu(pane); setLayout(new BorderLayout()); setBorder(new TitledBorder("Console")); add(new JScrollPane(pane)); }
public Console() { final PrintStream oldOut = System.out; final PrintStream oldErr = System.err; final SimpleAttributeSet attr = new SimpleAttributeSet(); final DefaultStyledDocument doc = new DefaultStyledDocument(); StyleConstants.setFontFamily(attr, "Monospaced"); PrintStream newOut = new PrintStream(new OutputStream() { public void write(int i) throws IOException { oldOut.write(i); try { StyleConstants.setForeground(attr, Color.BLACK); doc.insertString(doc.getLength(), Character.toString((char)i), attr); } catch (Exception exc) { exc.printStackTrace(); } } }); System.setOut(newOut); PrintStream newErr = new PrintStream(new OutputStream() { public void write(int i) throws IOException { oldErr.write(i); try { StyleConstants.setForeground(attr, Color.RED); doc.insertString(doc.getLength(), Character.toString((char)i), attr); } catch (Exception exc) { exc.printStackTrace(); } } }); System.setErr(newErr); pane.setEditable(false); RightClickMenu.addRightClickMenu(pane); setLayout(new BorderLayout()); setBorder(new TitledBorder("Console")); add(new JScrollPane(pane)); }
1,119,208
public void setUp() throws Exception { globalLexScope = Evaluator.getGlobalLexicalScope(); testScope = new NATCallframe(globalLexScope); final NATClosure symbol = new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { return AGSymbol.alloc(arguments.base_at(NATNumber.ONE).asNativeText()); } }; testScope.meta_defineField(AGSymbol.alloc("symbol"), symbol); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); }
public void setUp() throws Exception { globalLexScope = Evaluator.getGlobalLexicalScope(); testScope = new NATCallframe(globalLexScope); final NATClosure symbol = new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { return AGSymbol.alloc(arguments.base_at(NATNumber.ONE).asNativeText()); } }; testScope.meta_defineField(AGSymbol.jAlloc("symbol"), symbol); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); }
1,119,211
public void setUp() throws Exception { globalLexScope = Evaluator.getGlobalLexicalScope(); testScope = new NATCallframe(globalLexScope); final NATClosure symbol = new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { return AGSymbol.alloc(arguments.base_at(NATNumber.ONE).asNativeText()); } }; testScope.meta_defineField(AGSymbol.alloc("symbol"), symbol); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); }
public void setUp() throws Exception { globalLexScope = Evaluator.getGlobalLexicalScope(); testScope = new NATCallframe(globalLexScope); final NATClosure symbol = new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { return AGSymbol.alloc(arguments.base_at(NATNumber.ONE).asNativeText()); } }; testScope.meta_defineField(AGSymbol.alloc("symbol"), symbol); testScope.meta_defineField( AGSymbol.jAlloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); }
1,119,212
public void setUp() throws Exception { globalLexScope = Evaluator.getGlobalLexicalScope(); testScope = new NATCallframe(globalLexScope); final NATClosure symbol = new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { return AGSymbol.alloc(arguments.base_at(NATNumber.ONE).asNativeText()); } }; testScope.meta_defineField(AGSymbol.alloc("symbol"), symbol); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); }
public void setUp() throws Exception { globalLexScope = Evaluator.getGlobalLexicalScope(); testScope = new NATCallframe(globalLexScope); final NATClosure symbol = new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { return AGSymbol.alloc(arguments.base_at(NATNumber.ONE).asNativeText()); } }; testScope.meta_defineField(AGSymbol.alloc("symbol"), symbol); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.jAlloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); }
1,119,213
public void setUp() throws Exception { globalLexScope = Evaluator.getGlobalLexicalScope(); testScope = new NATCallframe(globalLexScope); final NATClosure symbol = new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { return AGSymbol.alloc(arguments.base_at(NATNumber.ONE).asNativeText()); } }; testScope.meta_defineField(AGSymbol.alloc("symbol"), symbol); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); }
public void setUp() throws Exception { globalLexScope = Evaluator.getGlobalLexicalScope(); testScope = new NATCallframe(globalLexScope); final NATClosure symbol = new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { return AGSymbol.alloc(arguments.base_at(NATNumber.ONE).asNativeText()); } }; testScope.meta_defineField(AGSymbol.alloc("symbol"), symbol); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.jAlloc("nativeException"), globalLexScope))); testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); }
1,119,214
public void testInterpreterExceptionHandling() { try { ATObject globalLexScope = Evaluator.getGlobalLexicalScope(); ATObject testScope = new NATCallframe(globalLexScope); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); ATContext testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); //3. (PYTHON_OBJECT) AT Code catching an interpreter exception evaluateInput( "def pythonObjectMirror := \n" + " mirror: { \n" + " def select( receiver, symbol ) { \n" + " try: { \n" + " super.select( receiver, symbol ); \n" + " } catch: doesNotUnderstandX using: { | e | \n" + " super.defineField( symbol, nil ); \n" + " } \n" + " } \n" + " }; \n" + "def test := object: { nil } \n" + " mirroredBy: pythonObjectMirror; \n" + "(test.x == nil).ifFalse: { fail(); };", testCtx); } catch (InterpreterException e) { e.printStackTrace(); fail("exception: "+ e); } }
public void testInterpreterExceptionHandling() { try { ATObject globalLexScope = Evaluator.getGlobalLexicalScope(); ATObject testScope = new NATCallframe(globalLexScope); testScope.meta_defineField( AGSymbol.jAlloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); ATContext testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); //3. (PYTHON_OBJECT) AT Code catching an interpreter exception evaluateInput( "def pythonObjectMirror := \n" + " mirror: { \n" + " def select( receiver, symbol ) { \n" + " try: { \n" + " super.select( receiver, symbol ); \n" + " } catch: doesNotUnderstandX using: { | e | \n" + " super.defineField( symbol, nil ); \n" + " } \n" + " } \n" + " }; \n" + "def test := object: { nil } \n" + " mirroredBy: pythonObjectMirror; \n" + "(test.x == nil).ifFalse: { fail(); };", testCtx); } catch (InterpreterException e) { e.printStackTrace(); fail("exception: "+ e); } }
1,119,215
public void testInterpreterExceptionHandling() { try { ATObject globalLexScope = Evaluator.getGlobalLexicalScope(); ATObject testScope = new NATCallframe(globalLexScope); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); ATContext testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); //3. (PYTHON_OBJECT) AT Code catching an interpreter exception evaluateInput( "def pythonObjectMirror := \n" + " mirror: { \n" + " def select( receiver, symbol ) { \n" + " try: { \n" + " super.select( receiver, symbol ); \n" + " } catch: doesNotUnderstandX using: { | e | \n" + " super.defineField( symbol, nil ); \n" + " } \n" + " } \n" + " }; \n" + "def test := object: { nil } \n" + " mirroredBy: pythonObjectMirror; \n" + "(test.x == nil).ifFalse: { fail(); };", testCtx); } catch (InterpreterException e) { e.printStackTrace(); fail("exception: "+ e); } }
public void testInterpreterExceptionHandling() { try { ATObject globalLexScope = Evaluator.getGlobalLexicalScope(); ATObject testScope = new NATCallframe(globalLexScope); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.jAlloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); ATContext testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); //3. (PYTHON_OBJECT) AT Code catching an interpreter exception evaluateInput( "def pythonObjectMirror := \n" + " mirror: { \n" + " def select( receiver, symbol ) { \n" + " try: { \n" + " super.select( receiver, symbol ); \n" + " } catch: doesNotUnderstandX using: { | e | \n" + " super.defineField( symbol, nil ); \n" + " } \n" + " } \n" + " }; \n" + "def test := object: { nil } \n" + " mirroredBy: pythonObjectMirror; \n" + "(test.x == nil).ifFalse: { fail(); };", testCtx); } catch (InterpreterException e) { e.printStackTrace(); fail("exception: "+ e); } }
1,119,216
public void testInterpreterExceptionHandling() { try { ATObject globalLexScope = Evaluator.getGlobalLexicalScope(); ATObject testScope = new NATCallframe(globalLexScope); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.alloc("nativeException"), globalLexScope))); ATContext testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); //3. (PYTHON_OBJECT) AT Code catching an interpreter exception evaluateInput( "def pythonObjectMirror := \n" + " mirror: { \n" + " def select( receiver, symbol ) { \n" + " try: { \n" + " super.select( receiver, symbol ); \n" + " } catch: doesNotUnderstandX using: { | e | \n" + " super.defineField( symbol, nil ); \n" + " } \n" + " } \n" + " }; \n" + "def test := object: { nil } \n" + " mirroredBy: pythonObjectMirror; \n" + "(test.x == nil).ifFalse: { fail(); };", testCtx); } catch (InterpreterException e) { e.printStackTrace(); fail("exception: "+ e); } }
public void testInterpreterExceptionHandling() { try { ATObject globalLexScope = Evaluator.getGlobalLexicalScope(); ATObject testScope = new NATCallframe(globalLexScope); testScope.meta_defineField( AGSymbol.alloc("echo:"), new NativeClosure(NATNil._INSTANCE_) { public ATObject base_apply(ATTable arguments) throws InterpreterException { System.out.println(arguments.base_at(NATNumber.ONE).meta_print().javaValue); return NATNil._INSTANCE_; } }); testScope.meta_defineField( AGSymbol.alloc("doesNotUnderstandX"), new NATException(new XSelectorNotFound( AGSymbol.jAlloc("nativeException"), globalLexScope))); ATContext testCtx = new NATContext( testScope, globalLexScope, globalLexScope.meta_getDynamicParent()); //3. (PYTHON_OBJECT) AT Code catching an interpreter exception evaluateInput( "def pythonObjectMirror := \n" + " mirror: { \n" + " def select( receiver, symbol ) { \n" + " try: { \n" + " super.select( receiver, symbol ); \n" + " } catch: doesNotUnderstandX using: { | e | \n" + " super.defineField( symbol, nil ); \n" + " } \n" + " } \n" + " }; \n" + "def test := object: { nil } \n" + " mirroredBy: pythonObjectMirror; \n" + "(test.x == nil).ifFalse: { fail(); };", testCtx); } catch (InterpreterException e) { e.printStackTrace(); fail("exception: "+ e); } }
1,119,217
public VerticalSeismogramDisplay(MouseForwarder mouseForwarder, MouseMotionForwarder motionForwarder){ this.mouseForwarder = mouseForwarder; this.motionForwarder = motionForwarder; seismograms = new JLayeredPane(); seismograms.setLayout(new BoxLayout(seismograms, BoxLayout.Y_AXIS)); this.getViewport().add(seismograms); globalTimeRegistrar = new TimeConfigRegistrar(); globalAmpRegistrar = new AmpConfigRegistrar(new RMeanAmpConfig()); sorter = new SeismogramSorter(); }
public VerticalSeismogramDisplay(MouseForwarder mouseForwarder, MouseMotionForwarder motionForwarder){ this.mouseForwarder = mouseForwarder; this.motionForwarder = motionForwarder; seismograms = new JLayeredPane(); seismograms.setLayout(new BoxLayout(seismograms, BoxLayout.Y_AXIS)); this.getViewport().add(seismograms); globalTimeRegistrar = new TimeConfigRegistrar(); globalAmpRegistrar = new AmpConfigRegistrar(new RMeanAmpConfig()); sorter = new AlphaSeisSorter(); }
1,119,220
public void createSelectionDisplay(BasicSeismogramDisplay creator){ if(selectionDisplay == null){ logger.debug("creating selection display"); selectionDisplay = new VerticalSeismogramDisplay(mouseForwarder, motionForwarder); }}
public void createSelectionDisplay(BasicSeismogramDisplay creator){ if(selectionDisplay == null){ logger.debug("creating selection display"); selectionDisplay = new VerticalSeismogramDisplay(mouseForwarder, motionForwarder); creator.getCurrentSelection().setDisplay(selectionDisplay.addDisplay(first, tr, first.getName() + " " + creator.getCurrentSelection().getColor())); while(e.hasNext()){ selectionDisplay.addSeismogram(((LocalSeismogramImpl)e.next()), 0); } selectionWindow.getContentPane().add(selectionDisplay); Toolkit tk = Toolkit.getDefaultToolkit(); selectionWindow.setLocation(tk.getScreenSize().width, tk.getScreenSize().height); selectionWindow.setVisible(true); }else{ logger.debug("adding another selection"); Iterator e = creator.getSeismograms().iterator(); TimeConfigRegistrar tr = creator.getCurrentSelection().getInternalConfig(); LocalSeismogramImpl first = ((LocalSeismogramImpl)e.next()); AmpConfigRegistrar ar = new AmpConfigRegistrar(new OffsetMeanAmpConfig(first, tr.getTimeRange((LocalSeismogram)first))); ar.visibleAmpCalc(tr); creator.getCurrentSelection().setDisplay(selectionDisplay.addDisplay(first, tr, first.getName() + " " + creator.getCurrentSelection().getColor())); while(e.hasNext()){ selectionDisplay.addSeismogram(((LocalSeismogramImpl)e.next()), 0); } } }
1,119,221
public void removeAll(){ logger.debug("removing all displays"); this.stopImageCreation(); seismograms.removeAll(); remove(seismograms); basicDisplays = new LinkedList(); sorter = new SeismogramSorter(); globalTimeRegistrar = new TimeConfigRegistrar(); globalAmpRegistrar = new AmpConfigRegistrar(new RMeanAmpConfig()); this.time.setText(" Time: "); this.amp.setText(" Amplitude: "); repaint(); }
public void removeAll(){ logger.debug("removing all displays"); this.stopImageCreation(); seismograms.removeAll(); remove(seismograms); basicDisplays = new LinkedList(); sorter = new AlphaSeisSorter(); globalTimeRegistrar = new TimeConfigRegistrar(); globalAmpRegistrar = new AmpConfigRegistrar(new RMeanAmpConfig()); this.time.setText(" Time: "); this.amp.setText(" Amplitude: "); repaint(); }
1,119,222
public void removeSeismogram(MouseEvent me){ BasicSeismogramDisplay clicked = ((BasicSeismogramDisplay)me.getComponent()); clicked.remove(me); seismograms.remove(clicked); basicDisplays.remove(clicked); ((SeismogramDisplay)basicDisplays.getFirst()).addTopTimeBorder(); ((SeismogramDisplay)basicDisplays.getLast()).addBottomTimeBorder(); }
public void removeSeismogram(MouseEvent me){ BasicSeismogramDisplay clicked = ((BasicSeismogramDisplay)me.getComponent()); clicked.remove(); seismograms.remove(clicked); basicDisplays.remove(clicked); ((SeismogramDisplay)basicDisplays.getFirst()).addTopTimeBorder(); ((SeismogramDisplay)basicDisplays.getLast()).addBottomTimeBorder(); }
1,119,223
private boolean setAmpRange(DataSetSeismogram seismo){ AmpConfigData data = (AmpConfigData)ampData.get(seismo); if ( data.getSeismograms().length == 0) { return data.setCleanRange(DisplayUtils.ZERO_RANGE); } // end of if () LocalSeismogramImpl seis = (LocalSeismogramImpl)data.getSeismograms()[0]; int[] seisIndex = DisplayUtils.getSeisPoints(seis, data.getTime()); if(seisIndex[1] < 0 || seisIndex[0] >= seis.getNumPoints()) { //no data points in window, set range to 0 data.setCalcIndex(seisIndex); return data.setCleanRange(DisplayUtils.ZERO_RANGE); } if(seisIndex[0] < 0){ seisIndex[0] = 0; } if(seisIndex[1] >= seis.getNumPoints()){ seisIndex[1] = seis.getNumPoints() -1; } double[] minMaxMean = data.getStatistics(seis).minMaxMean(seisIndex[0], seisIndex[1]); double meanDiff; double maxToMeanDiff = Math.abs(minMaxMean[2] - minMaxMean[1]); double minToMeanDiff = Math.abs(minMaxMean[2] - minMaxMean[0]); if(maxToMeanDiff > minToMeanDiff){ meanDiff = maxToMeanDiff; }else{ meanDiff = minToMeanDiff; } data.setCalcIndex(seisIndex); double min = minMaxMean[2] - meanDiff; double max = minMaxMean[2] + meanDiff; return data.setCleanRange(new UnitRangeImpl(min, max, UnitImpl.COUNT)); }
private boolean setAmpRange(DataSetSeismogram seismo){ AmpConfigData data = (AmpConfigData)ampData.get(seismo); if ( data.getSeismograms().length == 0) { return data.setCleanRange(DisplayUtils.ZERO_RANGE); } // end of if () LocalSeismogramImpl seis = (LocalSeismogramImpl)data.getSeismograms()[0]; int[] seisIndex = DisplayUtils.getSeisPoints(seis, data.getTime()); if(seisIndex[1] < 0 || seisIndex[0] >= seis.getNumPoints()) { //no data points in window, set range to 0 data.setCalcIndex(seisIndex); return data.setCleanRange(DisplayUtils.ZERO_RANGE); } if(seisIndex[0] < 0){ seisIndex[0] = 0; } if(seisIndex[1] >= seis.getNumPoints()){ seisIndex[1] = seis.getNumPoints() -1; } double[] minMaxMean = data.getStatistics(seis).minMaxMean(seisIndex[0], seisIndex[1]); double meanDiff; double maxToMeanDiff = Math.abs(minMaxMean[2] - minMaxMean[1]); double minToMeanDiff = Math.abs(minMaxMean[2] - minMaxMean[0]); if(maxToMeanDiff > minToMeanDiff){ meanDiff = maxToMeanDiff; }else{ meanDiff = minToMeanDiff; } data.setCalcIndex(seisIndex); double min = minMaxMean[2] - meanDiff; double max = minMaxMean[2] + meanDiff; return data.setCleanRange(new UnitRangeImpl(min, max, UnitImpl.COUNT)); }
1,119,225
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences prefs = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
1,119,226
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); prefs.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
1,119,227
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; prefs.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
1,119,228
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(prefs, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
1,119,229
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); prefs.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
1,119,230
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), false, false, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
1,119,231
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); prefs.addSubscription(sub); curView = new BwView(); curView.setName(globals.syspars.getDefaultUserViewName()); curView.addSubscription(defSub); curView.setOwner(o); prefs.addView(curView); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
1,119,232
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(prefs, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
1,119,233
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(p); } } }
private void makePrefs() throws Throwable { Iterator it = globals.usersTbl.values().iterator(); int nextId = 1; if (globals.publicUser == null) { throw new Exception("Public user must be defined"); } while (it.hasNext()) { BwUser o = (BwUser)it.next(); BwPreferences p = new BwPreferences(); p.setId(nextId); nextId++; p.setOwner(o); if (globals.publicUser.equals(o)) { /* Subscribe to all top level collections */ BwCalendar root = globals.publicCalRoot; Iterator calit = root.iterateChildren(); while (calit.hasNext()) { BwCalendar cal = (BwCalendar)calit.next(); addSubscription(p, globals.publicUser, cal, true); } } else { BwCalendar cal = (BwCalendar)globals.defaultCalendars.get( new Integer(o.getId())); p.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); sub.setOwner(o); p.addSubscription(sub); Collection s = globals.subscriptionsTbl.getCalendarids(o); if (s != null) { Iterator subit = s.iterator(); globals.subscribedUsers++; while (subit.hasNext()) { /* Fixing up calendars for move from 2.3.2. Table value is the * id of a calendar * Make up a subscription. */ Integer calid = (Integer)subit.next(); cal = (BwCalendar)globals.filterToCal.get(calid); addSubscription(p, o, cal, true); } } } if (globals.rintf != null) { globals.rintf.restoreUserPrefs(prefs); } } }
1,119,234
public Station[] getSelectedStations(){ LinkedList out = new LinkedList(); Object[] selected = stationList.getSelectedValues(); for ( int i=0; i<selected.length; i++) { LinkedList staList = (LinkedList)stationMap.get(selected[i]); out.addAll(staList); } // end of for () return (Station[])out.toArray(new Station[0]); }
public Station[] getSelectedStations(){ LinkedList out = new LinkedList(); Object[] selected = stationList.getSelectedValues(); for ( int i=0; i<selected.length; i++) { LinkedList staList = (LinkedList)stationMap.get(selected[i]); out.addAll(staList); } // end of for () return (Station[])out.toArray(new Station[0]); }
1,119,237
private void scrollToPlayingFile() { File file = playlist.getPlayingFile(); DefaultListModel listModel = playlist.getListModel(); if (file == null || listModel == null) { return; } int index = listModel.indexOf(file); if (index != -1) { int index0 = index - 5; int index1 = index + 5; while (index0 < 0) { index0++; } while (index1 >= playlist.size()) { index1--; } Rectangle r = list.getCellBounds(index0, index1); list.scrollRectToVisible(r); list.repaint(); } }
private void scrollToPlayingFile() { File file = playlist.getPlayingFile(); DefaultListModel listModel = playlist.getListModel(); if (file == null || listModel == null) { return; } int index = listModel.indexOf(file); if (index != -1) { int index0 = index - 5; int index1 = index + 5; while (index0 < 0) { index0++; } while (index1 >= playlist.size()) { index1--; } Rectangle r = list.getCellBounds(index0, index1); list.scrollRectToVisible(r); list.repaint(); } }
1,119,238
private void scrollToPlayingFile() { File file = playlist.getPlayingFile(); DefaultListModel listModel = playlist.getListModel(); if (file == null || listModel == null) { return; } int index = listModel.indexOf(file); if (index != -1) { int index0 = index - 5; int index1 = index + 5; while (index0 < 0) { index0++; } while (index1 >= playlist.size()) { index1--; } Rectangle r = list.getCellBounds(index0, index1); list.scrollRectToVisible(r); list.repaint(); } }
private void scrollToPlayingFile() { File file = playlist.getPlayingFile(); DefaultListModel listModel = playlist.getListModel(); if (file == null || listModel == null) { return; } int index = listModel.indexOf(file); if (index != -1) { int index0 = index - 5; int index1 = index + 5; while (index0 < 0) { index0++; } while (index1 >= playlist.size()) { index1--; } Point p0 = indexToLocation(index0); Point p1 = indexToLocation(index1); int x = p0.x; int y = p0.y; int width = p1.x - x; int height = p1.y - y; Rectangle r = new Rectangle(x, y, width, height); list.scrollRectToVisible(r); list.repaint(); } }
1,119,239
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.fetchSvci(); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { form.setSubscriptions(svc.getSubscriptions()); return "success"; }
1,119,240
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.fetchSvci(); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.fetchSvci(); return "success"; }
1,119,241
public boolean checkRead(AccessPrincipal who, String owner, char[] aclChars) throws AccessException { return new Acl(debug).evaluateAccess(who, owner, privSetRead, aclChars); }
public boolean checkRead(AccessPrincipal who, String owner, char[] aclChars) throws AccessException { return new Acl(debug).evaluateAccess(who, owner, privSetRead, aclChars); }
1,119,242
public boolean checkReadWrite(AccessPrincipal who, String owner, char[] aclChars) throws AccessException { return new Acl(debug).evaluateAccess(who, owner, privSetReadWrite, aclChars); }
public boolean checkReadWrite(AccessPrincipal who, String owner, char[] aclChars) throws AccessException { return new Acl(debug).evaluateAccess(who, owner, privSetReadWrite, aclChars); }
1,119,243
public boolean evaluateAccess(AccessPrincipal who, String owner, Privilege[] how, String aclString) throws AccessException { return new Acl(debug).evaluateAccess(who, owner, how, aclString.toCharArray()); }
public boolean evaluateAccess(AccessPrincipal who, String owner, Privilege[] how, String aclString) throws AccessException { return new Acl(debug).evaluateAccess(who, owner, how, aclString.toCharArray()); }
1,119,244
public void setNetworkDCs(NetworkDCOperations[] netdcgiven) { netdc = netdcgiven; channels.clear(); sites.clear(); clearStations(); networks.clear(); for (int i=0; i<netdcgiven.length; i++) { NetworkLoader networkLoader = new NetworkLoader(netdcgiven[i]); if (netdcgiven.length == 1 || ! showNetworks) { networkLoader.setDoSelect(true); } else { networkLoader.setDoSelect(false); } // end of else networkLoader.start(); } // end of for (int i=0; i<netdcgiven.length; i++) }
public void setNetworkDCs(NetworkDCOperations[] netdcgiven) { netdc = netdcgiven; channels.clear(); sites.clear(); clearStations(); networks.clear(); for (int i=0; i<netdcgiven.length; i++) { NetworkLoader networkLoader = new NetworkLoader(netdcgiven[i]); if ( ! showNetworks) { networkLoader.setDoSelect(true); } else { networkLoader.setDoSelect(false); } // end of else networkLoader.start(); } // end of for (int i=0; i<netdcgiven.length; i++) }
1,119,245
public static int[][] compressXvalues(LocalSeismogram seismogram, MicroSecondTimeRange timeRange, Dimension size) throws CodecException { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; int[][] out = new int[2][]; int seisIndex = 0; int pixelIndex = 0; int numAdded = 0; if ( seis.getEndTime().before(timeRange.getBeginTime()) || seis.getBeginTime().after(timeRange.getEndTime()) ) { out[0] = new int[0]; out[1] = new int[0]; logger.info("The end time is before the beginTime in simple seismogram"); return out; } MicroSecondDate tMin = timeRange.getBeginTime(); MicroSecondDate tMax = timeRange.getEndTime(); int seisStartIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMin); int seisEndIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMax); if (seisStartIndex < 0) { seisStartIndex = 0; } if (seisEndIndex >= seis.getNumPoints()) { seisEndIndex = seis.getNumPoints()-1; } MicroSecondDate tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisStartIndex); int pixelStartIndex = getPixel(size.width, tMin, tMax, tempdate); tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisEndIndex); int pixelEndIndex = getPixel(size.width, tMin, tMax, tempdate); int pixels = seisEndIndex - seisStartIndex + 1; out[0] = new int[2*pixels]; out[1] = new int[out[0].length]; int tempYvalues[] = new int [out[0].length]; seisIndex = seisStartIndex; numAdded = 0; int xvalue = 0; int tempValue = 0; xvalue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); seisIndex++; int j; j = 0; while (seisIndex <= seisEndIndex) { tempValue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); tempYvalues[j++] = (int)seis.getValueAt(seisIndex).getValue(); if(tempValue != xvalue) { out[0][numAdded] = xvalue; out[0][numAdded+1] = xvalue; out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, j-1); j = 0; xvalue = tempValue; numAdded = numAdded+2; } seisIndex++; } xvalue = tempValue; /*if(j == 0){ out[1][numAdded] = getMinValue(tempYvalues, 0, 0); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, 0); } else{ out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded + 1] = (int)getMaxValue(tempYvalues, 0, j-1); }*/ int temp[][] = new int[2][numAdded]; System.arraycopy(out[0], 0, temp[0], 0, numAdded); System.arraycopy(out[1], 0, temp[1], 0, numAdded); return temp; }
public static int[][] compressXvalues(LocalSeismogram seismogram, MicroSecondTimeRange timeRange, Dimension size) throws CodecException { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; int[][] out = new int[2][]; int seisIndex = 0; int numAdded = 0; if ( seis.getEndTime().before(timeRange.getBeginTime()) || seis.getBeginTime().after(timeRange.getEndTime()) ) { out[0] = new int[0]; out[1] = new int[0]; logger.info("The end time is before the beginTime in simple seismogram"); return out; } MicroSecondDate tMin = timeRange.getBeginTime(); MicroSecondDate tMax = timeRange.getEndTime(); int seisStartIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMin); int seisEndIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMax); if (seisStartIndex < 0) { seisStartIndex = 0; } if (seisEndIndex >= seis.getNumPoints()) { seisEndIndex = seis.getNumPoints()-1; } MicroSecondDate tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisStartIndex); int pixelStartIndex = getPixel(size.width, tMin, tMax, tempdate); tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisEndIndex); int pixelEndIndex = getPixel(size.width, tMin, tMax, tempdate); int pixels = seisEndIndex - seisStartIndex + 1; out[0] = new int[2*pixels]; out[1] = new int[out[0].length]; int tempYvalues[] = new int [out[0].length]; seisIndex = seisStartIndex; numAdded = 0; int xvalue = 0; int tempValue = 0; xvalue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); seisIndex++; int j; j = 0; while (seisIndex <= seisEndIndex) { tempValue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); tempYvalues[j++] = (int)seis.getValueAt(seisIndex).getValue(); if(tempValue != xvalue) { out[0][numAdded] = xvalue; out[0][numAdded+1] = xvalue; out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, j-1); j = 0; xvalue = tempValue; numAdded = numAdded+2; } seisIndex++; } xvalue = tempValue; /*if(j == 0){ out[1][numAdded] = getMinValue(tempYvalues, 0, 0); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, 0); } else{ out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded + 1] = (int)getMaxValue(tempYvalues, 0, j-1); }*/ int temp[][] = new int[2][numAdded]; System.arraycopy(out[0], 0, temp[0], 0, numAdded); System.arraycopy(out[1], 0, temp[1], 0, numAdded); return temp; }
1,119,246
public static int[][] compressXvalues(LocalSeismogram seismogram, MicroSecondTimeRange timeRange, Dimension size) throws CodecException { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; int[][] out = new int[2][]; int seisIndex = 0; int pixelIndex = 0; int numAdded = 0; if ( seis.getEndTime().before(timeRange.getBeginTime()) || seis.getBeginTime().after(timeRange.getEndTime()) ) { out[0] = new int[0]; out[1] = new int[0]; logger.info("The end time is before the beginTime in simple seismogram"); return out; } MicroSecondDate tMin = timeRange.getBeginTime(); MicroSecondDate tMax = timeRange.getEndTime(); int seisStartIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMin); int seisEndIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMax); if (seisStartIndex < 0) { seisStartIndex = 0; } if (seisEndIndex >= seis.getNumPoints()) { seisEndIndex = seis.getNumPoints()-1; } MicroSecondDate tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisStartIndex); int pixelStartIndex = getPixel(size.width, tMin, tMax, tempdate); tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisEndIndex); int pixelEndIndex = getPixel(size.width, tMin, tMax, tempdate); int pixels = seisEndIndex - seisStartIndex + 1; out[0] = new int[2*pixels]; out[1] = new int[out[0].length]; int tempYvalues[] = new int [out[0].length]; seisIndex = seisStartIndex; numAdded = 0; int xvalue = 0; int tempValue = 0; xvalue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); seisIndex++; int j; j = 0; while (seisIndex <= seisEndIndex) { tempValue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); tempYvalues[j++] = (int)seis.getValueAt(seisIndex).getValue(); if(tempValue != xvalue) { out[0][numAdded] = xvalue; out[0][numAdded+1] = xvalue; out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, j-1); j = 0; xvalue = tempValue; numAdded = numAdded+2; } seisIndex++; } xvalue = tempValue; /*if(j == 0){ out[1][numAdded] = getMinValue(tempYvalues, 0, 0); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, 0); } else{ out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded + 1] = (int)getMaxValue(tempYvalues, 0, j-1); }*/ int temp[][] = new int[2][numAdded]; System.arraycopy(out[0], 0, temp[0], 0, numAdded); System.arraycopy(out[1], 0, temp[1], 0, numAdded); return temp; }
public static int[][] compressXvalues(LocalSeismogram seismogram, MicroSecondTimeRange timeRange, Dimension size) throws CodecException { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; int[][] out = new int[2][]; int seisIndex = 0; int pixelIndex = 0; int numAdded = 0; if ( seis.getEndTime().before(timeRange.getBeginTime()) || seis.getBeginTime().after(timeRange.getEndTime()) ) { out[0] = new int[0]; out[1] = new int[0]; logger.info("The end time is before the beginTime in simple seismogram"); return out; } MicroSecondDate tMin = timeRange.getBeginTime(); MicroSecondDate tMax = timeRange.getEndTime(); int seisStartIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMin); int seisEndIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMax); if (seisStartIndex < 0) { seisStartIndex = 0; } if (seisEndIndex >= seis.getNumPoints()) { seisEndIndex = seis.getNumPoints()-1; } MicroSecondDate tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisStartIndex); int pixelStartIndex = getPixel(size.width, tMin, tMax, tempdate); tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisEndIndex); int pixelEndIndex = getPixel(size.width, tMin, tMax, tempdate); int pixels = seisEndIndex - seisStartIndex + 1; out[0] = new int[2*pixels]; out[1] = new int[out[0].length]; int tempYvalues[] = new int [out[0].length]; seisIndex = seisStartIndex; numAdded = 0; int xvalue = 0; int tempValue = 0; xvalue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); seisIndex++; int j; j = 0; while (seisIndex <= seisEndIndex) { tempValue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); tempYvalues[j++] = (int)seis.getValueAt(seisIndex).getValue(); if(tempValue != xvalue) { out[0][numAdded] = xvalue; out[0][numAdded+1] = xvalue; out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded+1] = getMaxValue(tempYvalues, 0, j-1); j = 0; xvalue = tempValue; numAdded = numAdded+2; } seisIndex++; } xvalue = tempValue; /*if(j == 0){ out[1][numAdded] = getMinValue(tempYvalues, 0, 0); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, 0); } else{ out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded + 1] = (int)getMaxValue(tempYvalues, 0, j-1); }*/ int temp[][] = new int[2][numAdded]; System.arraycopy(out[0], 0, temp[0], 0, numAdded); System.arraycopy(out[1], 0, temp[1], 0, numAdded); return temp; }
1,119,247
protected static int[][] compressYvalues(LocalSeismogram seismogram, MicroSecondTimeRange tr, UnitRangeImpl ampRange, Dimension size)throws CodecException { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; /*double pointsPerPixel = tr.getInterval().divideBy(seis.getSampling().getPeriod()).getValue() / size.width; if(pointsPerPixel < 3 ){ return getPlottableSimpl(seis, ampRange, tr, size); }else{*/ int[][] uncomp = compressXvalues(seismogram, tr, size); // enough points to take the extra time to compress the line int[][] comp = new int[2][2 * size.width]; int j = 0, startIndex = 0, xvalue = 0, endIndex = 0; if(uncomp[0].length != 0) xvalue = uncomp[0][0]; for(int i = 0; i < uncomp[0].length; i++) { if(uncomp[0][i] != xvalue) { endIndex = i - 1; comp[1][j] = getMinValue(uncomp[1], startIndex, endIndex); comp[1][j+1] = (int)getMaxValue(uncomp[1], startIndex, endIndex); comp[0][j] = uncomp[0][i]; comp[0][j+1] = uncomp[0][i]; j = j + 2; startIndex = endIndex + 1; xvalue = uncomp[0][i]; } } if(xvalue != 0) { startIndex = uncomp[0].length - 1; endIndex = uncomp[0].length - 1; comp[1][j] = getMinValue(uncomp[1], startIndex, endIndex); comp[1][j+1] = (int)getMaxValue(uncomp[1], startIndex, endIndex); comp[0][j] = uncomp[0][endIndex]; comp[0][j+1] = uncomp[0][endIndex]; j = j + 2; } int temp[][] = new int[2][j]; System.arraycopy(comp[0], 0, temp[0], 0, j); System.arraycopy(comp[1], 0, temp[1], 0, j); return temp; }
protected static int[][] compressYvalues(LocalSeismogram seismogram, MicroSecondTimeRange tr, UnitRangeImpl ampRange, Dimension size)throws CodecException { /*double pointsPerPixel = tr.getInterval().divideBy(seis.getSampling().getPeriod()).getValue() / size.width; if(pointsPerPixel < 3 ){ return getPlottableSimpl(seis, ampRange, tr, size); }else{*/ int[][] uncomp = compressXvalues(seismogram, tr, size); // enough points to take the extra time to compress the line int[][] comp = new int[2][2 * size.width]; int j = 0, startIndex = 0, xvalue = 0, endIndex = 0; if(uncomp[0].length != 0) xvalue = uncomp[0][0]; for(int i = 0; i < uncomp[0].length; i++) { if(uncomp[0][i] != xvalue) { endIndex = i - 1; comp[1][j] = getMinValue(uncomp[1], startIndex, endIndex); comp[1][j+1] = (int)getMaxValue(uncomp[1], startIndex, endIndex); comp[0][j] = uncomp[0][i]; comp[0][j+1] = uncomp[0][i]; j = j + 2; startIndex = endIndex + 1; xvalue = uncomp[0][i]; } } if(xvalue != 0) { startIndex = uncomp[0].length - 1; endIndex = uncomp[0].length - 1; comp[1][j] = getMinValue(uncomp[1], startIndex, endIndex); comp[1][j+1] = (int)getMaxValue(uncomp[1], startIndex, endIndex); comp[0][j] = uncomp[0][endIndex]; comp[0][j+1] = uncomp[0][endIndex]; j = j + 2; } int temp[][] = new int[2][j]; System.arraycopy(comp[0], 0, temp[0], 0, j); System.arraycopy(comp[1], 0, temp[1], 0, j); return temp; }
1,119,248
protected static int[][] compressYvalues(LocalSeismogram seismogram, MicroSecondTimeRange tr, UnitRangeImpl ampRange, Dimension size)throws CodecException { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; /*double pointsPerPixel = tr.getInterval().divideBy(seis.getSampling().getPeriod()).getValue() / size.width; if(pointsPerPixel < 3 ){ return getPlottableSimpl(seis, ampRange, tr, size); }else{*/ int[][] uncomp = compressXvalues(seismogram, tr, size); // enough points to take the extra time to compress the line int[][] comp = new int[2][2 * size.width]; int j = 0, startIndex = 0, xvalue = 0, endIndex = 0; if(uncomp[0].length != 0) xvalue = uncomp[0][0]; for(int i = 0; i < uncomp[0].length; i++) { if(uncomp[0][i] != xvalue) { endIndex = i - 1; comp[1][j] = getMinValue(uncomp[1], startIndex, endIndex); comp[1][j+1] = (int)getMaxValue(uncomp[1], startIndex, endIndex); comp[0][j] = uncomp[0][i]; comp[0][j+1] = uncomp[0][i]; j = j + 2; startIndex = endIndex + 1; xvalue = uncomp[0][i]; } } if(xvalue != 0) { startIndex = uncomp[0].length - 1; endIndex = uncomp[0].length - 1; comp[1][j] = getMinValue(uncomp[1], startIndex, endIndex); comp[1][j+1] = (int)getMaxValue(uncomp[1], startIndex, endIndex); comp[0][j] = uncomp[0][endIndex]; comp[0][j+1] = uncomp[0][endIndex]; j = j + 2; } int temp[][] = new int[2][j]; System.arraycopy(comp[0], 0, temp[0], 0, j); System.arraycopy(comp[1], 0, temp[1], 0, j); return temp; }
protected static int[][] compressYvalues(LocalSeismogram seismogram, MicroSecondTimeRange tr, UnitRangeImpl ampRange, Dimension size)throws CodecException { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; /*double pointsPerPixel = tr.getInterval().divideBy(seis.getSampling().getPeriod()).getValue() / size.width; if(pointsPerPixel < 3 ){ return getPlottableSimpl(seis, ampRange, tr, size); }else{*/ int[][] uncomp = compressXvalues(seismogram, tr, size); // enough points to take the extra time to compress the line int[][] comp = new int[2][2 * size.width]; int j = 0, startIndex = 0, xvalue = 0, endIndex = 0; if(uncomp[0].length != 0) xvalue = uncomp[0][0]; for(int i = 0; i < uncomp[0].length; i++) { if(uncomp[0][i] != xvalue) { endIndex = i - 1; comp[1][j] = getMinValue(uncomp[1], startIndex, endIndex); comp[1][j+1] = getMaxValue(uncomp[1], startIndex, endIndex); comp[0][j] = uncomp[0][i]; comp[0][j+1] = uncomp[0][i]; j = j + 2; startIndex = endIndex + 1; xvalue = uncomp[0][i]; } } if(xvalue != 0) { startIndex = uncomp[0].length - 1; endIndex = uncomp[0].length - 1; comp[1][j] = getMinValue(uncomp[1], startIndex, endIndex); comp[1][j+1] = getMaxValue(uncomp[1], startIndex, endIndex); comp[0][j] = uncomp[0][endIndex]; comp[0][j+1] = uncomp[0][endIndex]; j = j + 2; } int temp[][] = new int[2][j]; System.arraycopy(comp[0], 0, temp[0], 0, j); System.arraycopy(comp[1], 0, temp[1], 0, j); return temp; }
1,119,249
public static LocalSeismogramImpl createCustomSineWave(){ int[] dataBits = new int[1200]; double tmpDouble; for (int i=0; i<dataBits.length; i++) { dataBits[i] = (int)Math.round(Math.sin(0 + i*Math.PI*1/20.0)*1000); } return createTestData("Sine Wave", dataBits, new edu.iris.Fissures.Time("19911015T163000.000Z", -1)); }
public static LocalSeismogramImpl createCustomSineWave(){ int[] dataBits = new int[1200]; for (int i=0; i<dataBits.length; i++) { dataBits[i] = (int)Math.round(Math.sin(0 + i*Math.PI*1/20.0)*1000); } return createTestData("Sine Wave", dataBits, new edu.iris.Fissures.Time("19911015T163000.000Z", -1)); }
1,119,250
public static LocalSeismogramImpl createHighSineWave(double phase, double hertz) { int[] dataBits = new int[120]; double tmpDouble; for (int i=0; i<dataBits.length; i++) { dataBits[i] = (int)Math.round(Math.sin(phase + i*Math.PI*hertz/20.0)*1000.0+500); } return createTestData("Sine Wave, phase "+phase+" hertz "+hertz, dataBits); }
public static LocalSeismogramImpl createHighSineWave(double phase, double hertz) { int[] dataBits = new int[120]; for (int i=0; i<dataBits.length; i++) { dataBits[i] = (int)Math.round(Math.sin(phase + i*Math.PI*hertz/20.0)*1000.0+500); } return createTestData("Sine Wave, phase "+phase+" hertz "+hertz, dataBits); }
1,119,251
public static LocalSeismogramImpl createLowSineWave(double phase, double hertz) { int[] dataBits = new int[120]; double tmpDouble; for (int i=0; i<dataBits.length; i++) { dataBits[i] = (int)Math.round(Math.sin(phase + i*Math.PI*hertz/20.0)*1000.0-500); } return createTestData("Sine Wave, phase "+phase+" hertz "+hertz, dataBits); }
public static LocalSeismogramImpl createLowSineWave(double phase, double hertz) { int[] dataBits = new int[120]; for (int i=0; i<dataBits.length; i++) { dataBits[i] = (int)Math.round(Math.sin(phase + i*Math.PI*hertz/20.0)*1000.0-500); } return createTestData("Sine Wave, phase "+phase+" hertz "+hertz, dataBits); }
1,119,252
protected static void scaleYvalues(int[][] comp, LocalSeismogram seismogram, MicroSecondTimeRange tr, UnitRangeImpl ampRange, Dimension size) { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; double yMin = ampRange.getMinValue(); double yMax = ampRange.getMaxValue(); for( int i =0 ; i < comp[1].length; i++) { comp[1][i] = Math.round((float)(linearInterp(yMin, 0, yMax, size.height, comp[1][i]))); } }
protected static void scaleYvalues(int[][] comp, LocalSeismogram seismogram, MicroSecondTimeRange tr, UnitRangeImpl ampRange, Dimension size) { double yMin = ampRange.getMinValue(); double yMax = ampRange.getMaxValue(); for( int i =0 ; i < comp[1].length; i++) { comp[1][i] = Math.round((float)(linearInterp(yMin, 0, yMax, size.height, comp[1][i]))); } }
1,119,253
protected List createStyles(View view) { List styles = new ArrayList(); styles.add(NotationFactory.eINSTANCE.createDrawerStyle()); styles.add(NotationFactory.eINSTANCE.createSortingStyle()); styles.add(NotationFactory.eINSTANCE.createFilteringStyle()); return styles; }
protected List createStyles(View view) { List styles = new ArrayList(); styles.add(NotationFactory.eINSTANCE.createSortingStyle()); styles.add(NotationFactory.eINSTANCE.createFilteringStyle()); return styles; }
1,119,254
public void createParticleDisplay(BasicSeismogramDisplay creator, boolean advancedOption){ if(particleAllowed){ if(particleDisplay == null){ particleDisplay = new ParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms()[0], creator.getRegistrar(), advancedOption); if(particleDisplay.getInitializationStatus()){ logger.debug("creating particle display"); particleWindow = new JFrame(particleWindowName); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleDisplay.removeAll(); particleDisplays--; } }); JPanel displayPanel = new JPanel(); /*JButton zoomIn = new JButton("Zoom In"); JButton zoomOut = new JButton("Zoom Out"); zoomIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomIn(true); // particleDisplay.setZoomOut(false); } }); zoomOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomOut(true); // particleDisplay.setZoomIn(false); } }); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(zoomIn); buttonPanel.add(zoomOut);*/ displayPanel.setLayout(new BorderLayout()); displayPanel.add(particleDisplay, java.awt.BorderLayout.CENTER); //displayPanel.add(buttonPanel, java.awt.BorderLayout.SOUTH); java.awt.Dimension size = new java.awt.Dimension(400, 400); displayPanel.setSize(size); particleWindow.getContentPane().add(displayPanel); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleWindow.dispose(); particleDisplay = null; } }); particleWindow.setSize(size); Toolkit tk = Toolkit.getDefaultToolkit(); if(particleWindow.getSize().width*particleDisplays < tk.getScreenSize().width){ particleWindow.setLocation(particleWindow.getSize().width * particleDisplays, tk.getScreenSize().height - particleWindow.getSize().width); }else{ particleWindow.setLocation(tk.getScreenSize().width - particleWindow.getSize().width, tk.getScreenSize().height - particleWindow.getSize().height); } particleDisplays++; particleWindow.setVisible(true); }else{ particleDisplay = null; JOptionPane.showMessageDialog(null, "The other components weren't found to create the Particle Motion Display, so it can't be created.", "Other Components not found", JOptionPane.WARNING_MESSAGE); } }else { particleDisplay.addParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms()[0], creator.getRegistrar()); particleWindow.toFront(); } // end of else }else{ JOptionPane.showMessageDialog(null, "Particle motion isn't allowed from this display!", "Particle Motion Display Creation", JOptionPane.ERROR_MESSAGE); } }
public void createParticleDisplay(BasicSeismogramDisplay creator, boolean advancedOption){ if(particleAllowed){ if(particleDisplay == null){ particleDisplay = new ParticleMotionDisplay(creator.getSeismograms()[0], creator.getRegistrar(), advancedOption); if(particleDisplay.getInitializationStatus()){ logger.debug("creating particle display"); particleWindow = new JFrame(particleWindowName); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleDisplay.removeAll(); particleDisplays--; } }); JPanel displayPanel = new JPanel(); /*JButton zoomIn = new JButton("Zoom In"); JButton zoomOut = new JButton("Zoom Out"); zoomIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomIn(true); // particleDisplay.setZoomOut(false); } }); zoomOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomOut(true); // particleDisplay.setZoomIn(false); } }); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(zoomIn); buttonPanel.add(zoomOut);*/ displayPanel.setLayout(new BorderLayout()); displayPanel.add(particleDisplay, java.awt.BorderLayout.CENTER); //displayPanel.add(buttonPanel, java.awt.BorderLayout.SOUTH); java.awt.Dimension size = new java.awt.Dimension(400, 400); displayPanel.setSize(size); particleWindow.getContentPane().add(displayPanel); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleWindow.dispose(); particleDisplay = null; } }); particleWindow.setSize(size); Toolkit tk = Toolkit.getDefaultToolkit(); if(particleWindow.getSize().width*particleDisplays < tk.getScreenSize().width){ particleWindow.setLocation(particleWindow.getSize().width * particleDisplays, tk.getScreenSize().height - particleWindow.getSize().width); }else{ particleWindow.setLocation(tk.getScreenSize().width - particleWindow.getSize().width, tk.getScreenSize().height - particleWindow.getSize().height); } particleDisplays++; particleWindow.setVisible(true); }else{ particleDisplay = null; JOptionPane.showMessageDialog(null, "The other components weren't found to create the Particle Motion Display, so it can't be created.", "Other Components not found", JOptionPane.WARNING_MESSAGE); } }else { particleDisplay.addParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms()[0], creator.getRegistrar()); particleWindow.toFront(); } // end of else }else{ JOptionPane.showMessageDialog(null, "Particle motion isn't allowed from this display!", "Particle Motion Display Creation", JOptionPane.ERROR_MESSAGE); } }
1,119,257
public void createParticleDisplay(BasicSeismogramDisplay creator, boolean advancedOption){ if(particleAllowed){ if(particleDisplay == null){ particleDisplay = new ParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms()[0], creator.getRegistrar(), advancedOption); if(particleDisplay.getInitializationStatus()){ logger.debug("creating particle display"); particleWindow = new JFrame(particleWindowName); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleDisplay.removeAll(); particleDisplays--; } }); JPanel displayPanel = new JPanel(); /*JButton zoomIn = new JButton("Zoom In"); JButton zoomOut = new JButton("Zoom Out"); zoomIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomIn(true); // particleDisplay.setZoomOut(false); } }); zoomOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomOut(true); // particleDisplay.setZoomIn(false); } }); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(zoomIn); buttonPanel.add(zoomOut);*/ displayPanel.setLayout(new BorderLayout()); displayPanel.add(particleDisplay, java.awt.BorderLayout.CENTER); //displayPanel.add(buttonPanel, java.awt.BorderLayout.SOUTH); java.awt.Dimension size = new java.awt.Dimension(400, 400); displayPanel.setSize(size); particleWindow.getContentPane().add(displayPanel); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleWindow.dispose(); particleDisplay = null; } }); particleWindow.setSize(size); Toolkit tk = Toolkit.getDefaultToolkit(); if(particleWindow.getSize().width*particleDisplays < tk.getScreenSize().width){ particleWindow.setLocation(particleWindow.getSize().width * particleDisplays, tk.getScreenSize().height - particleWindow.getSize().width); }else{ particleWindow.setLocation(tk.getScreenSize().width - particleWindow.getSize().width, tk.getScreenSize().height - particleWindow.getSize().height); } particleDisplays++; particleWindow.setVisible(true); }else{ particleDisplay = null; JOptionPane.showMessageDialog(null, "The other components weren't found to create the Particle Motion Display, so it can't be created.", "Other Components not found", JOptionPane.WARNING_MESSAGE); } }else { particleDisplay.addParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms()[0], creator.getRegistrar()); particleWindow.toFront(); } // end of else }else{ JOptionPane.showMessageDialog(null, "Particle motion isn't allowed from this display!", "Particle Motion Display Creation", JOptionPane.ERROR_MESSAGE); } }
public void createParticleDisplay(BasicSeismogramDisplay creator, boolean advancedOption){ if(particleAllowed){ if(particleDisplay == null){ particleDisplay = new ParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms()[0], creator.getRegistrar(), advancedOption); if(particleDisplay.getInitializationStatus()){ logger.debug("creating particle display"); particleWindow = new JFrame(particleWindowName); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleDisplay.removeAll(); particleDisplays--; } }); JPanel displayPanel = new JPanel(); /*JButton zoomIn = new JButton("Zoom In"); JButton zoomOut = new JButton("Zoom Out"); zoomIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomIn(true); // particleDisplay.setZoomOut(false); } }); zoomOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomOut(true); // particleDisplay.setZoomIn(false); } }); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(zoomIn); buttonPanel.add(zoomOut);*/ displayPanel.setLayout(new BorderLayout()); displayPanel.add(particleDisplay, java.awt.BorderLayout.CENTER); //displayPanel.add(buttonPanel, java.awt.BorderLayout.SOUTH); java.awt.Dimension size = new java.awt.Dimension(400, 400); displayPanel.setSize(size); particleWindow.getContentPane().add(displayPanel); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleWindow.dispose(); particleDisplay = null; } }); particleWindow.setSize(size); Toolkit tk = Toolkit.getDefaultToolkit(); if(particleWindow.getSize().width*particleDisplays < tk.getScreenSize().width){ particleWindow.setLocation(particleWindow.getSize().width * particleDisplays, tk.getScreenSize().height - particleWindow.getSize().width); }else{ particleWindow.setLocation(tk.getScreenSize().width - particleWindow.getSize().width, tk.getScreenSize().height - particleWindow.getSize().height); } particleDisplays++; particleWindow.setVisible(true); }else{ particleDisplay = null; JOptionPane.showMessageDialog(null, "The other components weren't found to create the Particle Motion Display, so it can't be created.", "Other Components not found", JOptionPane.WARNING_MESSAGE); } }else { particleDisplay.addParticleMotionDisplay(creator.getSeismograms()[0], creator.getRegistrar()); particleWindow.toFront(); } // end of else }else{ JOptionPane.showMessageDialog(null, "Particle motion isn't allowed from this display!", "Particle Motion Display Creation", JOptionPane.ERROR_MESSAGE); } }
1,119,258
private void initializeResponseWriter(FacesContext ctx) throws FacesException { //check if running in httpservlet environment boolean httpServletEnv = true; if (!(ctx.getExternalContext().getRequest() instanceof HttpServletRequest)) { throw new InternalServerException("Smile currently does not support environments other than Http Servlet Environment."); } HttpServletRequest request = (HttpServletRequest) ctx.getExternalContext().getRequest(); HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse(); String contextType = "text/html"; String characterEncoding = request.getCharacterEncoding(); try { ResponseWriter responseWriter = new HtmlResponseWriterImpl(response.getWriter(),contextType,characterEncoding);// ResponseWriter responseWriter = new ResponseWriterImplDecorated(response.getWriter(),contextType,characterEncoding); ctx.setResponseWriter(responseWriter); } catch (IOException e) { throw new FacesException(e.getMessage(),e); } }
private void initializeResponseWriter(FacesContext ctx) throws FacesException { //check if running in httpservlet environment boolean httpServletEnv = true; if (!(ctx.getExternalContext().getRequest() instanceof HttpServletRequest)) { throw new RuntimeException("CbpViewHandler: idegaWeb currently does not support environments other than Http Servlet Environment."); } HttpServletRequest request = (HttpServletRequest) ctx.getExternalContext().getRequest(); HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse(); String contextType = "text/html"; String characterEncoding = request.getCharacterEncoding(); try { ResponseWriter responseWriter = new HtmlResponseWriterImpl(response.getWriter(),contextType,characterEncoding);// ResponseWriter responseWriter = new ResponseWriterImplDecorated(response.getWriter(),contextType,characterEncoding); ctx.setResponseWriter(responseWriter); } catch (IOException e) { throw new FacesException(e.getMessage(),e); } }
1,119,259
private void renderComponent(UIComponent component, FacesContext ctx) { try { component.encodeBegin(ctx); if(component.getRendersChildren()) { component.encodeChildren(ctx); } else { Iterator it; UIComponent currentChild; it = component.getChildren().iterator(); while(it.hasNext()) { currentChild = (UIComponent) it.next(); renderComponent(currentChild,ctx); } } if (component instanceof Screen) { writeState(ctx); } component.encodeEnd(ctx); } catch(IOException e) { log.error("Component <" + component.getId() + "> could not render ! Continuing rendering of view <" + ctx.getViewRoot().getViewId() + ">..."); } }
private void renderComponent(UIComponent component, FacesContext ctx) { try { component.encodeBegin(ctx); if(component.getRendersChildren()) { component.encodeChildren(ctx); } else { Iterator it; UIComponent currentChild; it = component.getChildren().iterator(); while(it.hasNext()) { currentChild = (UIComponent) it.next(); renderComponent(currentChild,ctx); } } if (component instanceof Screen) { writeState(ctx); } component.encodeEnd(ctx); } catch(IOException e) { log.error("Component <" + component.getId() + "> could not render ! Continuing rendering of view <" + ctx.getViewRoot().getViewId() + ">..."); } }
1,119,260
public ParamFilter(String name, boolean isDefined) { this.name = name; this.isDefined = isDefined; }
public ParamFilter(String name, boolean isNotDefined) { this.name = name; this.isDefined = isDefined; }
1,119,261
public ParamFilter(String name, boolean isDefined) { this.name = name; this.isDefined = isDefined; }
public ParamFilter(String name, boolean isDefined) { this.name = name; this.isNotDefined = isNotDefined; }
1,119,262
public void run() { setProgressOwner(this); CacheNetworkAccess cache; logger.debug("Before networks"); if(configuredNetworks == null || configuredNetworks.length == 0) { NetworkAccess[] nets = netdc.a_finder().retrieve_all(); netDCToNetMap.put(netdc, nets); setProgressMax(this, nets.length+1); int progressVal = 1; setProgressValue(this, progressVal); progressVal++; logger.debug("Got all networks, num="+nets.length); for (int i=0; i<nets.length; i++) { // skip null networks...probably a bug on the server if (nets[i] != null) { // cache = new CacheNetworkAccess(nets[i]); cache = new DNDNetworkAccess(nets[i]); NetworkAttr attr = cache.get_attributes(); netIdToNetMap.put(NetworkIdUtil.toString(cache.get_attributes().get_id()), cache); logger.debug("Got attributes "+attr.get_code()); // preload attributes networks.addElement(cache); } else { logger.warn("a networkaccess returned from NetworkFinder.retrieve_all() is null, skipping."); } // end of else setProgressValue(this, progressVal); progressVal++; } } else { //when the channelChooser is configured with networkCodes.... int totalNetworks = 0; setProgressMax(this, configuredNetworks.length); for(int counter = 0; counter < configuredNetworks.length; counter++) { try { logger.debug("Getting network for "+configuredNetworks[counter]); NetworkAccess[] nets = netdc.a_finder().retrieve_by_code(configuredNetworks[counter]); logger.debug("Got "+nets.length+" networks for "+configuredNetworks[counter]); for(int subCounter = 0; subCounter < nets.length; subCounter++) { if (nets[subCounter] != null) { // cache = new CacheNetworkAccess(nets[subCounter]); cache = new DNDNetworkAccess(nets[subCounter]); NetworkAttr attr = cache.get_attributes(); NetworkAccess[] storedNets = (NetworkAccess[])netDCToNetMap.get(netdc); if ( storedNets == null) { storedNets = new NetworkAccess[1]; storedNets[0] = cache; netDCToNetMap.put(netdc, storedNets); } else { NetworkAccess[] tmp = new NetworkAccess[storedNets.length+1]; System.arraycopy(storedNets, 0, tmp, 0, storedNets.length); tmp[storedNets.length] = cache; netDCToNetMap.put(netdc, tmp); } // end of else netIdToNetMap.put(NetworkIdUtil.toString(cache.get_attributes().get_id()), cache); logger.debug("Got attributes "+attr.get_code()); // preload attributes networks.addElement(cache); totalNetworks++; } else { logger.warn("a networkaccess returned from NetworkFinder.retrieve_by_code is null, skipping."); } // end of else }//end of inner for subCounter = 0; }catch(NetworkNotFound nnfe) { logger.warn("Network "+configuredNetworks[counter]+" not found while getting network access uding NetworkFinder.retrieve_by_code"); } setProgressValue(this, counter+1); }//end of outer for counter = 0; }//end of if else checking for configuredNetworks == null if (doSelect) { // need to do this later to give java Event thread time to set // up network list before setting selection SwingUtilities.invokeLater(new Runnable() { public void run() { networkList.getSelectionModel().setSelectionInterval(0, networkList.getModel().getSize()-1); } }); } // end of if () setProgressValue(this, progressBar.getMaximum()); }
public void run() { setProgressOwner(this); CacheNetworkAccess cache; logger.debug("Before networks"); if(configuredNetworks == null || configuredNetworks.length == 0) { NetworkAccess[] nets = netdc.a_finder().retrieve_all(); netDCToNetMap.put(netdc, nets); setProgressMax(this, nets.length+1); int progressVal = 1; setProgressValue(this, progressVal); progressVal++; logger.debug("Got all networks, num="+nets.length); for (int i=0; i<nets.length; i++) { // skip null networks...probably a bug on the server if (nets[i] != null) { // cache = new CacheNetworkAccess(nets[i]); cache = new DNDNetworkAccess(nets[i]); NetworkAttr attr = cache.get_attributes(); netIdToNetMap.put(NetworkIdUtil.toString(cache.get_attributes().get_id()), cache); logger.debug("Got attributes "+attr.get_code()); // preload attributes networkAdd(cache); } else { logger.warn("a networkaccess returned from NetworkFinder.retrieve_all() is null, skipping."); } // end of else setProgressValue(this, progressVal); progressVal++; } } else { //when the channelChooser is configured with networkCodes.... int totalNetworks = 0; setProgressMax(this, configuredNetworks.length); for(int counter = 0; counter < configuredNetworks.length; counter++) { try { logger.debug("Getting network for "+configuredNetworks[counter]); NetworkAccess[] nets = netdc.a_finder().retrieve_by_code(configuredNetworks[counter]); logger.debug("Got "+nets.length+" networks for "+configuredNetworks[counter]); for(int subCounter = 0; subCounter < nets.length; subCounter++) { if (nets[subCounter] != null) { // cache = new CacheNetworkAccess(nets[subCounter]); cache = new DNDNetworkAccess(nets[subCounter]); NetworkAttr attr = cache.get_attributes(); NetworkAccess[] storedNets = (NetworkAccess[])netDCToNetMap.get(netdc); if ( storedNets == null) { storedNets = new NetworkAccess[1]; storedNets[0] = cache; netDCToNetMap.put(netdc, storedNets); } else { NetworkAccess[] tmp = new NetworkAccess[storedNets.length+1]; System.arraycopy(storedNets, 0, tmp, 0, storedNets.length); tmp[storedNets.length] = cache; netDCToNetMap.put(netdc, tmp); } // end of else netIdToNetMap.put(NetworkIdUtil.toString(cache.get_attributes().get_id()), cache); logger.debug("Got attributes "+attr.get_code()); // preload attributes networkAdd(cache); totalNetworks++; } else { logger.warn("a networkaccess returned from NetworkFinder.retrieve_by_code is null, skipping."); } // end of else }//end of inner for subCounter = 0; }catch(NetworkNotFound nnfe) { logger.warn("Network "+configuredNetworks[counter]+" not found while getting network access uding NetworkFinder.retrieve_by_code"); } setProgressValue(this, counter+1); }//end of outer for counter = 0; }//end of if else checking for configuredNetworks == null if (doSelect) { // need to do this later to give java Event thread time to set // up network list before setting selection SwingUtilities.invokeLater(new Runnable() { public void run() { networkList.getSelectionModel().setSelectionInterval(0, networkList.getModel().getSize()-1); } }); } // end of if () setProgressValue(this, progressBar.getMaximum()); }
1,119,263
public void run() { setProgressOwner(this); setProgressMax(this, 100); logger.debug("There are "+nets.length+" selected networks."); try { synchronized (ChannelChooser.this) { if (this.equals(getStationLoader())) { clearStationsFromThread(); } } int netProgressInc = 50 / nets.length; int progressValue = 10; setProgressValue(this, progressValue); for (int i=0; i<nets.length; i++) { logger.debug("Before get stations"); Station[] newStations = nets[i].retrieve_stations(); logger.debug("got "+newStations.length+" stations"); setProgressValue(this, progressValue+netProgressInc/2); for (int j=0; j<newStations.length; j++) { synchronized (ChannelChooser.this) { if (this.equals(getStationLoader())) { addStation(newStations[j]); try { sleep((int)(.01*1000)); } catch (InterruptedException e) { } // end of try-catch } else { // no longer the active station loader return; } // end of else } setProgressValue(this, progressValue+netProgressInc/2- (newStations.length-j)/newStations.length); } setProgressValue(this, 100); logger.debug("finished adding stations"); try { sleep((int)(.01*1000)); } catch (InterruptedException e) { } // end of try-catch } // end of for ((int i=0; i<nets.length; i++) logger.debug("There are "+stationNames.getSize()+" items in the station list model"); // stationList.validate(); //stationList.repaint(); } catch (Exception e) { edu.sc.seis.fissuresUtil.exceptionHandlerGUI.ExceptionHandlerGUI.handleException(e); } // end of try-catch } }
public void run() { setProgressOwner(this); setProgressMax(this, 100); logger.debug("There are "+nets.length+" selected networks."); try { synchronized (ChannelChooser.this) { if (this.equals(getStationLoader())) { clearStationsFromThread(); } } int netProgressInc = 50 / nets.length; int progressValue = 10; setProgressValue(this, progressValue); for (int i=0; i<nets.length; i++) { logger.debug("Before get stations"); Station[] newStations = nets[i].retrieve_stations(); logger.debug("got "+newStations.length+" stations"); setProgressValue(this, progressValue+netProgressInc/2); for (int j=0; j<newStations.length; j++) { synchronized (ChannelChooser.this) { if (this.equals(getStationLoader())) { stationAdd(newStations[j]); try { sleep((int)(.01*1000)); } catch (InterruptedException e) { } // end of try-catch } else { // no longer the active station loader return; } // end of else } setProgressValue(this, progressValue+netProgressInc/2- (newStations.length-j)/newStations.length); } setProgressValue(this, 100); logger.debug("finished adding stations"); try { sleep((int)(.01*1000)); } catch (InterruptedException e) { } // end of try-catch } // end of for ((int i=0; i<nets.length; i++) logger.debug("There are "+stationNames.getSize()+" items in the station list model"); // stationList.validate(); //stationList.repaint(); } catch (Exception e) { edu.sc.seis.fissuresUtil.exceptionHandlerGUI.ExceptionHandlerGUI.handleException(e); } // end of try-catch } }
1,119,264
public boolean init(String authenticatedUser, String user, boolean publicAdmin, Groups groups, String synchId, boolean debug) throws CalFacadeException;
public boolean init(String url, String authenticatedUser, String user, boolean publicAdmin, Groups groups, String synchId, boolean debug) throws CalFacadeException;
1,119,265
protected void initIndexFile() throws IOException { char q = '"'; File index = new File(directory, "index.html"); BufferedWriter out = new BufferedWriter(new FileWriter(index)); writeln(out, "<html>"); writeln(out, " <head>"); writeln(out, " <title>Errors</title>"); writeln(out, " <style media="+q+"all"+q+">@import "+q+"../main.css"+q+";</style>"); writeln(out, " </head>"); writeln(out, " <body>"); writeln(out, " <div id="+q+"Header"+q+">Errors found:</div>"); writeln(out, "<br/>"); writeln(out, "<div id="+q+"Content"+q+">"); out.close(); // we do not end the body or html tags to allow simple appends to this // file. Most browsers are ok with this }
protected void initIndexFile() throws IOException { char q = '"'; File index = new File(directory, "index.html"); BufferedWriter out = new BufferedWriter(new FileWriter(index)); writeln(out, "<html>"); writeln(out, " <head>"); writeln(out, " <title>Errors</title>"); writeln(out, " <style media="+q+"all"+q+">@import "+q+"../main.css"+q+";</style>"); writeln(out, " </head>"); writeln(out, " <body>"); writeln(out, " <div id="+q+"Header"+q+">Errors found:</div>"); writeln(out, "<br/>"); writeln(out, "<div id="+q+"Content"+q+">"); out.close(); // we do not end the body or html tags to allow simple appends to this // file. Most browsers are ok with this }
1,119,267
public void report(String message, Throwable e, List sections) throws IOException{ int cur = GlobalExceptionHandler.getNumHandled(); File outFile = new File(directory, "Exception_"+cur+".html"); appendToIndexFile(outFile, e); BufferedWriter bw = new BufferedWriter(new FileWriter(outFile)); String str = getHeader(e, cur); str += message; str += "\n<br/>\n<br/>\n"; String stackTrace = "<h2>Stack Trace</h2><br/>"; str += stackTrace +makeDivider(stackTrace.length()) + "<pre>"+ ExceptionReporterUtils.getTrace(e)+"</pre>"; bw.write(constructString(str, sections)); bw.close(); }
public void report(String message, Throwable e, List sections) throws IOException{ int cur = GlobalExceptionHandler.getNumHandled(); File outFile = new File(directory, "Exception_"+cur+".html"); appendToIndexFile(outFile, e); BufferedWriter bw = new BufferedWriter(new FileWriter(outFile)); String str = getHeader(e, cur); str += message; str += "\n<br/>\n<br/>\n"; String stackTrace = "<h2>Stack Trace</h2><br/>"; str += stackTrace +makeDivider(stackTrace.length()) + "<pre>"+ ExceptionReporterUtils.getTrace(e)+"</pre>"; bw.write(constructString(str, sections)); bw.close(); }
1,119,268