rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
System.out.println("[Korta] PostData = "+strPostData.toString());
private Hashtable getFirstResponse() throws KortathjonustanAuthorizationException { Hashtable properties = null; //System.out.println(" ------ REQUEST ------"); //long lStartTime = System.currentTimeMillis(); try { SSLClient client = getSSLClient(); StringBuffer strPostData = new StringBuffer(); appendProperty(strPostData, PROPERTY_SITE, SITE);//"site=22" appendProperty(strPostData, PROPERTY_USER, USER); appendProperty(strPostData, PROPERTY_PASSWORD, PASSWORD); appendProperty(strPostData, PROPERTY_ACCEPTOR_TERM_ID, ACCEPTOR_TERM_ID); appendProperty(strPostData, PROPERTY_ACCEPTOR_IDENT, ACCEPTOR_IDENTIFICATION); appendProperty(strPostData, PROPERTY_CC_NUMBER, strCCNumber); appendProperty(strPostData, PROPERTY_CC_EXPIRE, strCCExpire); appendProperty(strPostData, PROPERTY_AMOUNT, strAmount); appendProperty(strPostData, PROPERTY_CURRENCY_CODE, strCurrencyCode); appendProperty(strPostData, PROPERTY_CURRENCY_EXPONENT, strCurrencyExponent); appendProperty(strPostData, PROPERTY_CARDHOLDER_NAME, strName); appendProperty(strPostData, PROPERTY_REFERENCE_ID, strReferenceNumber); appendProperty(strPostData, PROPERTY_CURRENT_DATE, strCurrentDate); appendProperty(strPostData, PROPERTY_CC_VERIFY_CODE, strCCVerify); addDefautProperties(strPostData); String strResponse = null; //System.out.println("Request [" + strPostData.toString() + "]"); try { System.out.println("[Korta] PostData = "+strPostData.toString()); strResponse = client.sendRequest(REQUEST_TYPE_AUTHORIZATION, strPostData.toString()); } catch (Exception e) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest failed"); cce.setErrorNumber("-"); cce.setParentException(e); throw cce; } //System.out.println("Response [" + strResponse + "]"); if (strResponse == null) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("SendRequest returned null"); cce.setErrorNumber("-"); throw cce; } else if (!strResponse.startsWith(PROPERTY_ACTION_CODE)) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("Invalid response from host, should start with d39 [" + strResponse + "]"); cce.setErrorNumber("-"); throw cce; } else { properties = parseResponse(strResponse); if (CODE_AUTHORIZATOIN_APPROVED.equals(properties.get(PROPERTY_ACTION_CODE))) { return properties; } else { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError(properties.get(PROPERTY_ACTION_CODE_TEXT).toString()); cce.setErrorMessage(properties.get(PROPERTY_ERROR_TEXT).toString()); cce.setErrorNumber(properties.get(PROPERTY_ERROR_CODE).toString()); throw cce; } } } catch (UnsupportedEncodingException e) { KortathjonustanAuthorizationException cce = new KortathjonustanAuthorizationException(); cce.setDisplayError("Cannot connect to Central Payment Server"); cce.setErrorMessage("UnsupportedEncodingException"); cce.setErrorNumber("-"); cce.setParentException(e); throw cce; } }
System.out.println("[Korta] post_data = "+strPostData.toString());
private String getPostData(Hashtable properties) { StringBuffer strPostData = new StringBuffer(); try { appendProperty(strPostData, PROPERTY_PASSWORD, PASSWORD); addProperties(strPostData, properties); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } System.out.println("[Korta] post_data = "+strPostData.toString()); return strPostData.toString(); }
base,
dirURL,
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++) }
URL dirURL = new URL(base, directory.getName()+"/");
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++) }
URL seisURL = new URL(base, sacFiles[i].getName());
URL seisURL = new URL(dirURL, sacFiles[i].getName());
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++) }
return HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
throw new WebdavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
private int processDoc(Document doc) throws WebdavException { try { WebdavNsIntf intf = getNsIntf(); Element root = doc.getDocumentElement(); /* Get hold of the PROPFIND method instance - we need it to process possible prop requests. */ PropFindMethod pm = (PropFindMethod)intf.findMethod( WebdavMethods.propFind); if (pm == null) { return HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } if (nodeMatches(root, CaldavTags.calendarQuery)) { reportType = reportTypeQuery; } else if (nodeMatches(root, CaldavTags.calendarMultiget)) { reportType = reportTypeMultiGet; } else if (nodeMatches(root, CaldavTags.freeBusyQuery)) { reportType = reportTypeFreeBusy; freeBusy = new FreeBusyQuery(intf, debug); } else if (nodeMatches(root, WebdavTags.expandProperty)) { reportType = reportTypeExpandProperty; } else { throw new WebdavBadRequest(); } Element[] children = getChildren(root); for (int i = 0; i < children.length; i++) { Element curnode = children[i]; /** The names come through looking something like A:allprop etc. */ String nm = curnode.getLocalName(); String ns = curnode.getNamespaceURI(); if (debug) { trace("reqtype: " + nm + " ns: " + ns); } if (reportType == reportTypeFreeBusy) { freeBusy.parse(curnode); } else if (reportType == reportTypeExpandProperty) { } else { /* Two possibilities: <!ELEMENT calendar-multiget (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? DAV:href+> <!ELEMENT calendar-query (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? filter> */ /* First try for a property request */ PropFindMethod.PropRequest pr = pm.tryPropRequest(curnode); if (pr != null) { if (preq != null) { if (debug) { trace("REPORT: preq not null"); } throw new WebdavBadRequest(); } preq = pr; } else if (nodeMatches(curnode, CaldavTags.calendarData)) { if (caldata != null) { if (debug) { trace("REPORT: caldata not null"); } throw new WebdavBadRequest(); } caldata = new CalendarData(debug); caldata.parse(curnode); } else if ((reportType == reportTypeQuery) && nodeMatches(curnode, CaldavTags.filter)) { if (filter != null) { if (debug) { trace("REPORT: filter not null"); } throw new WebdavBadRequest(); } filter = new Filter(intf, debug); int st = filter.parse(curnode); if (st != HttpServletResponse.SC_OK) { return st; } } else if ((reportType == reportTypeMultiGet) && nodeMatches(curnode, WebdavTags.href)) { String href = XmlUtil.getElementContent(curnode); if ((href == null) || (href.length() == 0)) { throw new WebdavBadRequest(); } if (hrefs == null) { hrefs = new ArrayList(); } hrefs.add(href); } else { if (debug) { trace("REPORT: unexpected element"); } throw new WebdavBadRequest(); } } } // Final validation if (reportType == reportTypeMultiGet) { if (hrefs == null) { // need at least 1 throw new WebdavBadRequest(); } } else if (reportType == reportTypeQuery) { if (caldata == null) { // same as empty element? caldata = new CalendarData(debug); } if (filter == null) { // filter required throw new WebdavBadRequest(); } } if (debug) { trace("REPORT: "); if (reportType == reportTypeFreeBusy) { trace("free-busy"); freeBusy.dump(); } else if (reportType == reportTypeQuery) { // Query - optional props + optional calendar data + filter if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } filter.dump(); } else if (reportType == reportTypeMultiGet) { // Multi-get - optional props + optional calendar data + one or more hrefs if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } Iterator it = hrefs.iterator(); while (it.hasNext()) { String href = (String)it.next(); trace(" <DAV:href>" + href + "</DAV:href>"); } } else { } } return HttpServletResponse.SC_OK; } catch (WebdavException wde) { throw wde; } catch (Throwable t) { System.err.println(t.getMessage()); if (debug) { t.printStackTrace(); } return HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } }
File directory, Channel channel, EventAccessOperations event) throws IOException, NoPreferredOrigin, CodecException { SacTimeSeries sac; String seisFilename = ""; seisFilename = ChannelIdUtil.toStringNoDates(seis.channel_id); seisFilename.replace(' ', '.'); File seisFile = new File(directory, seisFilename); int n =0; while (seisFile.exists()) { n++; seisFilename = ChannelIdUtil.toStringNoDates(seis.channel_id)+"."+n; seisFilename.replace(' ', '.'); seisFile = new File(directory, seisFilename); } if (channel != null) { if (event != null) { sac = FissuresToSac.getSAC(seis, channel, event.get_preferred_origin()); } else { sac = FissuresToSac.getSAC(seis, channel); } } else { if (event != null) { sac = FissuresToSac.getSAC(seis, event.get_preferred_origin()); } else { sac = FissuresToSac.getSAC(seis); }
File directory) throws IOException, CodecException { try { return saveAsSac(seis, directory, null, null); } catch (NoPreferredOrigin e) {
public static URL saveAsSac(LocalSeismogramImpl seis, File directory, Channel channel, EventAccessOperations event) throws IOException, NoPreferredOrigin, CodecException { SacTimeSeries sac; String seisFilename = ""; seisFilename = ChannelIdUtil.toStringNoDates(seis.channel_id); seisFilename.replace(' ', '.'); // check for space-space site File seisFile = new File(directory, seisFilename); int n =0; while (seisFile.exists()) { n++; seisFilename = ChannelIdUtil.toStringNoDates(seis.channel_id)+"."+n; seisFilename.replace(' ', '.'); // check for space-space site seisFile = new File(directory, seisFilename); } // end of while (seisFile.exists()) if (channel != null) { if (event != null) { sac = FissuresToSac.getSAC(seis, channel, event.get_preferred_origin()); } else { sac = FissuresToSac.getSAC(seis, channel); } } else { if (event != null) { sac = FissuresToSac.getSAC(seis, event.get_preferred_origin()); } else { sac = FissuresToSac.getSAC(seis); } } sac.write(seisFile); return seisFile.toURL(); }
sac.write(seisFile); return seisFile.toURL();
return null;
public static URL saveAsSac(LocalSeismogramImpl seis, File directory, Channel channel, EventAccessOperations event) throws IOException, NoPreferredOrigin, CodecException { SacTimeSeries sac; String seisFilename = ""; seisFilename = ChannelIdUtil.toStringNoDates(seis.channel_id); seisFilename.replace(' ', '.'); // check for space-space site File seisFile = new File(directory, seisFilename); int n =0; while (seisFile.exists()) { n++; seisFilename = ChannelIdUtil.toStringNoDates(seis.channel_id)+"."+n; seisFilename.replace(' ', '.'); // check for space-space site seisFile = new File(directory, seisFilename); } // end of while (seisFile.exists()) if (channel != null) { if (event != null) { sac = FissuresToSac.getSAC(seis, channel, event.get_preferred_origin()); } else { sac = FissuresToSac.getSAC(seis, channel); } } else { if (event != null) { sac = FissuresToSac.getSAC(seis, event.get_preferred_origin()); } else { sac = FissuresToSac.getSAC(seis); } } sac.write(seisFile); return seisFile.toURL(); }
logger.debug("Original URL: " + url.toExternalForm());
private URL appendParameters(URL url, Map<String, String> additionalParams) throws UnsupportedEncodingException, MalformedURLException { // get the request encoding HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); String encoding = request.getCharacterEncoding(); // not found, fallback to UTF-8 if (encoding == null) encoding = "UTF-8"; logger.debug("Original URL: " + url.toExternalForm()); String queryString = url.getQuery(); String path = url.getPath(); logger.debug("Original path: " + path); logger.debug("Original query string: " + queryString); Map<String, List<String>> params = parseParameters(queryString); // merge new parameters for (Entry<String, String> entry : additionalParams.entrySet()) { List<String> values = new ArrayList<String>(1); values.add(entry.getValue()); params.put(entry.getKey(), values); } // convert to query string StringBuilder queryBuf = new StringBuilder(); for (Entry<String, List<String>> entry : params.entrySet()) { String key = entry.getKey(); for (String value : entry.getValue()) { if (queryBuf.length() > 0) { queryBuf.append("&"); } queryBuf.append(URLEncoder.encode(key, encoding)); queryBuf.append("="); queryBuf.append(URLEncoder.encode(value, encoding)); } } queryString = queryBuf.toString(); if (queryString.length() > 0) path += "?" + queryString; logger.debug("New query string: " + queryString); URL result = new URL(url.getProtocol(), url.getHost(), url.getPort(), path); logger.debug("New URL: " + result); return result; }
logger.debug("Original path: " + path); logger.debug("Original query string: " + queryString);
private URL appendParameters(URL url, Map<String, String> additionalParams) throws UnsupportedEncodingException, MalformedURLException { // get the request encoding HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); String encoding = request.getCharacterEncoding(); // not found, fallback to UTF-8 if (encoding == null) encoding = "UTF-8"; logger.debug("Original URL: " + url.toExternalForm()); String queryString = url.getQuery(); String path = url.getPath(); logger.debug("Original path: " + path); logger.debug("Original query string: " + queryString); Map<String, List<String>> params = parseParameters(queryString); // merge new parameters for (Entry<String, String> entry : additionalParams.entrySet()) { List<String> values = new ArrayList<String>(1); values.add(entry.getValue()); params.put(entry.getKey(), values); } // convert to query string StringBuilder queryBuf = new StringBuilder(); for (Entry<String, List<String>> entry : params.entrySet()) { String key = entry.getKey(); for (String value : entry.getValue()) { if (queryBuf.length() > 0) { queryBuf.append("&"); } queryBuf.append(URLEncoder.encode(key, encoding)); queryBuf.append("="); queryBuf.append(URLEncoder.encode(value, encoding)); } } queryString = queryBuf.toString(); if (queryString.length() > 0) path += "?" + queryString; logger.debug("New query string: " + queryString); URL result = new URL(url.getProtocol(), url.getHost(), url.getPort(), path); logger.debug("New URL: " + result); return result; }
logger.debug("New query string: " + queryString);
private URL appendParameters(URL url, Map<String, String> additionalParams) throws UnsupportedEncodingException, MalformedURLException { // get the request encoding HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); String encoding = request.getCharacterEncoding(); // not found, fallback to UTF-8 if (encoding == null) encoding = "UTF-8"; logger.debug("Original URL: " + url.toExternalForm()); String queryString = url.getQuery(); String path = url.getPath(); logger.debug("Original path: " + path); logger.debug("Original query string: " + queryString); Map<String, List<String>> params = parseParameters(queryString); // merge new parameters for (Entry<String, String> entry : additionalParams.entrySet()) { List<String> values = new ArrayList<String>(1); values.add(entry.getValue()); params.put(entry.getKey(), values); } // convert to query string StringBuilder queryBuf = new StringBuilder(); for (Entry<String, List<String>> entry : params.entrySet()) { String key = entry.getKey(); for (String value : entry.getValue()) { if (queryBuf.length() > 0) { queryBuf.append("&"); } queryBuf.append(URLEncoder.encode(key, encoding)); queryBuf.append("="); queryBuf.append(URLEncoder.encode(value, encoding)); } } queryString = queryBuf.toString(); if (queryString.length() > 0) path += "?" + queryString; logger.debug("New query string: " + queryString); URL result = new URL(url.getProtocol(), url.getHost(), url.getPort(), path); logger.debug("New URL: " + result); return result; }
logger.debug("New URL: " + result);
private URL appendParameters(URL url, Map<String, String> additionalParams) throws UnsupportedEncodingException, MalformedURLException { // get the request encoding HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); String encoding = request.getCharacterEncoding(); // not found, fallback to UTF-8 if (encoding == null) encoding = "UTF-8"; logger.debug("Original URL: " + url.toExternalForm()); String queryString = url.getQuery(); String path = url.getPath(); logger.debug("Original path: " + path); logger.debug("Original query string: " + queryString); Map<String, List<String>> params = parseParameters(queryString); // merge new parameters for (Entry<String, String> entry : additionalParams.entrySet()) { List<String> values = new ArrayList<String>(1); values.add(entry.getValue()); params.put(entry.getKey(), values); } // convert to query string StringBuilder queryBuf = new StringBuilder(); for (Entry<String, List<String>> entry : params.entrySet()) { String key = entry.getKey(); for (String value : entry.getValue()) { if (queryBuf.length() > 0) { queryBuf.append("&"); } queryBuf.append(URLEncoder.encode(key, encoding)); queryBuf.append("="); queryBuf.append(URLEncoder.encode(value, encoding)); } } queryString = queryBuf.toString(); if (queryString.length() > 0) path += "?" + queryString; logger.debug("New query string: " + queryString); URL result = new URL(url.getProtocol(), url.getHost(), url.getPort(), path); logger.debug("New URL: " + result); return result; }
logger.debug("Prev link: " + prevLink); logger.debug("Next link: " + nextLink);
public int doEndTag() throws JspException { try { JspWriter out = pageContext.getOut(); // get locale-specific stuff locale = getDefaultLocale(); if (resourceBundle == null) resourceBundle = getDefaultResourceBundle(); if (timeZone == null) timeZone = getDefaultTimeZone(); if (dateFormatSymbols == null) dateFormatSymbols = getDefaultDateFormatSymbols(); Date currentTime = new Date(); Calendar selected = null; if (selectedDate != null) { selected = Calendar.getInstance(timeZone, locale); selected.setTime(selectedDate); } if (showDate == null) showDate = new Date(currentTime.getTime()); Calendar now = Calendar.getInstance(timeZone, locale); now.setTime(currentTime); Calendar current = Calendar.getInstance(timeZone, locale); current.setTime(showDate); out.print("<table"); if (outerId != null) { out.print(" id=\""); out.print(encodeAttribute(outerId)); out.print("\""); } if (outerClass != null) { out.print(" class=\""); out.print(encodeAttribute(outerClass)); out.print("\""); } out.print(">"); if (captionVisible) { logger.debug("Prev link: " + prevLink); logger.debug("Next link: " + nextLink); if (prevLink == null) prevLink = getDefaultPrevLink(current); if (nextLink == null) nextLink = getDefaultNextLink(current); out.print("<caption>"); renderPrevLink(out); renderCaption(out, current); renderNextLink(out); out.print("</caption>"); } out.print("<thead>"); renderHead(out); out.print("</thead>"); out.print("<tbody>"); // render cells current.set(Calendar.DAY_OF_MONTH, 1); // get last day of month current.add(Calendar.MONTH, 1); current.set(Calendar.DAY_OF_MONTH, 1); current.add(Calendar.DAY_OF_MONTH, -1); int endDay = current.get(Calendar.DAY_OF_MONTH); // go to first day of month current.set(Calendar.DAY_OF_MONTH, 1); int col = 0; out.print("<tr>"); int firstDow = current.getFirstDayOfWeek(); for (int i = 1; i <= endDay; i++) { int dow = current.get(Calendar.DAY_OF_WEEK); if (col == 7) { col = 0; out.print("</tr>"); out.print("<tr>"); } if (i == 1) { // populate first row with empty cells int skipDays = (dow + 7 - firstDow) % 7; // should always give 0..6 for (int j = 0; j < skipDays; j++) { renderEmptyDay(out, (firstDow + j) % 7); col++; } } // add current day col++; renderDay(out, current, dow, isSameDay(current, now), isSameDay(current, selected)); if (i == endDay) { // populate last row with empty cells while (col < 7) { current.add(Calendar.DAY_OF_MONTH, 1); renderEmptyDay(out, current.get(Calendar.DAY_OF_WEEK)); col++; } } // move to next day current.add(Calendar.DAY_OF_MONTH, 1); } out.print("</tr>"); out.print("</tbody>"); out.print("</table>"); return EVAL_PAGE; } catch (IOException e) { throw new JspException(e); } finally { cleanup(); } }
logger.debug("request_uri: " + request.getAttribute("javax.servlet.forward.request_uri")); logger.debug("context_path: " + request.getAttribute("javax.servlet.forward.context_path")); logger.debug("servlet_path: " + request.getAttribute("javax.servlet.forward.servlet_path")); logger.debug("path_info: " + request.getAttribute("javax.servlet.forward.path_info")); logger.debug("query_string: " + request.getAttribute("javax.servlet.forward.query_string")); logger.debug(""); logger.debug("request.requestURI: " + request.getRequestURI()); logger.debug("request.contextPath: " + request.getContextPath()); logger.debug("request.servletPath: " + request.getServletPath()); logger.debug("request.pathInfo: " + request.getPathInfo()); logger.debug("request.queryString: " + request.getQueryString()); logger.debug("parameters:"); Enumeration parameterNames = request.getParameterNames(); while (parameterNames.hasMoreElements()) { String parameterName = (String) parameterNames.nextElement(); String[] parameterValues = request.getParameterValues(parameterName); for (String parameterValue : parameterValues) { logger.debug(" " + parameterName + "=" + parameterValue); } }
private URL getCurrentUrl(HttpServletRequest request) throws MalformedURLException { StringBuilder buf = new StringBuilder(); String scheme = request.getScheme(); int port = request.getServerPort(); buf.append(scheme); buf.append("://"); buf.append(request.getServerName()); if ("http".equals(scheme) && port == 80) { // do nothing } else if ("https".equals(scheme) && port == 443) { // do nothing } else if (port < 0) { // do nothing } else { buf.append(":"); DecimalFormat dfPort = new DecimalFormat("#####"); buf.append(dfPort.format(port)); } String forwardUri = (String) request.getAttribute(REQUEST_URI_ATTRIBUTE); if (forwardUri == null) { // use old style method String contextPath = request.getContextPath(); if (contextPath != null) buf.append(contextPath); String servletPath = request.getServletPath(); if (servletPath != null) buf.append(servletPath); String pathInfo = request.getPathInfo(); if (pathInfo != null) buf.append(pathInfo); String queryString = request.getQueryString(); if (queryString != null && queryString.length() > 0) { if (!('?' == queryString.charAt(0))) buf.append("?"); buf.append(queryString); } } else { // use forwarded attributes buf.append(forwardUri); String queryString = (String) request.getAttribute(QUERY_STRING_ATTRIBUTE); if (queryString != null && queryString.length() > 0) { if (!('?' == queryString.charAt(0))) buf.append("?"); buf.append(queryString); } } logger.debug("request_uri: " + request.getAttribute("javax.servlet.forward.request_uri")); logger.debug("context_path: " + request.getAttribute("javax.servlet.forward.context_path")); logger.debug("servlet_path: " + request.getAttribute("javax.servlet.forward.servlet_path")); logger.debug("path_info: " + request.getAttribute("javax.servlet.forward.path_info")); logger.debug("query_string: " + request.getAttribute("javax.servlet.forward.query_string")); logger.debug(""); logger.debug("request.requestURI: " + request.getRequestURI()); logger.debug("request.contextPath: " + request.getContextPath()); logger.debug("request.servletPath: " + request.getServletPath()); logger.debug("request.pathInfo: " + request.getPathInfo()); logger.debug("request.queryString: " + request.getQueryString()); logger.debug("parameters:"); Enumeration parameterNames = request.getParameterNames(); while (parameterNames.hasMoreElements()) { String parameterName = (String) parameterNames.nextElement(); String[] parameterValues = request.getParameterValues(parameterName); for (String parameterValue : parameterValues) { logger.debug(" " + parameterName + "=" + parameterValue); } } String name = buf.toString(); logger.debug("Current URL: " + name); return new URL(name); }
logger.debug("Current URL: " + name);
private URL getCurrentUrl(HttpServletRequest request) throws MalformedURLException { StringBuilder buf = new StringBuilder(); String scheme = request.getScheme(); int port = request.getServerPort(); buf.append(scheme); buf.append("://"); buf.append(request.getServerName()); if ("http".equals(scheme) && port == 80) { // do nothing } else if ("https".equals(scheme) && port == 443) { // do nothing } else if (port < 0) { // do nothing } else { buf.append(":"); DecimalFormat dfPort = new DecimalFormat("#####"); buf.append(dfPort.format(port)); } String forwardUri = (String) request.getAttribute(REQUEST_URI_ATTRIBUTE); if (forwardUri == null) { // use old style method String contextPath = request.getContextPath(); if (contextPath != null) buf.append(contextPath); String servletPath = request.getServletPath(); if (servletPath != null) buf.append(servletPath); String pathInfo = request.getPathInfo(); if (pathInfo != null) buf.append(pathInfo); String queryString = request.getQueryString(); if (queryString != null && queryString.length() > 0) { if (!('?' == queryString.charAt(0))) buf.append("?"); buf.append(queryString); } } else { // use forwarded attributes buf.append(forwardUri); String queryString = (String) request.getAttribute(QUERY_STRING_ATTRIBUTE); if (queryString != null && queryString.length() > 0) { if (!('?' == queryString.charAt(0))) buf.append("?"); buf.append(queryString); } } logger.debug("request_uri: " + request.getAttribute("javax.servlet.forward.request_uri")); logger.debug("context_path: " + request.getAttribute("javax.servlet.forward.context_path")); logger.debug("servlet_path: " + request.getAttribute("javax.servlet.forward.servlet_path")); logger.debug("path_info: " + request.getAttribute("javax.servlet.forward.path_info")); logger.debug("query_string: " + request.getAttribute("javax.servlet.forward.query_string")); logger.debug(""); logger.debug("request.requestURI: " + request.getRequestURI()); logger.debug("request.contextPath: " + request.getContextPath()); logger.debug("request.servletPath: " + request.getServletPath()); logger.debug("request.pathInfo: " + request.getPathInfo()); logger.debug("request.queryString: " + request.getQueryString()); logger.debug("parameters:"); Enumeration parameterNames = request.getParameterNames(); while (parameterNames.hasMoreElements()) { String parameterName = (String) parameterNames.nextElement(); String[] parameterValues = request.getParameterValues(parameterName); for (String parameterValue : parameterValues) { logger.debug(" " + parameterName + "=" + parameterValue); } } String name = buf.toString(); logger.debug("Current URL: " + name); return new URL(name); }
logger.debug("next link, month=" + current.get(Calendar.MONTH));
private String getDefaultNextLink(Calendar current) throws MalformedURLException, UnsupportedEncodingException { logger.debug("next link, month=" + current.get(Calendar.MONTH)); Calendar nextCal = Calendar.getInstance(timeZone, locale); nextCal.setTime(current.getTime()); nextCal.add(Calendar.MONTH, 1); return getDefaultNavLink(nextCal); }
logger.debug("prev link, month=" + current.get(Calendar.MONTH));
private String getDefaultPrevLink(Calendar current) throws MalformedURLException, UnsupportedEncodingException { logger.debug("prev link, month=" + current.get(Calendar.MONTH)); Calendar prevCal = Calendar.getInstance(timeZone, locale); prevCal.setTime(current.getTime()); prevCal.add(Calendar.MONTH, -1); return getDefaultNavLink(prevCal); }
form.getErr().emit("org.bedework.client.error.missingcalendar"); return null;
if (getPublicAdmin(form)) { form.getErr().emit("org.bedework.client.error.missingcalendar"); return "retry"; } cal = svci.getPreferredCalendar();
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svci = form.fetchSvci(); BwCalendar cal = null; int calId = getIntReqPar(request, "calId", -1); if (calId >= 0) { cal = svci.getCalendar(calId); } if (cal == null) { form.getErr().emit("org.bedework.client.error.missingcalendar"); return null; } FormFile upFile = form.getUploadFile(); if (upFile == null) { // Just forget it return "success"; } String fileName = upFile.getFileName(); if ((fileName == null) || (fileName.length() == 0)) { return null; } InputStream is = upFile.getInputStream(); IcalTranslator trans = new IcalTranslator(svci.getIcalCallback(), debug); Collection objs = trans.fromIcal(cal, new InputStreamReader(is)); Iterator it = objs.iterator(); while (it.hasNext()) { Object o = it.next(); if (o instanceof EventInfo) { EventInfo ei = (EventInfo)o; BwEvent ev = ei.getEvent(); if (ei.getNewEvent()) { svci.addEvent(cal, ev, ei.getOverrides()); } else { svci.updateEvent(ev); } } } form.getMsg().emit("org.bedework.client.message.event.added"); return "success"; }
return null;
return "retry";
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svci = form.fetchSvci(); BwCalendar cal = null; int calId = getIntReqPar(request, "calId", -1); if (calId >= 0) { cal = svci.getCalendar(calId); } if (cal == null) { form.getErr().emit("org.bedework.client.error.missingcalendar"); return null; } FormFile upFile = form.getUploadFile(); if (upFile == null) { // Just forget it return "success"; } String fileName = upFile.getFileName(); if ((fileName == null) || (fileName.length() == 0)) { return null; } InputStream is = upFile.getInputStream(); IcalTranslator trans = new IcalTranslator(svci.getIcalCallback(), debug); Collection objs = trans.fromIcal(cal, new InputStreamReader(is)); Iterator it = objs.iterator(); while (it.hasNext()) { Object o = it.next(); if (o instanceof EventInfo) { EventInfo ei = (EventInfo)o; BwEvent ev = ei.getEvent(); if (ei.getNewEvent()) { svci.addEvent(cal, ev, ei.getOverrides()); } else { svci.updateEvent(ev); } } } form.getMsg().emit("org.bedework.client.message.event.added"); return "success"; }
System.out.println(internalTimeConfig.getTimeRange().getBeginTime()); return internalTimeConfig; }
return internalTimeConfig; }
public TimeRangeConfig getInternalConfig(){ System.out.println(internalTimeConfig.getTimeRange().getBeginTime()); return internalTimeConfig; }
return null;
return new GeneralPath();
public Shape draw(Dimension size){ if(visible){ MicroSecondTimeRange overTimeRange = timeRegistrar.getTimeRange(). getOversizedTimeRange(BasicSeismogramDisplay.OVERSIZED_SCALE); if(flagTime.before(overTimeRange.getBeginTime()) || flagTime.after(overTimeRange.getEndTime())) return null; double offset = flagTime.difference(overTimeRange.getBeginTime()).getValue()/overTimeRange.getInterval().getValue(); location = (int)(offset * (double)size.width); Area pole = new Area(new Rectangle(location, 0, 1, size.height)); Area flag = new Area(new Rectangle(location, 0, name.length() * 12, 13)); flag.add(pole); return flag; } return null; }
if (value == null) return null;
public static String attribute(String value) { StringBuilder builder = new StringBuilder(); for (char c : value.toCharArray()) { switch (c) { case '&': builder.append("&amp;"); break; case '<': builder.append("&lt;"); break; case '>': builder.append("&gt;"); break; case '"': builder.append("&#34;"); break; case '\'': builder.append("&#39;"); break; default: builder.append(c); } } return builder.toString(); }
mySubject.getClassifiers().add(resolution);
mySubject.getClassifiers().add((Classifier)resolution);
public void lookupResolved(NamedElement resolution) { if (resolution instanceof Classifier){ mySubject.getClassifiers().add(resolution); } }
public static LocalSeismogram removeMean(LocalSeismogram seis){ if(seismo.can_convert_to_float()){
public static LocalSeismogram removeMean(LocalSeismogramImpl seis){ TimeSeriesType dataType = seis.getDataType(); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); switch (dataType.value()) { case TimeSeriesType._TYPE_LONG: int[] iSeries = seis.get_as_longs(); return new LocalSeismogramImpl(seis, removeMean(iSeries)); case TimeSeriesType._TYPE_SHORT: short[] sSeries = seis.get_as_shorts(); return new LocalSeismogramImpl(seis, removeMean(sSeries)); case TimeSeriesType._TYPE_FLOAT:
public static LocalSeismogram removeMean(LocalSeismogram seis){ if(seismo.can_convert_to_float()){ float[] fSeries = seis.get_as_floats(); return new LocalSeismogramImpl(seis, removeMean(fSeries)); }else{ int[] iSeries = seismo.get_as_longs(); return new LocalSeismogramImpl(seis, removeMean(iSeries)); } }
}else{ int[] iSeries = seismo.get_as_longs(); return new LocalSeismogramImpl(seis, removeMean(iSeries)); }
case TimeSeriesType._TYPE_DOUBLE: double[] dSeries = seis.get_as_doubles(); return new LocalSeismogramImpl(seis, removeMean(dSeries)); default: return null; }
public static LocalSeismogram removeMean(LocalSeismogram seis){ if(seismo.can_convert_to_float()){ float[] fSeries = seis.get_as_floats(); return new LocalSeismogramImpl(seis, removeMean(fSeries)); }else{ int[] iSeries = seismo.get_as_longs(); return new LocalSeismogramImpl(seis, removeMean(iSeries)); } }
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]; return comp;
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;
protected static int[][] compressYvalues(LocalSeismogram seismogram, MicroSecondTimeRange tr, UnitRangeImpl ampRange, Dimension size)throws UnsupportedDataEncoding { int[][] uncomp = scaleXvalues(seismogram, tr, ampRange, 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]; } } 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]; return comp; }
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 UnsupportedDataEncoding { int[][] uncomp = scaleXvalues(seismogram, tr, ampRange, 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]; } } 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]; return comp; }
int tempValue;
int tempValue = 0;
protected static int[][] scaleXvalues(LocalSeismogram seismogram, MicroSecondTimeRange timeRange, UnitRangeImpl ampRange, Dimension size) throws UnsupportedDataEncoding { 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(); double yMin = ampRange.getMinValue(); double yMax = ampRange.getMaxValue(); 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 = size.width; 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; 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] = tempYvalues[j-1]; out[1][numAdded+1] = tempYvalues[j-1]; j = 0; xvalue = tempValue; numAdded = numAdded+2; } seisIndex++; } out[0][numAdded] = xvalue; out[0][numAdded+1] = xvalue; out[1][numAdded] = tempYvalues[j-1]; out[1][numAdded+1] = tempYvalues[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; }
out[1][numAdded] = tempYvalues[j-1]; out[1][numAdded+1] = tempYvalues[j-1];
out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, j-1);
protected static int[][] scaleXvalues(LocalSeismogram seismogram, MicroSecondTimeRange timeRange, UnitRangeImpl ampRange, Dimension size) throws UnsupportedDataEncoding { 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(); double yMin = ampRange.getMinValue(); double yMax = ampRange.getMaxValue(); 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 = size.width; 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; 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] = tempYvalues[j-1]; out[1][numAdded+1] = tempYvalues[j-1]; j = 0; xvalue = tempValue; numAdded = numAdded+2; } seisIndex++; } out[0][numAdded] = xvalue; out[0][numAdded+1] = xvalue; out[1][numAdded] = tempYvalues[j-1]; out[1][numAdded+1] = tempYvalues[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; }
xvalue = tempValue;
protected static int[][] scaleXvalues(LocalSeismogram seismogram, MicroSecondTimeRange timeRange, UnitRangeImpl ampRange, Dimension size) throws UnsupportedDataEncoding { 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(); double yMin = ampRange.getMinValue(); double yMax = ampRange.getMaxValue(); 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 = size.width; 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; 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] = tempYvalues[j-1]; out[1][numAdded+1] = tempYvalues[j-1]; j = 0; xvalue = tempValue; numAdded = numAdded+2; } seisIndex++; } out[0][numAdded] = xvalue; out[0][numAdded+1] = xvalue; out[1][numAdded] = tempYvalues[j-1]; out[1][numAdded+1] = tempYvalues[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; }
logger.debug("setBegin "+newBegin);
public void setBegin(MicroSecondDate newBegin){ if ( latestTime.getTime().getEndTime().equals(newBegin)) { throw new IllegalArgumentException("Selection must not have zero width, newBegin and end are the same."); } // end of if () logger.debug("setBegin "+newBegin); MicroSecondDate currentBegin = latestTime.getTime().getBeginTime(); TimeInterval timeInt = (TimeInterval)latestTime.getTime().getInterval().convertTo(UnitImpl.MICROSECOND); double currentInterval = timeInt.getValue(); double shift = (newBegin.getMicroSecondTime() - currentBegin.getMicroSecondTime())/currentInterval; double scale = (currentInterval + currentBegin.subtract(newBegin).getValue())/currentInterval; internalRegistrar.shaleTime(shift, scale); }
logger.debug("setEnd "+newEnd);
public void setEnd(MicroSecondDate newEnd){ if ( latestTime.getTime().getBeginTime().equals(newEnd)) { throw new IllegalArgumentException("Selection must not have zero width, begin and newEnd are the same."); } // end of if () logger.debug("setEnd "+newEnd); MicroSecondDate currentEnd = latestTime.getTime().getEndTime(); TimeInterval timeInt = (TimeInterval)latestTime.getTime().getInterval().convertTo(UnitImpl.MICROSECOND); double currentInterval = timeInt.getValue(); double scale = (currentInterval + newEnd.subtract(currentEnd).getValue())/currentInterval; internalRegistrar.shaleTime(0, scale); }
} else {
} else if(yearBox != null) {
private void dateChanged(){ updateToday(); int todaysYear = todayCalendar.get(Calendar.YEAR); int calJulianDay = calendar.get(Calendar.DAY_OF_YEAR); int todaysJulianDay = todayCalendar.get(Calendar.DAY_OF_YEAR); int calYear = calendar.get(Calendar.YEAR); otherButton.setSelected(true); if(calYear == todaysYear){ if(yearBox != null) yearBox.setSelectedIndex(0); if(todaysJulianDay == calJulianDay){ todayButton.setSelected(true); } if(calJulianDay == todaysJulianDay-1 ){ yesButton.setSelected(true); } } else { int indexofyear = todaysYear - calYear; yearBox.setSelectedIndex(indexofyear); } if(monthBox != null) monthBox.setSelectedIndex(calendar.get(Calendar.MONTH)); if(dayBox != null) dayBox.setSelectedIndex(calendar.get(Calendar.DAY_OF_MONTH) - 1); if(hourBox != null) hourBox.setSelectedIndex(calendar.get(Calendar.HOUR_OF_DAY)); if(minuteBox != null) minuteBox.setSelectedIndex(calendar.get(Calendar.MINUTE)); if(secondBox != null) secondBox.setSelectedIndex(calendar.get(Calendar.SECOND)); repaint(); }
subs = new Vector();
subs = new ArrayList();
public BwFreeBusy getFreeBusy(BwCalendar cal, BwPrincipal who, BwDateTime start, BwDateTime end) throws CalFacadeException { if (!(who instanceof BwUser)) { throw new CalFacadeException("Unsupported: non user principal for free-busy"); } if (isGuest() || (!currentUser().equals(who))) { // No access for the moment throw new CalFacadeAccessException(); } BwUser u = (BwUser)who; Collection subs; if (cal != null) { BwSubscription sub = BwSubscription.makeSubscription(cal); subs = new Vector(); subs.add(sub); } else if (!currentUser().equals(who)) { subs = getSubscriptions(); } else { subs = dbi.fetchPreferences(u).getSubscriptions(); } BwFreeBusy fb = new BwFreeBusy(who, start, end); Iterator subit = subs.iterator(); while (subit.hasNext()) { BwSubscription sub = (BwSubscription)subit.next(); if (!sub.getAffectsFreeBusy()) { continue; } Collection evs = getEvents(sub, null, start, end, CalFacadeDefs.retrieveRecurExpanded); try { /* For the moment just build a single FreeBusyComponentVO */ BwFreeBusyComponent fbc = new BwFreeBusyComponent(); Iterator it = evs.iterator(); TreeSet eventPeriods = new TreeSet(); while (it.hasNext()) { EventInfo ei = (EventInfo)it.next(); BwEvent ev = ei.getEvent(); // XXX Need to add sub.ignoreTransparency if (BwEvent.transparencyTransparent.equals(ev.getTransparency())) { continue; } // Ignore if times were specified and this event is outside the times BwDateTime estart = ev.getDtstart(); BwDateTime eend = ev.getDtend(); /* Don't report out of the requested period */ String dstart; String dend; if (estart.before(start)) { dstart = start.getDtval(); } else { dstart = estart.getDtval(); } if (eend.after(end)) { dend = end.getDtval(); } else { dend = eend.getDtval(); } eventPeriods.add(new EventPeriod(new DateTime(dstart), new DateTime(dend))); } /* iterate through the sorted periods combining them where they are adjacent or overlap */ Period p = null; it = eventPeriods.iterator(); while (it.hasNext()) { EventPeriod ep = (EventPeriod)it.next(); if (p == null) { p = new Period(ep.start, ep.end); } else if (ep.start.after(p.getEnd())) { // Non adjacent periods fbc.addPeriod(p); p = new Period(ep.start, ep.end); } else if (ep.end.after(p.getEnd())) { // Extend the current period p = new Period(p.getStart(), ep.end); } // else it falls within the existing period } if (p != null) { fbc.addPeriod(p); } fb.addTime(fbc); } catch (Throwable t) { throw new CalFacadeException(t); } } return fb; }
public Shaker3D(int waveFlag, float baz, float angI) { this.backAzimuth = baz; this.angleOfIncidence = angI; this.setWaveType(waveFlag);
public Shaker3D() {
public Shaker3D(int waveFlag, float baz, float angI) { this.backAzimuth = baz; this.angleOfIncidence = angI; this.setWaveType(waveFlag); }
private JPanel createButtonPanel(final JFrame displayFrame){
private JPanel createButtonPanel(){
private JPanel createButtonPanel(final JFrame displayFrame){ JButton closeButton = new JButton("Close"); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { displayFrame.dispose(); displayPanel = null; } }); JButton saveToFile = new JButton("Save"); saveToFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ex) { try{ writeFile(); }catch(IOException e){ int result = JOptionPane.showConfirmDialog(displayPanel, "We were unable to write to that file. Try again?", "Trouble writing exception file", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if(result == JOptionPane.OK_OPTION){ actionPerformed(null); } } } public void writeFile()throws IOException{ JFileChooser fileChooser = new JFileChooser(); fileChooser.setSelectedFile(new File(ExceptionReporterUtils.getExceptionClassName(e) + ".txt")); int rtnVal = fileChooser.showSaveDialog(displayPanel); if(rtnVal == JFileChooser.APPROVE_OPTION) { FileWriterReporter writer = new FileWriterReporter(fileChooser.getSelectedFile().getAbsoluteFile()); writer.report(message, e, sections); } } }); JPanel buttonPanel = new JPanel(); buttonPanel.add(closeButton); buttonPanel.add(saveToFile); return buttonPanel; }
public void actionPerformed(ActionEvent ex) { try{ writeFile(); }catch(IOException e){ int result = JOptionPane.showConfirmDialog(displayPanel, "We were unable to write to that file. Try again?", "Trouble writing exception file", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if(result == JOptionPane.OK_OPTION){ actionPerformed(null); } }
public void actionPerformed(ActionEvent e) { displayFrame.dispose(); displayFrame = null; displayPanel = null;
public void actionPerformed(ActionEvent ex) { try{ writeFile(); }catch(IOException e){ int result = JOptionPane.showConfirmDialog(displayPanel, "We were unable to write to that file. Try again?", "Trouble writing exception file", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if(result == JOptionPane.OK_OPTION){ actionPerformed(null); } } }
JFrame displayFrame = new JFrame();
displayFrame = new JFrame(); displayFrame.setDefaultCloseOperation (WindowConstants.DISPOSE_ON_CLOSE);
private void createFrame() { JFrame displayFrame = new JFrame(); displayFrame.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e) { displayPanel = null; } }); displayPanel = new JPanel(new BorderLayout()); displayPanel.add(createButtonPanel(displayFrame), BorderLayout.SOUTH); Dimension dimension = new Dimension(800, 400); displayPanel.setPreferredSize(dimension); displayFrame.setContentPane(displayPanel); displayFrame.setSize(dimension); displayFrame.pack(); displayFrame.show(); }
displayPanel.add(createButtonPanel(displayFrame),
displayPanel.add(createButtonPanel(),
private void createFrame() { JFrame displayFrame = new JFrame(); displayFrame.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e) { displayPanel = null; } }); displayPanel = new JPanel(new BorderLayout()); displayPanel.add(createButtonPanel(displayFrame), BorderLayout.SOUTH); Dimension dimension = new Dimension(800, 400); displayPanel.setPreferredSize(dimension); displayFrame.setContentPane(displayPanel); displayFrame.setSize(dimension); displayFrame.pack(); displayFrame.show(); }
displayFrame.pack(); displayFrame.show();
private void createFrame() { JFrame displayFrame = new JFrame(); displayFrame.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e) { displayPanel = null; } }); displayPanel = new JPanel(new BorderLayout()); displayPanel.add(createButtonPanel(displayFrame), BorderLayout.SOUTH); Dimension dimension = new Dimension(800, 400); displayPanel.setPreferredSize(dimension); displayFrame.setContentPane(displayPanel); displayFrame.setSize(dimension); displayFrame.pack(); displayFrame.show(); }
if(displayPanel == null){ createFrame(); }
createFrame();
public void report(String message, Throwable e, List sections) { this.message = message; this.e = e; this.sections = sections; if(displayPanel == null){ createFrame(); } displayPanel.add(createGUI(e, message, sections), BorderLayout.CENTER); displayPanel.revalidate(); }
SwingUtilities.invokeLater(new Runnable() { public void run() { displayFrame.pack(); displayFrame.show(); } });
public void report(String message, Throwable e, List sections) { this.message = message; this.e = e; this.sections = sections; if(displayPanel == null){ createFrame(); } displayPanel.add(createGUI(e, message, sections), BorderLayout.CENTER); displayPanel.revalidate(); }
BwCalSuite cs = fetchCalSuite(getSess(), val.getName()); if (cs != null) { throw new CalFacadeException("org.bedework.duplicate.calsuite"); }
public BwCalSuiteWrapper addCalSuite(BwCalSuite val) throws CalFacadeException { HibSession sess = getSess(); sess.save(val); CurrentAccess ca = checkAccess(val, PrivilegeDefs.privAny, false); return new BwCalSuiteWrapper(val, ca); }
DistAz distAz = new DistAz(station.latitude, station.longitude,
double degrees = SphericalCoords.distance(station.latitude, station.longitude,
public synchronized MicroSecondDate calculate(Origin origin, Location station) throws TauModelException { QuantityImpl depth = (QuantityImpl)origin.my_location.depth; depth = depth.convertTo(UnitImpl.KILOMETER); taup.setSourceDepth(depth.getValue()); DistAz distAz = new DistAz(station.latitude, station.longitude, origin.my_location.latitude, origin.my_location.longitude); taup.calculate(distAz.delta); Arrival[] arrivals = taup.getArrivals(); MicroSecondDate out = new MicroSecondDate(origin.origin_time); if (arrivals.length > 0) { out = out.add(new TimeInterval(arrivals[0].getTime(), UnitImpl.SECOND)); } return out; }
taup.calculate(distAz.delta);
taup.calculate(degrees);
public synchronized MicroSecondDate calculate(Origin origin, Location station) throws TauModelException { QuantityImpl depth = (QuantityImpl)origin.my_location.depth; depth = depth.convertTo(UnitImpl.KILOMETER); taup.setSourceDepth(depth.getValue()); DistAz distAz = new DistAz(station.latitude, station.longitude, origin.my_location.latitude, origin.my_location.longitude); taup.calculate(distAz.delta); Arrival[] arrivals = taup.getArrivals(); MicroSecondDate out = new MicroSecondDate(origin.origin_time); if (arrivals.length > 0) { out = out.add(new TimeInterval(arrivals[0].getTime(), UnitImpl.SECOND)); } return out; }
public CalEnv getEnv(ActionForm frm) throws Throwable { CalEnv env = frm.getEnv();
public CalEnvI getEnv(ActionForm frm) throws Throwable { CalEnvI env = frm.getEnv();
public CalEnv getEnv(ActionForm frm) throws Throwable { CalEnv env = frm.getEnv(); if (env != null) { return env; } env = new CalEnv(envPrefix, debug); frm.assignEnv(env); return env; }
env = new CalEnv(envPrefix, debug);
env = CalEnvFactory.getEnv(envPrefix, debug);
public CalEnv getEnv(ActionForm frm) throws Throwable { CalEnv env = frm.getEnv(); if (env != null) { return env; } env = new CalEnv(envPrefix, debug); frm.assignEnv(env); return env; }
CalEnv env = getEnv(form);
CalEnvI env = getEnv(form);
public void setup(HttpServletRequest request, ActionForm form, MessageResources messages) throws Throwable { BwSession s = BwWebUtil.getState(request); if (s != null) { } else { CalEnv env = getEnv(form); String appName = env.getAppProperty("name"); String appRoot = env.getAppProperty("root"); s = new BwSessionImpl(form.getCurrentUser(), appRoot, appName, form.getPresentationState(), messages, form.getSchemeHostPort(), debug); BwWebUtil.setState(request, s); } boolean changed = false; if (form.getPropertyCollections().size() == 0) { changed = true; } else { changed = modulesChanged(form); } if (changed) { resetProperties(form); } }
public CalEnv getEnv() {
public CalEnvI getEnv() {
public CalEnv getEnv() { return env; }
public void assignEnv(CalEnv val) {
public void assignEnv(CalEnvI val) {
public void assignEnv(CalEnv val) { env = val; }
properties = (Properties)CalEnv.getProperties().clone();
if (env == null) { throw new Exception("No env set"); } properties = (Properties)env.getProperties().clone();
public Properties getProperties() { if (properties == null) { try { properties = (Properties)CalEnv.getProperties().clone(); } catch (Throwable t) { getErr().emit(t); } } return properties; }
editEvent = val;
public void setEditEvent(BwEvent val) { try { editEvent = val; if (val == null) { getEventDates().setNewEvent(val, fetchSvci().getTimezones()); } else { getEventDates().setFromEvent(val, fetchSvci().getTimezones()); } } catch (Throwable t) { err.emit(t); } }
editEvent = val;
public void setEditEvent(BwEvent val) { try { editEvent = val; if (val == null) { getEventDates().setNewEvent(val, fetchSvci().getTimezones()); } else { getEventDates().setFromEvent(val, fetchSvci().getTimezones()); } } catch (Throwable t) { err.emit(t); } }
public void removeListener(PlayerListener listener);
public void removeListener(PlayerListener listener) { listeners.remove(listener); }
public void removeListener(PlayerListener listener);
return fromIcal(cal, bldr.build(new UnfoldingReader(new StringReader(val))));
return fromIcal(cal, bldr.build(new StringReader(val), true));
public Collection fromIcal(BwCalendar cal, String val) throws CalFacadeException { try { CalendarBuilder bldr = new CalendarBuilder(new CalendarParserImpl()); return fromIcal(cal, bldr.build(new UnfoldingReader(new StringReader(val)))); } catch (ParserException pe) { if (debug) { error(pe); } throw new IcalMalformedException(pe.getMessage()); } catch (CalFacadeException cfe) { throw cfe; } catch (Throwable t) { throw new CalFacadeException(t); } }
private String doDir(Vector v, DirClass dir, String indent) throws CalFacadeException {
private String doDir(ArrayList al, DirClass dir, String indent) throws CalFacadeException {
private String doDir(Vector v, DirClass dir, String indent) throws CalFacadeException { if (debug) { trace(indent + "Dir: " + dir.cal.getName()); } Iterator dit = dir.dirs.iterator(); while (dit.hasNext()) { doDir(v, (DirClass)dit.next(), indent + " "); } Iterator tzit = dir.tzs.iterator(); while (tzit.hasNext()) { Calendar ical = (Calendar)tzit.next(); ComponentList cl = ical.getComponents(); if (cl.size() != 1) { throw new CalFacadeException(CalFacadeException.timezonesReadError, cl.size() + " components in Calendar"); } Object o = cl.get(0); if (!(o instanceof VTimeZone)) { throw new CalFacadeException(CalFacadeException.timezonesReadError, "component in Calendar not VTimeZone"); } TimeZoneInfo tzi = new TimeZoneInfo(); tzi.timezone = (VTimeZone)o; tzi.tzid = IcalUtil.getProperty(tzi.timezone, Property.TZID).getValue(); v.add(tzi); if (debug) { trace(indent + "tzid: " + tzi.tzid); } } return null; }
doDir(v, (DirClass)dit.next(), indent + " ");
doDir(al, (DirClass)dit.next(), indent + " ");
private String doDir(Vector v, DirClass dir, String indent) throws CalFacadeException { if (debug) { trace(indent + "Dir: " + dir.cal.getName()); } Iterator dit = dir.dirs.iterator(); while (dit.hasNext()) { doDir(v, (DirClass)dit.next(), indent + " "); } Iterator tzit = dir.tzs.iterator(); while (tzit.hasNext()) { Calendar ical = (Calendar)tzit.next(); ComponentList cl = ical.getComponents(); if (cl.size() != 1) { throw new CalFacadeException(CalFacadeException.timezonesReadError, cl.size() + " components in Calendar"); } Object o = cl.get(0); if (!(o instanceof VTimeZone)) { throw new CalFacadeException(CalFacadeException.timezonesReadError, "component in Calendar not VTimeZone"); } TimeZoneInfo tzi = new TimeZoneInfo(); tzi.timezone = (VTimeZone)o; tzi.tzid = IcalUtil.getProperty(tzi.timezone, Property.TZID).getValue(); v.add(tzi); if (debug) { trace(indent + "tzid: " + tzi.tzid); } } return null; }
v.add(tzi);
al.add(tzi);
private String doDir(Vector v, DirClass dir, String indent) throws CalFacadeException { if (debug) { trace(indent + "Dir: " + dir.cal.getName()); } Iterator dit = dir.dirs.iterator(); while (dit.hasNext()) { doDir(v, (DirClass)dit.next(), indent + " "); } Iterator tzit = dir.tzs.iterator(); while (tzit.hasNext()) { Calendar ical = (Calendar)tzit.next(); ComponentList cl = ical.getComponents(); if (cl.size() != 1) { throw new CalFacadeException(CalFacadeException.timezonesReadError, cl.size() + " components in Calendar"); } Object o = cl.get(0); if (!(o instanceof VTimeZone)) { throw new CalFacadeException(CalFacadeException.timezonesReadError, "component in Calendar not VTimeZone"); } TimeZoneInfo tzi = new TimeZoneInfo(); tzi.timezone = (VTimeZone)o; tzi.tzid = IcalUtil.getProperty(tzi.timezone, Property.TZID).getValue(); v.add(tzi); if (debug) { trace(indent + "tzid: " + tzi.tzid); } } return null; }
Vector v = new Vector();
ArrayList al = new ArrayList();
public Collection getTimeZones() throws CalFacadeException { /* The input file should look something like: <dir> <name>A-name</name> <dir>...</dir> <file> <name>file1.ics</name> <data>...</data> </file> </dir> We ignore the first name - it represents the root. Each <dir> element may contain other <dir> and <file> elements. Each <name> element is a path element */ DirClass rootDir = parseTzDefs(new InputStreamReader(inStr)); Vector v = new Vector(); doDir(v, rootDir, ""); return v; }
doDir(v, rootDir, "");
doDir(al, rootDir, "");
public Collection getTimeZones() throws CalFacadeException { /* The input file should look something like: <dir> <name>A-name</name> <dir>...</dir> <file> <name>file1.ics</name> <data>...</data> </file> </dir> We ignore the first name - it represents the root. Each <dir> element may contain other <dir> and <file> elements. Each <name> element is a path element */ DirClass rootDir = parseTzDefs(new InputStreamReader(inStr)); Vector v = new Vector(); doDir(v, rootDir, ""); return v; }
return v;
return al;
public Collection getTimeZones() throws CalFacadeException { /* The input file should look something like: <dir> <name>A-name</name> <dir>...</dir> <file> <name>file1.ics</name> <data>...</data> </file> </dir> We ignore the first name - it represents the root. Each <dir> element may contain other <dir> and <file> elements. Each <name> element is a path element */ DirClass rootDir = parseTzDefs(new InputStreamReader(inStr)); Vector v = new Vector(); doDir(v, rootDir, ""); return v; }
AffineTransform insetMove = AffineTransform.getTranslateInstance(x, y); copy.transform(insetMove);
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g; if (copy != null) { try { AffineTransform insetMove = AffineTransform.getTranslateInstance(x, y); copy.transform(insetMove); Font f = new Font("SansSerif", Font.PLAIN, 9); copy.setFont(f); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); insets.left -= x+left; insets.top -= y+top; insets.right -= right + c.getSize().width - x - left; insets.bottom -= bottom + c.getSize().height - y - top; FontMetrics fm = copy.getFontMetrics(); String labelTemp; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left + topScaleMap.getPixelLocation(i); if(topScaleMap.isMajorTick(i)) copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - majorTickLength)); else copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - minorTickLength)); labelTemp = topScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, top - majorTickLength- fm.getLeading()); } } } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top+top+ leftScaleMap.getPixelLocation(i); if (pixelLoc >=insets.top+top && pixelLoc <=height-insets.bottom-bottom) { if (leftScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(left-majorTickLength, pixelLoc, left, pixelLoc)); } else { copy.draw(new Line2D.Float(left-minorTickLength, pixelLoc, left, pixelLoc)); } labelTemp = leftScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { if(i == 0) copy.drawString(labelTemp, 0, pixelLoc - 5); else if(i == numTicks - 1) copy.drawString(labelTemp, 0, pixelLoc + 5); else copy.drawString(labelTemp, 0, pixelLoc); } } } } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left+ bottomScaleMap.getPixelLocation(i); if (pixelLoc >=insets.left + left && pixelLoc <= width - insets.right) { if (bottomScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+majorTickLength)); } else { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+minorTickLength)); } labelTemp = bottomScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, height-fm.getLeading()); } } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top + top+ rightScaleMap.getPixelLocation(i); System.out.println("HScaleBorder pixelLoc="+pixelLoc); copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); labelTemp = rightScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } }
insets.left -= x+left; insets.top -= y+top; insets.right -= right + c.getSize().width - x - left; insets.bottom -= bottom + c.getSize().height - y - top;
insets.top -= y+top; insets.bottom -= bottom + y;
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g; if (copy != null) { try { AffineTransform insetMove = AffineTransform.getTranslateInstance(x, y); copy.transform(insetMove); Font f = new Font("SansSerif", Font.PLAIN, 9); copy.setFont(f); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); insets.left -= x+left; insets.top -= y+top; insets.right -= right + c.getSize().width - x - left; insets.bottom -= bottom + c.getSize().height - y - top; FontMetrics fm = copy.getFontMetrics(); String labelTemp; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left + topScaleMap.getPixelLocation(i); if(topScaleMap.isMajorTick(i)) copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - majorTickLength)); else copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - minorTickLength)); labelTemp = topScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, top - majorTickLength- fm.getLeading()); } } } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top+top+ leftScaleMap.getPixelLocation(i); if (pixelLoc >=insets.top+top && pixelLoc <=height-insets.bottom-bottom) { if (leftScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(left-majorTickLength, pixelLoc, left, pixelLoc)); } else { copy.draw(new Line2D.Float(left-minorTickLength, pixelLoc, left, pixelLoc)); } labelTemp = leftScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { if(i == 0) copy.drawString(labelTemp, 0, pixelLoc - 5); else if(i == numTicks - 1) copy.drawString(labelTemp, 0, pixelLoc + 5); else copy.drawString(labelTemp, 0, pixelLoc); } } } } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left+ bottomScaleMap.getPixelLocation(i); if (pixelLoc >=insets.left + left && pixelLoc <= width - insets.right) { if (bottomScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+majorTickLength)); } else { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+minorTickLength)); } labelTemp = bottomScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, height-fm.getLeading()); } } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top + top+ rightScaleMap.getPixelLocation(i); System.out.println("HScaleBorder pixelLoc="+pixelLoc); copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); labelTemp = rightScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } }
String labelTemp;
System.out.println(x + " " + y + " " + insets.left + " " + insets.right + " " + insets.top + " " + insets.bottom + " " + top + " " + left + " " + bottom + " " + right); String labelTemp;
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g; if (copy != null) { try { AffineTransform insetMove = AffineTransform.getTranslateInstance(x, y); copy.transform(insetMove); Font f = new Font("SansSerif", Font.PLAIN, 9); copy.setFont(f); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); insets.left -= x+left; insets.top -= y+top; insets.right -= right + c.getSize().width - x - left; insets.bottom -= bottom + c.getSize().height - y - top; FontMetrics fm = copy.getFontMetrics(); String labelTemp; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left + topScaleMap.getPixelLocation(i); if(topScaleMap.isMajorTick(i)) copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - majorTickLength)); else copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - minorTickLength)); labelTemp = topScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, top - majorTickLength- fm.getLeading()); } } } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top+top+ leftScaleMap.getPixelLocation(i); if (pixelLoc >=insets.top+top && pixelLoc <=height-insets.bottom-bottom) { if (leftScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(left-majorTickLength, pixelLoc, left, pixelLoc)); } else { copy.draw(new Line2D.Float(left-minorTickLength, pixelLoc, left, pixelLoc)); } labelTemp = leftScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { if(i == 0) copy.drawString(labelTemp, 0, pixelLoc - 5); else if(i == numTicks - 1) copy.drawString(labelTemp, 0, pixelLoc + 5); else copy.drawString(labelTemp, 0, pixelLoc); } } } } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left+ bottomScaleMap.getPixelLocation(i); if (pixelLoc >=insets.left + left && pixelLoc <= width - insets.right) { if (bottomScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+majorTickLength)); } else { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+minorTickLength)); } labelTemp = bottomScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, height-fm.getLeading()); } } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top + top+ rightScaleMap.getPixelLocation(i); System.out.println("HScaleBorder pixelLoc="+pixelLoc); copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); labelTemp = rightScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } }
pixelLoc = insets.left + left + topScaleMap.getPixelLocation(i);
pixelLoc = insets.left + topScaleMap.getPixelLocation(i);
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g; if (copy != null) { try { AffineTransform insetMove = AffineTransform.getTranslateInstance(x, y); copy.transform(insetMove); Font f = new Font("SansSerif", Font.PLAIN, 9); copy.setFont(f); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); insets.left -= x+left; insets.top -= y+top; insets.right -= right + c.getSize().width - x - left; insets.bottom -= bottom + c.getSize().height - y - top; FontMetrics fm = copy.getFontMetrics(); String labelTemp; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left + topScaleMap.getPixelLocation(i); if(topScaleMap.isMajorTick(i)) copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - majorTickLength)); else copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - minorTickLength)); labelTemp = topScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, top - majorTickLength- fm.getLeading()); } } } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top+top+ leftScaleMap.getPixelLocation(i); if (pixelLoc >=insets.top+top && pixelLoc <=height-insets.bottom-bottom) { if (leftScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(left-majorTickLength, pixelLoc, left, pixelLoc)); } else { copy.draw(new Line2D.Float(left-minorTickLength, pixelLoc, left, pixelLoc)); } labelTemp = leftScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { if(i == 0) copy.drawString(labelTemp, 0, pixelLoc - 5); else if(i == numTicks - 1) copy.drawString(labelTemp, 0, pixelLoc + 5); else copy.drawString(labelTemp, 0, pixelLoc); } } } } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left+ bottomScaleMap.getPixelLocation(i); if (pixelLoc >=insets.left + left && pixelLoc <= width - insets.right) { if (bottomScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+majorTickLength)); } else { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+minorTickLength)); } labelTemp = bottomScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, height-fm.getLeading()); } } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top + top+ rightScaleMap.getPixelLocation(i); System.out.println("HScaleBorder pixelLoc="+pixelLoc); copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); labelTemp = rightScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } }
pixelLoc = insets.top+top+ leftScaleMap.getPixelLocation(i); if (pixelLoc >=insets.top+top && pixelLoc <=height-insets.bottom-bottom) { if (leftScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(left-majorTickLength, pixelLoc, left, pixelLoc)); } else { copy.draw(new Line2D.Float(left-minorTickLength, pixelLoc, left, pixelLoc)); } labelTemp = leftScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { if(i == 0) copy.drawString(labelTemp, 0, pixelLoc - 5); else if(i == numTicks - 1) copy.drawString(labelTemp, 0, pixelLoc + 5); else copy.drawString(labelTemp, 0, pixelLoc); } } }
pixelLoc = height - leftScaleMap.getPixelLocation(i) - bottom; if (leftScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(insets.left -majorTickLength - insets.right, pixelLoc, insets.left - insets.right, pixelLoc)); } else { copy.draw(new Line2D.Float(insets.left - insets.right - minorTickLength, pixelLoc, insets.left - insets.right, pixelLoc)); } labelTemp = leftScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { if(i == 0) copy.drawString(labelTemp, insets.left - insets.right - 45, pixelLoc + 5); else if(i == numTicks - 1) copy.drawString(labelTemp, insets.left - insets.right - 45, pixelLoc - 5); else copy.drawString(labelTemp, insets.left - insets.right - 45, pixelLoc); } }
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g; if (copy != null) { try { AffineTransform insetMove = AffineTransform.getTranslateInstance(x, y); copy.transform(insetMove); Font f = new Font("SansSerif", Font.PLAIN, 9); copy.setFont(f); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); insets.left -= x+left; insets.top -= y+top; insets.right -= right + c.getSize().width - x - left; insets.bottom -= bottom + c.getSize().height - y - top; FontMetrics fm = copy.getFontMetrics(); String labelTemp; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left + topScaleMap.getPixelLocation(i); if(topScaleMap.isMajorTick(i)) copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - majorTickLength)); else copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - minorTickLength)); labelTemp = topScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, top - majorTickLength- fm.getLeading()); } } } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top+top+ leftScaleMap.getPixelLocation(i); if (pixelLoc >=insets.top+top && pixelLoc <=height-insets.bottom-bottom) { if (leftScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(left-majorTickLength, pixelLoc, left, pixelLoc)); } else { copy.draw(new Line2D.Float(left-minorTickLength, pixelLoc, left, pixelLoc)); } labelTemp = leftScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { if(i == 0) copy.drawString(labelTemp, 0, pixelLoc - 5); else if(i == numTicks - 1) copy.drawString(labelTemp, 0, pixelLoc + 5); else copy.drawString(labelTemp, 0, pixelLoc); } } } } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left+ bottomScaleMap.getPixelLocation(i); if (pixelLoc >=insets.left + left && pixelLoc <= width - insets.right) { if (bottomScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+majorTickLength)); } else { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+minorTickLength)); } labelTemp = bottomScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, height-fm.getLeading()); } } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top + top+ rightScaleMap.getPixelLocation(i); System.out.println("HScaleBorder pixelLoc="+pixelLoc); copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); labelTemp = rightScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } }
pixelLoc = insets.left + left+ bottomScaleMap.getPixelLocation(i); if (pixelLoc >=insets.left + left && pixelLoc <= width - insets.right) { if (bottomScaleMap.isMajorTick(i)) {
pixelLoc = insets.left + bottomScaleMap.getPixelLocation(i); if (bottomScaleMap.isMajorTick(i)) {
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g; if (copy != null) { try { AffineTransform insetMove = AffineTransform.getTranslateInstance(x, y); copy.transform(insetMove); Font f = new Font("SansSerif", Font.PLAIN, 9); copy.setFont(f); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); insets.left -= x+left; insets.top -= y+top; insets.right -= right + c.getSize().width - x - left; insets.bottom -= bottom + c.getSize().height - y - top; FontMetrics fm = copy.getFontMetrics(); String labelTemp; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left + topScaleMap.getPixelLocation(i); if(topScaleMap.isMajorTick(i)) copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - majorTickLength)); else copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - minorTickLength)); labelTemp = topScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, top - majorTickLength- fm.getLeading()); } } } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top+top+ leftScaleMap.getPixelLocation(i); if (pixelLoc >=insets.top+top && pixelLoc <=height-insets.bottom-bottom) { if (leftScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(left-majorTickLength, pixelLoc, left, pixelLoc)); } else { copy.draw(new Line2D.Float(left-minorTickLength, pixelLoc, left, pixelLoc)); } labelTemp = leftScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { if(i == 0) copy.drawString(labelTemp, 0, pixelLoc - 5); else if(i == numTicks - 1) copy.drawString(labelTemp, 0, pixelLoc + 5); else copy.drawString(labelTemp, 0, pixelLoc); } } } } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left+ bottomScaleMap.getPixelLocation(i); if (pixelLoc >=insets.left + left && pixelLoc <= width - insets.right) { if (bottomScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+majorTickLength)); } else { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+minorTickLength)); } labelTemp = bottomScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, height-fm.getLeading()); } } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top + top+ rightScaleMap.getPixelLocation(i); System.out.println("HScaleBorder pixelLoc="+pixelLoc); copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); labelTemp = rightScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } }
}
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g; if (copy != null) { try { AffineTransform insetMove = AffineTransform.getTranslateInstance(x, y); copy.transform(insetMove); Font f = new Font("SansSerif", Font.PLAIN, 9); copy.setFont(f); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); insets.left -= x+left; insets.top -= y+top; insets.right -= right + c.getSize().width - x - left; insets.bottom -= bottom + c.getSize().height - y - top; FontMetrics fm = copy.getFontMetrics(); String labelTemp; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left + topScaleMap.getPixelLocation(i); if(topScaleMap.isMajorTick(i)) copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - majorTickLength)); else copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - minorTickLength)); labelTemp = topScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, top - majorTickLength- fm.getLeading()); } } } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top+top+ leftScaleMap.getPixelLocation(i); if (pixelLoc >=insets.top+top && pixelLoc <=height-insets.bottom-bottom) { if (leftScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(left-majorTickLength, pixelLoc, left, pixelLoc)); } else { copy.draw(new Line2D.Float(left-minorTickLength, pixelLoc, left, pixelLoc)); } labelTemp = leftScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { if(i == 0) copy.drawString(labelTemp, 0, pixelLoc - 5); else if(i == numTicks - 1) copy.drawString(labelTemp, 0, pixelLoc + 5); else copy.drawString(labelTemp, 0, pixelLoc); } } } } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left+ bottomScaleMap.getPixelLocation(i); if (pixelLoc >=insets.left + left && pixelLoc <= width - insets.right) { if (bottomScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+majorTickLength)); } else { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+minorTickLength)); } labelTemp = bottomScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, height-fm.getLeading()); } } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top + top+ rightScaleMap.getPixelLocation(i); System.out.println("HScaleBorder pixelLoc="+pixelLoc); copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); labelTemp = rightScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } }
pixelLoc = insets.top + top+ rightScaleMap.getPixelLocation(i);
pixelLoc = height - rightScaleMap.getPixelLocation(i) - bottom;
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g; if (copy != null) { try { AffineTransform insetMove = AffineTransform.getTranslateInstance(x, y); copy.transform(insetMove); Font f = new Font("SansSerif", Font.PLAIN, 9); copy.setFont(f); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); insets.left -= x+left; insets.top -= y+top; insets.right -= right + c.getSize().width - x - left; insets.bottom -= bottom + c.getSize().height - y - top; FontMetrics fm = copy.getFontMetrics(); String labelTemp; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left + topScaleMap.getPixelLocation(i); if(topScaleMap.isMajorTick(i)) copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - majorTickLength)); else copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - minorTickLength)); labelTemp = topScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, top - majorTickLength- fm.getLeading()); } } } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top+top+ leftScaleMap.getPixelLocation(i); if (pixelLoc >=insets.top+top && pixelLoc <=height-insets.bottom-bottom) { if (leftScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(left-majorTickLength, pixelLoc, left, pixelLoc)); } else { copy.draw(new Line2D.Float(left-minorTickLength, pixelLoc, left, pixelLoc)); } labelTemp = leftScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { if(i == 0) copy.drawString(labelTemp, 0, pixelLoc - 5); else if(i == numTicks - 1) copy.drawString(labelTemp, 0, pixelLoc + 5); else copy.drawString(labelTemp, 0, pixelLoc); } } } } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + left+ bottomScaleMap.getPixelLocation(i); if (pixelLoc >=insets.left + left && pixelLoc <= width - insets.right) { if (bottomScaleMap.isMajorTick(i)) { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+majorTickLength)); } else { copy.draw(new Line2D.Float(pixelLoc, height-bottom, pixelLoc, height-bottom+minorTickLength)); } labelTemp = bottomScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, height-fm.getLeading()); } } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.top + top+ rightScaleMap.getPixelLocation(i); System.out.println("HScaleBorder pixelLoc="+pixelLoc); copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); labelTemp = rightScaleMap.getLabel(i); if (labelTemp != null && labelTemp.length() != 0) { copy.drawString(labelTemp, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } }
public static void rotate(float[] x, float[] y, double radians) { rotate(x, y, AffineTransform.getRotateInstance(radians));
public static float[][] rotate(LocalSeismogramImpl x, LocalSeismogramImpl y, double radians) throws FissuresException { float[][] data = new float[2][]; float[] temp = x.get_as_floats(); data[0] = new float[temp.length]; System.arraycopy(temp, 0, data[0], 0, temp.length); temp = y.get_as_floats(); data[1] = new float[temp.length]; System.arraycopy(temp, 0, data[1], 0, temp.length); rotate(data[0], data[1], radians); return data;
public static void rotate(float[] x, float[] y, double radians) { rotate(x, y, AffineTransform.getRotateInstance(radians)); }
out.write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"); out.write("<opml version=\"1.0\">\n"); out.write(" <head>\n"); out.write(" <title/>\n"); out.write(" </head>\n"); out.write(" <body>\n"); saveIdea(idea); out.write(" </body>\n"); out.write("</opml>\n");
try { db = DocumentBuilderFactory.newInstance( ).newDocumentBuilder(); Document document = db.newDocument(); document.setXmlVersion("1.0"); Element opml = document.createElement("opml"); opml.setAttribute("version", "1.0"); document.appendChild(opml); Element head = document.createElement("head"); opml.appendChild(head); Element title = document.createElement("title"); head.appendChild(title); Element body = document.createElement("body"); opml.appendChild(body); appendIdea(document, body, idea); Transformer transformer = null; TransformerFactory transformerFactory = TransformerFactory.newInstance(); try { transformer = transformerFactory.newTransformer(); } catch (TransformerConfigurationException e) { e.printStackTrace(); } DOMSource source = new DOMSource(document); StreamResult result = new StreamResult(out); try{ transformer.transform(source,result); } catch (TransformerException e){ e.printStackTrace(); } } catch(Exception e) { e.printStackTrace(); }
private void save(Idea idea) throws IOException { out.write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"); out.write("<opml version=\"1.0\">\n"); out.write(" <head>\n"); out.write(" <title/>\n"); out.write(" </head>\n"); out.write(" <body>\n"); saveIdea(idea); out.write(" </body>\n"); out.write("</opml>\n"); }
finally { release(); }
public int doEndTag() throws JspException { try { JspWriter out = pageContext.getOut(); out.write("</select>"); } catch (IOException ioe) { throw new JspException(ioe); } return EVAL_PAGE; }
public void addSelection(Selection newSelection){ selections.add(newSelection); }
public void addSelection(Selection newSelection){ if(!selections.contains(newSelection)) selections.add(newSelection); }
public void addSelection(Selection newSelection){ selections.add(newSelection); }
return "notAdded"; } if (name.length() > BwCalSuite.maxNameLength) { form.getErr().emit("org.bedework.client.error.toolong", "name");
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"; } String groupName = getReqPar(request, "groupName"); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "groupName"); return "notAdded"; } BwAdminGroup agrp = (BwAdminGroup)svc.getAdminGroups().findGroup(groupName); if (agrp == null) { form.getErr().emit("org.bedework.client.error.nosuchadmingroup", groupName); return "notFound"; } String calPath = getReqPar(request, "calPath"); if (calPath == null) { // bogus request form.getErr().emit("org.bedework.client.error.missingfield", "calPath"); return "notAdded"; } BwCalendar calendar = svc.getCalendar(calPath); if (calendar == null) { form.getErr().emit("org.bedework.client.error.nosuchcalendar", calPath); return "notFound"; } BwCalSuite cs = new BwCalSuite(); cs.setName(name); cs.setGroup(agrp); cs.setRootCalendar(calendar); BwCalSuiteWrapper csw = svc.addCalSuite(cs); if (csw == null) { form.getErr().emit("org.bedework.client.error.calsuitenotadded"); return "notAdded"; } form.setCalSuite(csw); return "success"; }
return extractAll(getAll);
return extractAll(getAllQuery);
public StationId[] getAllStationIds() throws SQLException { return extractAll(getAll); }
public NSNetworkAccess(NetworkAccess na, NetworkId id, ProxyNetworkDC netDC){ super(na); this.id = id; this.netDC = netDC;
public NSNetworkAccess(NetworkId id, ProxyNetworkDC netDC) throws NetworkNotFound{ this(getFromDC(id, netDC), id, netDC);
public NSNetworkAccess(NetworkAccess na, NetworkId id, ProxyNetworkDC netDC){ super(na); this.id = id; this.netDC = netDC; }
globals.subscriptionsTbl.put(u, intFld());
globals.subscriptionsTbl.put(OwnerInfo.makeOwnerInfo(u), intFld());
public void field(String name) throws java.lang.Exception{ BwUser u = (BwUser)top(); if (principalTags(u, name)) { return; } if (name.equals("instanceOwner")) { u.setInstanceOwner(booleanFld()); } else if (name.equals("quota")) { u.setQuota(longFld()); } else if (name.equals("subscriptions")) { // XXX 2.3.2 } else if (name.equals("calendarid")) { // XXX 2.3.2 // Fix it later globals.subscriptionsTbl.put(u, intFld()); } else { unknownTag(name); } }
globals.getTzcache().saveTimeZone(entity.getTzid(), (VTimeZone)o);
VTimeZone vtz = (VTimeZone)o; String tzid = entity.getTzid(); globals.getTzcache().saveTimeZone(tzid, vtz, entity.getPublick());
public void end(String ns, String name) throws Exception { BwTimeZone entity = (BwTimeZone)pop(); globals.timezones++; Calendar ical = IcalTranslator.getCalendar(entity.getVtimezone()); ComponentList cl = ical.getComponents(); if (cl.size() != 1) { error("Exception restoring " + entity); throw new CalFacadeException(CalFacadeException.timezonesReadError, cl.size() + " components in Calendar"); } Object o = cl.get(0); if (!(o instanceof VTimeZone)) { error("Exception restoring " + entity); throw new CalFacadeException(CalFacadeException.timezonesReadError, "component in Calendar not VTimeZone"); } try { // Add it to the cache. Will save in db. globals.getTzcache().saveTimeZone(entity.getTzid(), (VTimeZone)o); } catch (Throwable t) { error("Exception restoring " + entity); throw new Exception(t); } }
System.out.println("pixels to be drawn by seismogram shape: " + startPixel + ", " + endPixel);
private void getEdgeValues(MicroSecondTimeRange time, Dimension size){ if(seis.getEndTime().before(time.getBeginTime()) || seis.getBeginTime().after(time.getEndTime())) { startPixel = 0; endPixel = 0; return; } int[] points = DisplayUtils.getSeisPoints(seis, time); seisStart = points[0]; seisEnd = points[1]; MicroSecondDate temp = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisStart); if(temp.getMicroSecondTime() < time.getBeginTime().getMicroSecondTime()){ temp = time.getBeginTime(); } startPixel = getPixel(size.width, time.getBeginTime(), time.getEndTime(), temp); temp = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisEnd); if(temp.getMicroSecondTime() > time.getEndTime().getMicroSecondTime()){ temp = time.getEndTime(); } endPixel = getPixel(size.width, time.getBeginTime(), time.getEndTime(), temp); samplesPerPixel = (seisEnd - seisStart)/(double)(endPixel - startPixel); }
for(int i = 0; i < seisEnd - seisStart; i++){ points[i][0] = (int)(i/samplesPerPixel); points[i][1] = (int)((seis.getValueAt(i + seisStart).getValue() - minAmp)/range * size.height);
if(seisEnd <= seis.getNumPoints() && seisStart >= 0){ if(seisStart != 0){ startPixel = 0; } if(seisEnd < seis.getNumPoints()){ endPixel = size.width; seisEnd++; } points = new int[seisEnd - seisStart][2]; samplesPerPixel = (seisEnd - seisStart - 1)/(double)(endPixel - startPixel); for(int i = 0; i < points.length; i++){ points[i][0] = (int)(i/samplesPerPixel) + startPixel; System.out.println(points[i][0]); points[i][1] = (int)((seis.getValueAt(i + seisStart).getValue() - minAmp)/range * size.height); }
private void plotAll(Dimension size) throws UnsupportedDataEncoding{ for(int i = 0; i < seisEnd - seisStart; i++){ points[i][0] = (int)(i/samplesPerPixel); points[i][1] = (int)((seis.getValueAt(i + seisStart).getValue() - minAmp)/range * size.height); } if(points.length < 2){ points = new int[2][2]; points[0][1] = (int)((seis.getValueAt(seisStart).getValue() - minAmp)/range * size.height); points[1][1] = (int)((seis.getValueAt(seisEnd).getValue() - minAmp)/range * size.height); } points[0][0] = 0; if(seisStart != seisEnd){ points[seisEnd - seisStart - 1][0] = size.width; } }
if(points.length < 2){ points = new int[2][2]; points[0][1] = (int)((seis.getValueAt(seisStart).getValue() - minAmp)/range * size.height); points[1][1] = (int)((seis.getValueAt(seisEnd).getValue() - minAmp)/range * size.height); } points[0][0] = 0; if(seisStart != seisEnd){ points[seisEnd - seisStart - 1][0] = size.width; }
private void plotAll(Dimension size) throws UnsupportedDataEncoding{ for(int i = 0; i < seisEnd - seisStart; i++){ points[i][0] = (int)(i/samplesPerPixel); points[i][1] = (int)((seis.getValueAt(i + seisStart).getValue() - minAmp)/range * size.height); } if(points.length < 2){ points = new int[2][2]; points[0][1] = (int)((seis.getValueAt(seisStart).getValue() - minAmp)/range * size.height); points[1][1] = (int)((seis.getValueAt(seisEnd).getValue() - minAmp)/range * size.height); } points[0][0] = 0; if(seisStart != seisEnd){ points[seisEnd - seisStart - 1][0] = size.width; } }
ChannelNameAndOrientation[] array = new ChannelNameAndOrientation[3]; array[0] = new ChannelNameAndOrientation('Z', 0, -90); array[1] = new ChannelNameAndOrientation('N', 0, 0); array[2] = new ChannelNameAndOrientation('E', 90, 0); return array;
return new ChannelNameAndOrientation[] {new ChannelNameAndOrientation('Z', 0, -90), new ChannelNameAndOrientation('N', 0, 0), new ChannelNameAndOrientation('E', 90, 0)};
public static ChannelNameAndOrientation[] parse(String chanDipAzi) { if(chanDipAzi.equals("default")) { ChannelNameAndOrientation[] array = new ChannelNameAndOrientation[3]; array[0] = new ChannelNameAndOrientation('Z', 0, -90); array[1] = new ChannelNameAndOrientation('N', 0, 0); array[2] = new ChannelNameAndOrientation('E', 90, 0); return array; } else { List tokens = new ArrayList(); StringTokenizer t = new StringTokenizer(chanDipAzi, "/:"); while(t.hasMoreTokens()) { tokens.add(t.nextToken()); } ChannelNameAndOrientation[] array = new ChannelNameAndOrientation[3]; array[0] = new ChannelNameAndOrientation(((String)tokens.get(0)).charAt(0), Integer.parseInt((String)tokens.get(2)), Integer.parseInt((String)tokens.get(1))); array[1] = new ChannelNameAndOrientation(((String)tokens.get(3)).charAt(0), Integer.parseInt((String)tokens.get(5)), Integer.parseInt((String)tokens.get(4))); array[2] = new ChannelNameAndOrientation(((String)tokens.get(6)).charAt(0), Integer.parseInt((String)tokens.get(8)), Integer.parseInt((String)tokens.get(7))); return array; } }
assertEquals(atThree_, bdy.asBegin().getStatements().base_at(NATNumber.ONE));
assertEquals(atThree_, bdy.asBegin().base_getStatements().base_at(NATNumber.ONE));
public void testClosureLiteral() throws NATException { ATClosure clo = evalAndReturn("{| x, y | 3 }").asClosure(); ATSymbol nam = clo.base_getMethod().base_getName(); ATTable arg = clo.base_getMethod().base_getArguments(); ATAbstractGrammar bdy = clo.base_getMethod().base_getBodyExpression(); ATContext ctx = clo.base_getContext(); assertEquals(AGSymbol.alloc(NATText.atValue("lambda")), nam); assertEquals(atX_, arg.base_at(NATNumber.ONE)); assertEquals(atY_, arg.base_at(NATNumber.atValue(2))); assertEquals(atThree_, bdy.asBegin().getStatements().base_at(NATNumber.ONE)); assertEquals(ctx_, ctx); }
assertEquals(ctx_.base_getSelf(), ((ATAsyncMessage) asyncMsg).getSender());
assertEquals(ctx_.base_getSelf(), ((ATAsyncMessage) asyncMsg).base_getSender());
public void testFirstClassMessages() throws NATException { ATMessage methInv = evalAndReturn(".m(3)").asMessage(); ATMessage asyncMsg = evalAndReturn("<-m(3)").asMessage(); assertEquals(atM_, methInv.base_getSelector()); assertEquals(atThree_, methInv.base_getArguments().base_at(NATNumber.ONE)); assertTrue(methInv instanceof ATMethodInvocation); assertEquals(atM_, asyncMsg.base_getSelector()); assertEquals(atThree_, asyncMsg.base_getArguments().base_at(NATNumber.ONE)); assertTrue(asyncMsg instanceof ATAsyncMessage); assertEquals(ctx_.base_getSelf(), ((ATAsyncMessage) asyncMsg).getSender()); }
public NATMethod(ATSymbol name, ATTable parameters, ATAbstractGrammar body) {
public NATMethod(ATSymbol name, ATTable parameters, ATBegin body) {
public NATMethod(ATSymbol name, ATTable parameters, ATAbstractGrammar body) { name_ = name; parameters_ = parameters; body_ = body; }
public synchronized void removeAll(){
public void removeAll(){
public synchronized void removeAll(){ layout = null; tc = null; ac = null; drawables.clear(); displayRemover = null; setBorder(BorderFactory.createEmptyBorder()); painter = null; super.removeAll(); }
if ("REPORT".equals(name)) { setMethod(new ReportMethod(uri));
if ("MKCOL".equals(name)) { setMethod(new MkColMethod(uri));
public void setMethodName(String name, String uri) throws CalFacadeException { if ("REPORT".equals(name)) { setMethod(new ReportMethod(uri)); } else if ("PROPFIND".equals(name)) { setMethod(new PropFindMethod(uri)); } else { super.setMethodName(name, uri); } }
} else if ("REPORT".equals(name)) { setMethod(new ReportMethod(uri));
public void setMethodName(String name, String uri) throws CalFacadeException { if ("REPORT".equals(name)) { setMethod(new ReportMethod(uri)); } else if ("PROPFIND".equals(name)) { setMethod(new PropFindMethod(uri)); } else { super.setMethodName(name, uri); } }
form.initFields(); form.setEvent(null);
initFields(form);
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access and set request parameters */ if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } /** Set the objects to null so we get new ones. */ form.initFields(); form.setEvent(null); form.assignAlertEvent(true); form.assignAddingEvent(true); form.resetEvent(); return "continue"; }
form.resetEvent();
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access and set request parameters */ if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } /** Set the objects to null so we get new ones. */ form.initFields(); form.setEvent(null); form.assignAlertEvent(true); form.assignAddingEvent(true); form.resetEvent(); return "continue"; }
keyId = new IntSelectId(id, IntSelectId.AHasPrecedence);
categoryId = new IntSelectId(id, IntSelectId.AHasPrecedence);
public void resetEvent() { getEvent(); // Make sure we have one /* Implant the current id(s) in new entries */ int id = 0; BwCategory k = event.getFirstCategory(); if (k != null) { id = k.getId(); setCategory(k); } /* A is the All box, B is the user preferred values. */ keyId = new IntSelectId(id, IntSelectId.AHasPrecedence); BwSponsor s = event.getSponsor(); id = 0; if (s != null) { id = s.getId(); setSponsor(s); } spId = new IntSelectId(id, IntSelectId.AHasPrecedence); BwLocation l = event.getLocation(); id = 0; if (l != null) { id = l.getId(); setLocation(l); } locId = new IntSelectId(id, IntSelectId.AHasPrecedence); BwCalendar c = event.getCalendar(); id = 0; if (c != null) { id = c.getId(); setCalendar(c); } calendarId = new IntSelectId(id, IntSelectId.AHasPrecedence); }
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); Canvas3D canvas3D = new Canvas3D(config); add("Center", canvas3D); BranchGroup scene = createSceneGraph(baz,ang); SimpleUniverse simpleU = new SimpleUniverse(canvas3D); simpleU.getViewingPlatform().setNominalViewingTransform(); simpleU.addBranchGraph(scene); }
try { GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); Canvas3D canvas3D = new Canvas3D(config); add("Center", canvas3D); BranchGroup scene = createSceneGraph(baz, ang); SimpleUniverse simpleU = new SimpleUniverse(canvas3D); simpleU.getViewingPlatform().setNominalViewingTransform(); simpleU.addBranchGraph(scene); } catch(Throwable t) { GUIReporter.swapGreetingAndHandle(t, "Oooops! GEE was unable to create the particle motion animation. There must be a problem in the configuration of the animation on this system. " + "Don't panic ... this is our fault, not yours. If you use the Save " + "button at the bottom of this screen to make a file of the details of this problem and email it to: [email protected] and we will try to " + "help fix the configuration problem leading to this little hiccup. You should be able to continue your current " + "GEE session without trouble. Only particle motion animations are affected by this problem. " + "Thanks for your help in improving GEE!"); } }
public PartMo(float baz, float ang) { setLayout(new BorderLayout()); // Create Canvas3D GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); // if(config == null) System.out.println("The configuration is NULL"); //else System.out.println("Teh confiugraion is NOT NULL"); Canvas3D canvas3D = new Canvas3D(config); add("Center", canvas3D); BranchGroup scene = createSceneGraph(baz,ang); //System.out.println("after createing scenGraph"); // SimpleUniverse is a Convenience Utility class SimpleUniverse simpleU = new SimpleUniverse(canvas3D); //stem.out.println("formed the simpeUniverse"); //add(canvas3D, BorderLayout.CENTER); //stem.out.println("added the canvas3D to the panel"); // This will move the ViewPlatform back a bit so the // objects in the scene can be viewed. simpleU.getViewingPlatform().setNominalViewingTransform(); //stem.out.println("after setting the nominalViewing transform"); simpleU.addBranchGraph(scene); //stem.out.println("&&&after addBranchGraph(scene)"); //throw new IllegalArgumentException("not important"); } // end of constructor
Text is placed in the global coordinate sytem at locations transformed by the PlaceCoordSystem object. This keeps them facing the viewer, but in the proper location.
* Text is placed in the global coordinate sytem at locations * transformed by the PlaceCoordSystem object. This keeps them facing * the viewer, but in the proper location.
public BranchGroup createSceneGraph(float baz, float ang) { BranchGroup objRoot = new BranchGroup(); BranchGroup Axes = new Axis().getAxisBG(); BranchGroup Surface = new Axis().getSurfaceBG(); BranchGroup Motion = new MotionVector(baz,ang).getMotionBG(); BranchGroup Trace = new Traces(baz,ang).getTraceBG(); Transform3D rotateX = new Transform3D(); Transform3D rotateY = new Transform3D(); Transform3D rotateZ = new Transform3D(); double zRotation = 90.0d; double xRotation = -135.0d; double yRotation = -45.0d; rotateX.rotX(Math.toRadians(xRotation)); rotateZ.rotZ(Math.toRadians(zRotation)); rotateY.rotY(Math.toRadians(yRotation)); Transform3D rotate = new Transform3D(); Transform3D shift = new Transform3D(); Transform3D scale = new Transform3D(); Transform3D PlaceCoordSystem = new Transform3D(); rotate.mul(rotateZ); rotate.mul(rotateY); rotate.mul(rotateX); scale.setScale(0.5d); shift.setTranslation(new Vector3f(0.0f,0.4f,0.00f)); PlaceCoordSystem.mul(shift); PlaceCoordSystem.mul(rotate); PlaceCoordSystem.mul(scale); Transform3D SurfShift = new Transform3D(); SurfShift.setTranslation(new Vector3f(0.0f,0.36f,0.00f)); Transform3D PlaceSurface = new Transform3D(); PlaceSurface.mul(SurfShift); PlaceSurface.mul(rotate); PlaceSurface.mul(scale); /* Text is placed in the global coordinate sytem at locations transformed by the PlaceCoordSystem object. This keeps them facing the viewer, but in the proper location. */ Point3f textpt = new Point3f(1.0f,0.0f,0.0f); PlaceCoordSystem.transform(textpt); Text2D up = new Text2D("Up", textpt, new Color3f(1.0f, 0f, 0.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(up); textpt = new Point3f(-1.2f,0.0f,0.0f); PlaceCoordSystem.transform(textpt); Text2D down = new Text2D("Down", textpt, new Color3f(1.0f, 0f, 0.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(down); textpt = new Point3f(0.0f,1.2f,0.0f); PlaceCoordSystem.transform(textpt); Text2D east = new Text2D("East", textpt, new Color3f(0f, 1.0f, 0.2f), "Helvetica", 16, Font.BOLD); objRoot.addChild(east); textpt = new Point3f(0.0f,-1.2f,0.2f); PlaceCoordSystem.transform(textpt); Text2D west = new Text2D("West", textpt, new Color3f(0f, 1.0f, 0.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(west); textpt = new Point3f(0.0f,0.0f,1.1f); PlaceCoordSystem.transform(textpt); Text2D north = new Text2D("North", textpt, new Color3f(0f, 0f, 1.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(north); textpt = new Point3f(0.0f,0.0f,-1.2f); PlaceCoordSystem.transform(textpt); Text2D south = new Text2D("South", textpt, new Color3f(0f, 0f, 1.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(south); textpt = new Point3f(-1.2f,-1.4f,-1.0f); Text2D caption = new Text2D("Press and Hold any key to start animation", textpt, new Color3f(0f, 0f, 0.0f), "TimesRoman", 24, Font.BOLD); objRoot.addChild(caption); /* Set up the animation of the traces */ Alpha alpha = new Alpha(-1, 4000); TransformGroup ZsingAlong = new TransformGroup(); Transform3D ZaxisOfPos = new Transform3D(); ZaxisOfPos.set(new Vector3f(1.0f,0.0f,0.0f)); ZsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup NsingAlong = new TransformGroup(); Transform3D NaxisOfPos = new Transform3D(); NaxisOfPos.set(new Vector3f(1.0f,0.0f,0.0f)); NsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup EsingAlong = new TransformGroup(); Transform3D EaxisOfPos = new Transform3D(); EaxisOfPos.set(new Vector3f(1.0f,0.0f,0.0f)); EsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); int nknots = new Traces(baz,ang).getNumberOfPoints(); Point3f zSing[] = new Point3f[nknots]; Point3f eSing[] = new Point3f[nknots]; Point3f nSing[] = new Point3f[nknots]; float knots[] = new float[nknots]; float zknots[] = new float[nknots]; float knotInc = 1.0f/(nknots-1); int i = 0; while (i < nknots) { knots[i] = i*knotInc; zknots[i] = i*knotInc; i++; } new Traces(baz,ang).getSingAlongPoints(zSing,nSing,eSing); //System.out.println("before tjo interpolator"); tjoInterpolator nSinger = new tjoInterpolator(alpha, NsingAlong, NaxisOfPos, knots, nSing); //System.out.println("after tjo interpolator"); nSinger.setSchedulingBounds(new BoundingSphere()); //System.out.println("after set scheduling bounds"); //System.out.println("before tjo interpolator"); tjoInterpolator eSinger = new tjoInterpolator(alpha, EsingAlong, EaxisOfPos, knots, eSing); //System.out.println("after tjo interpolator"); eSinger.setSchedulingBounds(new BoundingSphere()); //System.out.println("after set scheduling bounds"); //System.out.println("before tjo interpolator"); tjoInterpolator zSinger = new tjoInterpolator(alpha, ZsingAlong, ZaxisOfPos, knots, zSing); //System.out.println("after tjo interpolator"); zSinger.setSchedulingBounds(new BoundingSphere()); //System.out.println("after set scheduling bounds"); int GMknots = 41; Point3f GMpoints[] = new Point3f[41]; Point3f GMzOnly[] = new Point3f[41]; Point3f GMeOnly[] = new Point3f[41]; Point3f GMnOnly[] = new Point3f[41]; new MotionVector(baz,ang).getMotionPoints(GMpoints); float gknots[] = new float[GMknots]; float gnotInc = 1.0f/(GMknots-1); i = 0; while (i < GMknots) { gknots[i] = i*gnotInc; // //System.out.println("GM " + i + " " + GMpoints[i]); float t[] = new float[3]; GMpoints[i].get(t); GMzOnly[i]=new Point3f(t[0],0.0f,0.0f); GMeOnly[i]=new Point3f(0.0f,t[1],0.0f); GMnOnly[i]=new Point3f(0.0f,0.0f,t[2]); PlaceCoordSystem.transform(GMpoints[i]); PlaceCoordSystem.transform(GMzOnly[i]); PlaceCoordSystem.transform(GMeOnly[i]); PlaceCoordSystem.transform(GMnOnly[i]); i++; } TransformGroup GMsingAlong = new TransformGroup(); GMsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup GMzOnly_singAlong = new TransformGroup(); GMzOnly_singAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup GMnOnly_singAlong = new TransformGroup(); GMnOnly_singAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup GMeOnly_singAlong = new TransformGroup(); GMeOnly_singAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); Transform3D GMaxisOfPos = new Transform3D(); GMaxisOfPos.set(new Vector3f(0.0f,1.0f,0.0f)); tjoInterpolator gmSinger = new tjoInterpolator(alpha, GMsingAlong, GMaxisOfPos, gknots, GMpoints); gmSinger.setSchedulingBounds(new BoundingSphere()); tjoInterpolator gmZonlySinger = new tjoInterpolator(alpha, GMzOnly_singAlong, GMaxisOfPos, gknots, GMzOnly); gmZonlySinger.setSchedulingBounds(new BoundingSphere()); tjoInterpolator gmNonlySinger = new tjoInterpolator(alpha, GMnOnly_singAlong, GMaxisOfPos, gknots, GMnOnly); gmNonlySinger.setSchedulingBounds(new BoundingSphere()); tjoInterpolator gmEonlySinger = new tjoInterpolator(alpha, GMeOnly_singAlong, GMaxisOfPos, gknots, GMeOnly); gmEonlySinger.setSchedulingBounds(new BoundingSphere()); TransformGroup objPlace3D = new TransformGroup(PlaceCoordSystem); TransformGroup objPlaceSurf = new TransformGroup(PlaceSurface); Background background = new Background(); background.setColor(0.6f, 0.6f, 0.6f); background.setApplicationBounds(new BoundingSphere()); objRoot.addChild(background); objPlace3D.addChild(Axes); objPlace3D.addChild(Motion); objRoot.addChild(objPlace3D); objPlaceSurf.addChild(Surface); objRoot.addChild(objPlaceSurf); /* objPlaceAxesText.addChild(AxesText); objRoot.addChild(objPlaceAxesText); */ objRoot.addChild(Trace); objRoot.addChild(ZsingAlong); objRoot.addChild(zSinger); Appearance zSphere = new Appearance(); ColoringAttributes zCA = new ColoringAttributes(); zCA.setColor(1.0f,0.0f,0.0f); zSphere.setColoringAttributes(zCA); ZsingAlong.addChild(new Sphere(0.02f,zSphere)); objRoot.addChild(NsingAlong); objRoot.addChild(nSinger); Appearance nSphere = new Appearance(); ColoringAttributes nCA = new ColoringAttributes(); nCA.setColor(0.0f,0.0f,1.0f); nSphere.setColoringAttributes(nCA); NsingAlong.addChild(new Sphere(0.02f,nSphere)); objRoot.addChild(EsingAlong); objRoot.addChild(eSinger); Appearance eSphere = new Appearance(); ColoringAttributes eCA = new ColoringAttributes(); eCA.setColor(0.0f,1.0f,0.0f); eSphere.setColoringAttributes(eCA); EsingAlong.addChild(new Sphere(0.02f,eSphere)); objRoot.addChild(GMzOnly_singAlong); objRoot.addChild(gmZonlySinger); Appearance gmZonlySphere = new Appearance(); ColoringAttributes gmZonlyCA = new ColoringAttributes(); gmZonlyCA.setColor(1.0f,0.0f,0.0f); gmZonlySphere.setColoringAttributes(gmZonlyCA); GMzOnly_singAlong.addChild(new Sphere(0.015f,gmZonlySphere)); objRoot.addChild(GMnOnly_singAlong); objRoot.addChild(gmNonlySinger); Appearance gmNonlySphere = new Appearance(); ColoringAttributes gmNonlyCA = new ColoringAttributes(); gmNonlyCA.setColor(0.0f,0.0f,1.0f); gmNonlySphere.setColoringAttributes(gmNonlyCA); GMnOnly_singAlong.addChild(new Sphere(0.015f,gmNonlySphere)); objRoot.addChild(GMeOnly_singAlong); objRoot.addChild(gmEonlySinger); Appearance gmEonlySphere = new Appearance(); ColoringAttributes gmEonlyCA = new ColoringAttributes(); gmEonlyCA.setColor(0.0f,1.0f,0.0f); gmEonlySphere.setColoringAttributes(gmEonlyCA); GMeOnly_singAlong.addChild(new Sphere(0.015f,gmEonlySphere)); objRoot.addChild(GMsingAlong); objRoot.addChild(gmSinger); Appearance gmSphere = new Appearance(); ColoringAttributes gmCA = new ColoringAttributes(); gmCA.setColor(0.4f,0.2f,0.2f); gmSphere.setColoringAttributes(gmCA); GMsingAlong.addChild(new Sphere(0.02f,gmSphere)); // Let Java 3D perform optimizations on this scene graph. objRoot.compile(); //System.out.println("returning from CreaetScene Graph"); return objRoot; } // end of CreateSceneGraph method
/* Set up the animation of the traces
/* * Set up the animation of the traces
public BranchGroup createSceneGraph(float baz, float ang) { BranchGroup objRoot = new BranchGroup(); BranchGroup Axes = new Axis().getAxisBG(); BranchGroup Surface = new Axis().getSurfaceBG(); BranchGroup Motion = new MotionVector(baz,ang).getMotionBG(); BranchGroup Trace = new Traces(baz,ang).getTraceBG(); Transform3D rotateX = new Transform3D(); Transform3D rotateY = new Transform3D(); Transform3D rotateZ = new Transform3D(); double zRotation = 90.0d; double xRotation = -135.0d; double yRotation = -45.0d; rotateX.rotX(Math.toRadians(xRotation)); rotateZ.rotZ(Math.toRadians(zRotation)); rotateY.rotY(Math.toRadians(yRotation)); Transform3D rotate = new Transform3D(); Transform3D shift = new Transform3D(); Transform3D scale = new Transform3D(); Transform3D PlaceCoordSystem = new Transform3D(); rotate.mul(rotateZ); rotate.mul(rotateY); rotate.mul(rotateX); scale.setScale(0.5d); shift.setTranslation(new Vector3f(0.0f,0.4f,0.00f)); PlaceCoordSystem.mul(shift); PlaceCoordSystem.mul(rotate); PlaceCoordSystem.mul(scale); Transform3D SurfShift = new Transform3D(); SurfShift.setTranslation(new Vector3f(0.0f,0.36f,0.00f)); Transform3D PlaceSurface = new Transform3D(); PlaceSurface.mul(SurfShift); PlaceSurface.mul(rotate); PlaceSurface.mul(scale); /* Text is placed in the global coordinate sytem at locations transformed by the PlaceCoordSystem object. This keeps them facing the viewer, but in the proper location. */ Point3f textpt = new Point3f(1.0f,0.0f,0.0f); PlaceCoordSystem.transform(textpt); Text2D up = new Text2D("Up", textpt, new Color3f(1.0f, 0f, 0.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(up); textpt = new Point3f(-1.2f,0.0f,0.0f); PlaceCoordSystem.transform(textpt); Text2D down = new Text2D("Down", textpt, new Color3f(1.0f, 0f, 0.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(down); textpt = new Point3f(0.0f,1.2f,0.0f); PlaceCoordSystem.transform(textpt); Text2D east = new Text2D("East", textpt, new Color3f(0f, 1.0f, 0.2f), "Helvetica", 16, Font.BOLD); objRoot.addChild(east); textpt = new Point3f(0.0f,-1.2f,0.2f); PlaceCoordSystem.transform(textpt); Text2D west = new Text2D("West", textpt, new Color3f(0f, 1.0f, 0.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(west); textpt = new Point3f(0.0f,0.0f,1.1f); PlaceCoordSystem.transform(textpt); Text2D north = new Text2D("North", textpt, new Color3f(0f, 0f, 1.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(north); textpt = new Point3f(0.0f,0.0f,-1.2f); PlaceCoordSystem.transform(textpt); Text2D south = new Text2D("South", textpt, new Color3f(0f, 0f, 1.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(south); textpt = new Point3f(-1.2f,-1.4f,-1.0f); Text2D caption = new Text2D("Press and Hold any key to start animation", textpt, new Color3f(0f, 0f, 0.0f), "TimesRoman", 24, Font.BOLD); objRoot.addChild(caption); /* Set up the animation of the traces */ Alpha alpha = new Alpha(-1, 4000); TransformGroup ZsingAlong = new TransformGroup(); Transform3D ZaxisOfPos = new Transform3D(); ZaxisOfPos.set(new Vector3f(1.0f,0.0f,0.0f)); ZsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup NsingAlong = new TransformGroup(); Transform3D NaxisOfPos = new Transform3D(); NaxisOfPos.set(new Vector3f(1.0f,0.0f,0.0f)); NsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup EsingAlong = new TransformGroup(); Transform3D EaxisOfPos = new Transform3D(); EaxisOfPos.set(new Vector3f(1.0f,0.0f,0.0f)); EsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); int nknots = new Traces(baz,ang).getNumberOfPoints(); Point3f zSing[] = new Point3f[nknots]; Point3f eSing[] = new Point3f[nknots]; Point3f nSing[] = new Point3f[nknots]; float knots[] = new float[nknots]; float zknots[] = new float[nknots]; float knotInc = 1.0f/(nknots-1); int i = 0; while (i < nknots) { knots[i] = i*knotInc; zknots[i] = i*knotInc; i++; } new Traces(baz,ang).getSingAlongPoints(zSing,nSing,eSing); //System.out.println("before tjo interpolator"); tjoInterpolator nSinger = new tjoInterpolator(alpha, NsingAlong, NaxisOfPos, knots, nSing); //System.out.println("after tjo interpolator"); nSinger.setSchedulingBounds(new BoundingSphere()); //System.out.println("after set scheduling bounds"); //System.out.println("before tjo interpolator"); tjoInterpolator eSinger = new tjoInterpolator(alpha, EsingAlong, EaxisOfPos, knots, eSing); //System.out.println("after tjo interpolator"); eSinger.setSchedulingBounds(new BoundingSphere()); //System.out.println("after set scheduling bounds"); //System.out.println("before tjo interpolator"); tjoInterpolator zSinger = new tjoInterpolator(alpha, ZsingAlong, ZaxisOfPos, knots, zSing); //System.out.println("after tjo interpolator"); zSinger.setSchedulingBounds(new BoundingSphere()); //System.out.println("after set scheduling bounds"); int GMknots = 41; Point3f GMpoints[] = new Point3f[41]; Point3f GMzOnly[] = new Point3f[41]; Point3f GMeOnly[] = new Point3f[41]; Point3f GMnOnly[] = new Point3f[41]; new MotionVector(baz,ang).getMotionPoints(GMpoints); float gknots[] = new float[GMknots]; float gnotInc = 1.0f/(GMknots-1); i = 0; while (i < GMknots) { gknots[i] = i*gnotInc; // //System.out.println("GM " + i + " " + GMpoints[i]); float t[] = new float[3]; GMpoints[i].get(t); GMzOnly[i]=new Point3f(t[0],0.0f,0.0f); GMeOnly[i]=new Point3f(0.0f,t[1],0.0f); GMnOnly[i]=new Point3f(0.0f,0.0f,t[2]); PlaceCoordSystem.transform(GMpoints[i]); PlaceCoordSystem.transform(GMzOnly[i]); PlaceCoordSystem.transform(GMeOnly[i]); PlaceCoordSystem.transform(GMnOnly[i]); i++; } TransformGroup GMsingAlong = new TransformGroup(); GMsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup GMzOnly_singAlong = new TransformGroup(); GMzOnly_singAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup GMnOnly_singAlong = new TransformGroup(); GMnOnly_singAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup GMeOnly_singAlong = new TransformGroup(); GMeOnly_singAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); Transform3D GMaxisOfPos = new Transform3D(); GMaxisOfPos.set(new Vector3f(0.0f,1.0f,0.0f)); tjoInterpolator gmSinger = new tjoInterpolator(alpha, GMsingAlong, GMaxisOfPos, gknots, GMpoints); gmSinger.setSchedulingBounds(new BoundingSphere()); tjoInterpolator gmZonlySinger = new tjoInterpolator(alpha, GMzOnly_singAlong, GMaxisOfPos, gknots, GMzOnly); gmZonlySinger.setSchedulingBounds(new BoundingSphere()); tjoInterpolator gmNonlySinger = new tjoInterpolator(alpha, GMnOnly_singAlong, GMaxisOfPos, gknots, GMnOnly); gmNonlySinger.setSchedulingBounds(new BoundingSphere()); tjoInterpolator gmEonlySinger = new tjoInterpolator(alpha, GMeOnly_singAlong, GMaxisOfPos, gknots, GMeOnly); gmEonlySinger.setSchedulingBounds(new BoundingSphere()); TransformGroup objPlace3D = new TransformGroup(PlaceCoordSystem); TransformGroup objPlaceSurf = new TransformGroup(PlaceSurface); Background background = new Background(); background.setColor(0.6f, 0.6f, 0.6f); background.setApplicationBounds(new BoundingSphere()); objRoot.addChild(background); objPlace3D.addChild(Axes); objPlace3D.addChild(Motion); objRoot.addChild(objPlace3D); objPlaceSurf.addChild(Surface); objRoot.addChild(objPlaceSurf); /* objPlaceAxesText.addChild(AxesText); objRoot.addChild(objPlaceAxesText); */ objRoot.addChild(Trace); objRoot.addChild(ZsingAlong); objRoot.addChild(zSinger); Appearance zSphere = new Appearance(); ColoringAttributes zCA = new ColoringAttributes(); zCA.setColor(1.0f,0.0f,0.0f); zSphere.setColoringAttributes(zCA); ZsingAlong.addChild(new Sphere(0.02f,zSphere)); objRoot.addChild(NsingAlong); objRoot.addChild(nSinger); Appearance nSphere = new Appearance(); ColoringAttributes nCA = new ColoringAttributes(); nCA.setColor(0.0f,0.0f,1.0f); nSphere.setColoringAttributes(nCA); NsingAlong.addChild(new Sphere(0.02f,nSphere)); objRoot.addChild(EsingAlong); objRoot.addChild(eSinger); Appearance eSphere = new Appearance(); ColoringAttributes eCA = new ColoringAttributes(); eCA.setColor(0.0f,1.0f,0.0f); eSphere.setColoringAttributes(eCA); EsingAlong.addChild(new Sphere(0.02f,eSphere)); objRoot.addChild(GMzOnly_singAlong); objRoot.addChild(gmZonlySinger); Appearance gmZonlySphere = new Appearance(); ColoringAttributes gmZonlyCA = new ColoringAttributes(); gmZonlyCA.setColor(1.0f,0.0f,0.0f); gmZonlySphere.setColoringAttributes(gmZonlyCA); GMzOnly_singAlong.addChild(new Sphere(0.015f,gmZonlySphere)); objRoot.addChild(GMnOnly_singAlong); objRoot.addChild(gmNonlySinger); Appearance gmNonlySphere = new Appearance(); ColoringAttributes gmNonlyCA = new ColoringAttributes(); gmNonlyCA.setColor(0.0f,0.0f,1.0f); gmNonlySphere.setColoringAttributes(gmNonlyCA); GMnOnly_singAlong.addChild(new Sphere(0.015f,gmNonlySphere)); objRoot.addChild(GMeOnly_singAlong); objRoot.addChild(gmEonlySinger); Appearance gmEonlySphere = new Appearance(); ColoringAttributes gmEonlyCA = new ColoringAttributes(); gmEonlyCA.setColor(0.0f,1.0f,0.0f); gmEonlySphere.setColoringAttributes(gmEonlyCA); GMeOnly_singAlong.addChild(new Sphere(0.015f,gmEonlySphere)); objRoot.addChild(GMsingAlong); objRoot.addChild(gmSinger); Appearance gmSphere = new Appearance(); ColoringAttributes gmCA = new ColoringAttributes(); gmCA.setColor(0.4f,0.2f,0.2f); gmSphere.setColoringAttributes(gmCA); GMsingAlong.addChild(new Sphere(0.02f,gmSphere)); // Let Java 3D perform optimizations on this scene graph. objRoot.compile(); //System.out.println("returning from CreaetScene Graph"); return objRoot; } // end of CreateSceneGraph method
float gnotInc = 1.0f/(GMknots-1); i = 0; while (i < GMknots) { gknots[i] = i*gnotInc;
float gnotInc = 1.0f / (GMknots - 1); for(i = 0; i < GMknots; i++) { gknots[i] = i * gnotInc;
public BranchGroup createSceneGraph(float baz, float ang) { BranchGroup objRoot = new BranchGroup(); BranchGroup Axes = new Axis().getAxisBG(); BranchGroup Surface = new Axis().getSurfaceBG(); BranchGroup Motion = new MotionVector(baz,ang).getMotionBG(); BranchGroup Trace = new Traces(baz,ang).getTraceBG(); Transform3D rotateX = new Transform3D(); Transform3D rotateY = new Transform3D(); Transform3D rotateZ = new Transform3D(); double zRotation = 90.0d; double xRotation = -135.0d; double yRotation = -45.0d; rotateX.rotX(Math.toRadians(xRotation)); rotateZ.rotZ(Math.toRadians(zRotation)); rotateY.rotY(Math.toRadians(yRotation)); Transform3D rotate = new Transform3D(); Transform3D shift = new Transform3D(); Transform3D scale = new Transform3D(); Transform3D PlaceCoordSystem = new Transform3D(); rotate.mul(rotateZ); rotate.mul(rotateY); rotate.mul(rotateX); scale.setScale(0.5d); shift.setTranslation(new Vector3f(0.0f,0.4f,0.00f)); PlaceCoordSystem.mul(shift); PlaceCoordSystem.mul(rotate); PlaceCoordSystem.mul(scale); Transform3D SurfShift = new Transform3D(); SurfShift.setTranslation(new Vector3f(0.0f,0.36f,0.00f)); Transform3D PlaceSurface = new Transform3D(); PlaceSurface.mul(SurfShift); PlaceSurface.mul(rotate); PlaceSurface.mul(scale); /* Text is placed in the global coordinate sytem at locations transformed by the PlaceCoordSystem object. This keeps them facing the viewer, but in the proper location. */ Point3f textpt = new Point3f(1.0f,0.0f,0.0f); PlaceCoordSystem.transform(textpt); Text2D up = new Text2D("Up", textpt, new Color3f(1.0f, 0f, 0.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(up); textpt = new Point3f(-1.2f,0.0f,0.0f); PlaceCoordSystem.transform(textpt); Text2D down = new Text2D("Down", textpt, new Color3f(1.0f, 0f, 0.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(down); textpt = new Point3f(0.0f,1.2f,0.0f); PlaceCoordSystem.transform(textpt); Text2D east = new Text2D("East", textpt, new Color3f(0f, 1.0f, 0.2f), "Helvetica", 16, Font.BOLD); objRoot.addChild(east); textpt = new Point3f(0.0f,-1.2f,0.2f); PlaceCoordSystem.transform(textpt); Text2D west = new Text2D("West", textpt, new Color3f(0f, 1.0f, 0.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(west); textpt = new Point3f(0.0f,0.0f,1.1f); PlaceCoordSystem.transform(textpt); Text2D north = new Text2D("North", textpt, new Color3f(0f, 0f, 1.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(north); textpt = new Point3f(0.0f,0.0f,-1.2f); PlaceCoordSystem.transform(textpt); Text2D south = new Text2D("South", textpt, new Color3f(0f, 0f, 1.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(south); textpt = new Point3f(-1.2f,-1.4f,-1.0f); Text2D caption = new Text2D("Press and Hold any key to start animation", textpt, new Color3f(0f, 0f, 0.0f), "TimesRoman", 24, Font.BOLD); objRoot.addChild(caption); /* Set up the animation of the traces */ Alpha alpha = new Alpha(-1, 4000); TransformGroup ZsingAlong = new TransformGroup(); Transform3D ZaxisOfPos = new Transform3D(); ZaxisOfPos.set(new Vector3f(1.0f,0.0f,0.0f)); ZsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup NsingAlong = new TransformGroup(); Transform3D NaxisOfPos = new Transform3D(); NaxisOfPos.set(new Vector3f(1.0f,0.0f,0.0f)); NsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup EsingAlong = new TransformGroup(); Transform3D EaxisOfPos = new Transform3D(); EaxisOfPos.set(new Vector3f(1.0f,0.0f,0.0f)); EsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); int nknots = new Traces(baz,ang).getNumberOfPoints(); Point3f zSing[] = new Point3f[nknots]; Point3f eSing[] = new Point3f[nknots]; Point3f nSing[] = new Point3f[nknots]; float knots[] = new float[nknots]; float zknots[] = new float[nknots]; float knotInc = 1.0f/(nknots-1); int i = 0; while (i < nknots) { knots[i] = i*knotInc; zknots[i] = i*knotInc; i++; } new Traces(baz,ang).getSingAlongPoints(zSing,nSing,eSing); //System.out.println("before tjo interpolator"); tjoInterpolator nSinger = new tjoInterpolator(alpha, NsingAlong, NaxisOfPos, knots, nSing); //System.out.println("after tjo interpolator"); nSinger.setSchedulingBounds(new BoundingSphere()); //System.out.println("after set scheduling bounds"); //System.out.println("before tjo interpolator"); tjoInterpolator eSinger = new tjoInterpolator(alpha, EsingAlong, EaxisOfPos, knots, eSing); //System.out.println("after tjo interpolator"); eSinger.setSchedulingBounds(new BoundingSphere()); //System.out.println("after set scheduling bounds"); //System.out.println("before tjo interpolator"); tjoInterpolator zSinger = new tjoInterpolator(alpha, ZsingAlong, ZaxisOfPos, knots, zSing); //System.out.println("after tjo interpolator"); zSinger.setSchedulingBounds(new BoundingSphere()); //System.out.println("after set scheduling bounds"); int GMknots = 41; Point3f GMpoints[] = new Point3f[41]; Point3f GMzOnly[] = new Point3f[41]; Point3f GMeOnly[] = new Point3f[41]; Point3f GMnOnly[] = new Point3f[41]; new MotionVector(baz,ang).getMotionPoints(GMpoints); float gknots[] = new float[GMknots]; float gnotInc = 1.0f/(GMknots-1); i = 0; while (i < GMknots) { gknots[i] = i*gnotInc; // //System.out.println("GM " + i + " " + GMpoints[i]); float t[] = new float[3]; GMpoints[i].get(t); GMzOnly[i]=new Point3f(t[0],0.0f,0.0f); GMeOnly[i]=new Point3f(0.0f,t[1],0.0f); GMnOnly[i]=new Point3f(0.0f,0.0f,t[2]); PlaceCoordSystem.transform(GMpoints[i]); PlaceCoordSystem.transform(GMzOnly[i]); PlaceCoordSystem.transform(GMeOnly[i]); PlaceCoordSystem.transform(GMnOnly[i]); i++; } TransformGroup GMsingAlong = new TransformGroup(); GMsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup GMzOnly_singAlong = new TransformGroup(); GMzOnly_singAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup GMnOnly_singAlong = new TransformGroup(); GMnOnly_singAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup GMeOnly_singAlong = new TransformGroup(); GMeOnly_singAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); Transform3D GMaxisOfPos = new Transform3D(); GMaxisOfPos.set(new Vector3f(0.0f,1.0f,0.0f)); tjoInterpolator gmSinger = new tjoInterpolator(alpha, GMsingAlong, GMaxisOfPos, gknots, GMpoints); gmSinger.setSchedulingBounds(new BoundingSphere()); tjoInterpolator gmZonlySinger = new tjoInterpolator(alpha, GMzOnly_singAlong, GMaxisOfPos, gknots, GMzOnly); gmZonlySinger.setSchedulingBounds(new BoundingSphere()); tjoInterpolator gmNonlySinger = new tjoInterpolator(alpha, GMnOnly_singAlong, GMaxisOfPos, gknots, GMnOnly); gmNonlySinger.setSchedulingBounds(new BoundingSphere()); tjoInterpolator gmEonlySinger = new tjoInterpolator(alpha, GMeOnly_singAlong, GMaxisOfPos, gknots, GMeOnly); gmEonlySinger.setSchedulingBounds(new BoundingSphere()); TransformGroup objPlace3D = new TransformGroup(PlaceCoordSystem); TransformGroup objPlaceSurf = new TransformGroup(PlaceSurface); Background background = new Background(); background.setColor(0.6f, 0.6f, 0.6f); background.setApplicationBounds(new BoundingSphere()); objRoot.addChild(background); objPlace3D.addChild(Axes); objPlace3D.addChild(Motion); objRoot.addChild(objPlace3D); objPlaceSurf.addChild(Surface); objRoot.addChild(objPlaceSurf); /* objPlaceAxesText.addChild(AxesText); objRoot.addChild(objPlaceAxesText); */ objRoot.addChild(Trace); objRoot.addChild(ZsingAlong); objRoot.addChild(zSinger); Appearance zSphere = new Appearance(); ColoringAttributes zCA = new ColoringAttributes(); zCA.setColor(1.0f,0.0f,0.0f); zSphere.setColoringAttributes(zCA); ZsingAlong.addChild(new Sphere(0.02f,zSphere)); objRoot.addChild(NsingAlong); objRoot.addChild(nSinger); Appearance nSphere = new Appearance(); ColoringAttributes nCA = new ColoringAttributes(); nCA.setColor(0.0f,0.0f,1.0f); nSphere.setColoringAttributes(nCA); NsingAlong.addChild(new Sphere(0.02f,nSphere)); objRoot.addChild(EsingAlong); objRoot.addChild(eSinger); Appearance eSphere = new Appearance(); ColoringAttributes eCA = new ColoringAttributes(); eCA.setColor(0.0f,1.0f,0.0f); eSphere.setColoringAttributes(eCA); EsingAlong.addChild(new Sphere(0.02f,eSphere)); objRoot.addChild(GMzOnly_singAlong); objRoot.addChild(gmZonlySinger); Appearance gmZonlySphere = new Appearance(); ColoringAttributes gmZonlyCA = new ColoringAttributes(); gmZonlyCA.setColor(1.0f,0.0f,0.0f); gmZonlySphere.setColoringAttributes(gmZonlyCA); GMzOnly_singAlong.addChild(new Sphere(0.015f,gmZonlySphere)); objRoot.addChild(GMnOnly_singAlong); objRoot.addChild(gmNonlySinger); Appearance gmNonlySphere = new Appearance(); ColoringAttributes gmNonlyCA = new ColoringAttributes(); gmNonlyCA.setColor(0.0f,0.0f,1.0f); gmNonlySphere.setColoringAttributes(gmNonlyCA); GMnOnly_singAlong.addChild(new Sphere(0.015f,gmNonlySphere)); objRoot.addChild(GMeOnly_singAlong); objRoot.addChild(gmEonlySinger); Appearance gmEonlySphere = new Appearance(); ColoringAttributes gmEonlyCA = new ColoringAttributes(); gmEonlyCA.setColor(0.0f,1.0f,0.0f); gmEonlySphere.setColoringAttributes(gmEonlyCA); GMeOnly_singAlong.addChild(new Sphere(0.015f,gmEonlySphere)); objRoot.addChild(GMsingAlong); objRoot.addChild(gmSinger); Appearance gmSphere = new Appearance(); ColoringAttributes gmCA = new ColoringAttributes(); gmCA.setColor(0.4f,0.2f,0.2f); gmSphere.setColoringAttributes(gmCA); GMsingAlong.addChild(new Sphere(0.02f,gmSphere)); // Let Java 3D perform optimizations on this scene graph. objRoot.compile(); //System.out.println("returning from CreaetScene Graph"); return objRoot; } // end of CreateSceneGraph method
i++;
public BranchGroup createSceneGraph(float baz, float ang) { BranchGroup objRoot = new BranchGroup(); BranchGroup Axes = new Axis().getAxisBG(); BranchGroup Surface = new Axis().getSurfaceBG(); BranchGroup Motion = new MotionVector(baz,ang).getMotionBG(); BranchGroup Trace = new Traces(baz,ang).getTraceBG(); Transform3D rotateX = new Transform3D(); Transform3D rotateY = new Transform3D(); Transform3D rotateZ = new Transform3D(); double zRotation = 90.0d; double xRotation = -135.0d; double yRotation = -45.0d; rotateX.rotX(Math.toRadians(xRotation)); rotateZ.rotZ(Math.toRadians(zRotation)); rotateY.rotY(Math.toRadians(yRotation)); Transform3D rotate = new Transform3D(); Transform3D shift = new Transform3D(); Transform3D scale = new Transform3D(); Transform3D PlaceCoordSystem = new Transform3D(); rotate.mul(rotateZ); rotate.mul(rotateY); rotate.mul(rotateX); scale.setScale(0.5d); shift.setTranslation(new Vector3f(0.0f,0.4f,0.00f)); PlaceCoordSystem.mul(shift); PlaceCoordSystem.mul(rotate); PlaceCoordSystem.mul(scale); Transform3D SurfShift = new Transform3D(); SurfShift.setTranslation(new Vector3f(0.0f,0.36f,0.00f)); Transform3D PlaceSurface = new Transform3D(); PlaceSurface.mul(SurfShift); PlaceSurface.mul(rotate); PlaceSurface.mul(scale); /* Text is placed in the global coordinate sytem at locations transformed by the PlaceCoordSystem object. This keeps them facing the viewer, but in the proper location. */ Point3f textpt = new Point3f(1.0f,0.0f,0.0f); PlaceCoordSystem.transform(textpt); Text2D up = new Text2D("Up", textpt, new Color3f(1.0f, 0f, 0.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(up); textpt = new Point3f(-1.2f,0.0f,0.0f); PlaceCoordSystem.transform(textpt); Text2D down = new Text2D("Down", textpt, new Color3f(1.0f, 0f, 0.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(down); textpt = new Point3f(0.0f,1.2f,0.0f); PlaceCoordSystem.transform(textpt); Text2D east = new Text2D("East", textpt, new Color3f(0f, 1.0f, 0.2f), "Helvetica", 16, Font.BOLD); objRoot.addChild(east); textpt = new Point3f(0.0f,-1.2f,0.2f); PlaceCoordSystem.transform(textpt); Text2D west = new Text2D("West", textpt, new Color3f(0f, 1.0f, 0.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(west); textpt = new Point3f(0.0f,0.0f,1.1f); PlaceCoordSystem.transform(textpt); Text2D north = new Text2D("North", textpt, new Color3f(0f, 0f, 1.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(north); textpt = new Point3f(0.0f,0.0f,-1.2f); PlaceCoordSystem.transform(textpt); Text2D south = new Text2D("South", textpt, new Color3f(0f, 0f, 1.0f), "Helvetica", 16, Font.BOLD); objRoot.addChild(south); textpt = new Point3f(-1.2f,-1.4f,-1.0f); Text2D caption = new Text2D("Press and Hold any key to start animation", textpt, new Color3f(0f, 0f, 0.0f), "TimesRoman", 24, Font.BOLD); objRoot.addChild(caption); /* Set up the animation of the traces */ Alpha alpha = new Alpha(-1, 4000); TransformGroup ZsingAlong = new TransformGroup(); Transform3D ZaxisOfPos = new Transform3D(); ZaxisOfPos.set(new Vector3f(1.0f,0.0f,0.0f)); ZsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup NsingAlong = new TransformGroup(); Transform3D NaxisOfPos = new Transform3D(); NaxisOfPos.set(new Vector3f(1.0f,0.0f,0.0f)); NsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup EsingAlong = new TransformGroup(); Transform3D EaxisOfPos = new Transform3D(); EaxisOfPos.set(new Vector3f(1.0f,0.0f,0.0f)); EsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); int nknots = new Traces(baz,ang).getNumberOfPoints(); Point3f zSing[] = new Point3f[nknots]; Point3f eSing[] = new Point3f[nknots]; Point3f nSing[] = new Point3f[nknots]; float knots[] = new float[nknots]; float zknots[] = new float[nknots]; float knotInc = 1.0f/(nknots-1); int i = 0; while (i < nknots) { knots[i] = i*knotInc; zknots[i] = i*knotInc; i++; } new Traces(baz,ang).getSingAlongPoints(zSing,nSing,eSing); //System.out.println("before tjo interpolator"); tjoInterpolator nSinger = new tjoInterpolator(alpha, NsingAlong, NaxisOfPos, knots, nSing); //System.out.println("after tjo interpolator"); nSinger.setSchedulingBounds(new BoundingSphere()); //System.out.println("after set scheduling bounds"); //System.out.println("before tjo interpolator"); tjoInterpolator eSinger = new tjoInterpolator(alpha, EsingAlong, EaxisOfPos, knots, eSing); //System.out.println("after tjo interpolator"); eSinger.setSchedulingBounds(new BoundingSphere()); //System.out.println("after set scheduling bounds"); //System.out.println("before tjo interpolator"); tjoInterpolator zSinger = new tjoInterpolator(alpha, ZsingAlong, ZaxisOfPos, knots, zSing); //System.out.println("after tjo interpolator"); zSinger.setSchedulingBounds(new BoundingSphere()); //System.out.println("after set scheduling bounds"); int GMknots = 41; Point3f GMpoints[] = new Point3f[41]; Point3f GMzOnly[] = new Point3f[41]; Point3f GMeOnly[] = new Point3f[41]; Point3f GMnOnly[] = new Point3f[41]; new MotionVector(baz,ang).getMotionPoints(GMpoints); float gknots[] = new float[GMknots]; float gnotInc = 1.0f/(GMknots-1); i = 0; while (i < GMknots) { gknots[i] = i*gnotInc; // //System.out.println("GM " + i + " " + GMpoints[i]); float t[] = new float[3]; GMpoints[i].get(t); GMzOnly[i]=new Point3f(t[0],0.0f,0.0f); GMeOnly[i]=new Point3f(0.0f,t[1],0.0f); GMnOnly[i]=new Point3f(0.0f,0.0f,t[2]); PlaceCoordSystem.transform(GMpoints[i]); PlaceCoordSystem.transform(GMzOnly[i]); PlaceCoordSystem.transform(GMeOnly[i]); PlaceCoordSystem.transform(GMnOnly[i]); i++; } TransformGroup GMsingAlong = new TransformGroup(); GMsingAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup GMzOnly_singAlong = new TransformGroup(); GMzOnly_singAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup GMnOnly_singAlong = new TransformGroup(); GMnOnly_singAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); TransformGroup GMeOnly_singAlong = new TransformGroup(); GMeOnly_singAlong.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); Transform3D GMaxisOfPos = new Transform3D(); GMaxisOfPos.set(new Vector3f(0.0f,1.0f,0.0f)); tjoInterpolator gmSinger = new tjoInterpolator(alpha, GMsingAlong, GMaxisOfPos, gknots, GMpoints); gmSinger.setSchedulingBounds(new BoundingSphere()); tjoInterpolator gmZonlySinger = new tjoInterpolator(alpha, GMzOnly_singAlong, GMaxisOfPos, gknots, GMzOnly); gmZonlySinger.setSchedulingBounds(new BoundingSphere()); tjoInterpolator gmNonlySinger = new tjoInterpolator(alpha, GMnOnly_singAlong, GMaxisOfPos, gknots, GMnOnly); gmNonlySinger.setSchedulingBounds(new BoundingSphere()); tjoInterpolator gmEonlySinger = new tjoInterpolator(alpha, GMeOnly_singAlong, GMaxisOfPos, gknots, GMeOnly); gmEonlySinger.setSchedulingBounds(new BoundingSphere()); TransformGroup objPlace3D = new TransformGroup(PlaceCoordSystem); TransformGroup objPlaceSurf = new TransformGroup(PlaceSurface); Background background = new Background(); background.setColor(0.6f, 0.6f, 0.6f); background.setApplicationBounds(new BoundingSphere()); objRoot.addChild(background); objPlace3D.addChild(Axes); objPlace3D.addChild(Motion); objRoot.addChild(objPlace3D); objPlaceSurf.addChild(Surface); objRoot.addChild(objPlaceSurf); /* objPlaceAxesText.addChild(AxesText); objRoot.addChild(objPlaceAxesText); */ objRoot.addChild(Trace); objRoot.addChild(ZsingAlong); objRoot.addChild(zSinger); Appearance zSphere = new Appearance(); ColoringAttributes zCA = new ColoringAttributes(); zCA.setColor(1.0f,0.0f,0.0f); zSphere.setColoringAttributes(zCA); ZsingAlong.addChild(new Sphere(0.02f,zSphere)); objRoot.addChild(NsingAlong); objRoot.addChild(nSinger); Appearance nSphere = new Appearance(); ColoringAttributes nCA = new ColoringAttributes(); nCA.setColor(0.0f,0.0f,1.0f); nSphere.setColoringAttributes(nCA); NsingAlong.addChild(new Sphere(0.02f,nSphere)); objRoot.addChild(EsingAlong); objRoot.addChild(eSinger); Appearance eSphere = new Appearance(); ColoringAttributes eCA = new ColoringAttributes(); eCA.setColor(0.0f,1.0f,0.0f); eSphere.setColoringAttributes(eCA); EsingAlong.addChild(new Sphere(0.02f,eSphere)); objRoot.addChild(GMzOnly_singAlong); objRoot.addChild(gmZonlySinger); Appearance gmZonlySphere = new Appearance(); ColoringAttributes gmZonlyCA = new ColoringAttributes(); gmZonlyCA.setColor(1.0f,0.0f,0.0f); gmZonlySphere.setColoringAttributes(gmZonlyCA); GMzOnly_singAlong.addChild(new Sphere(0.015f,gmZonlySphere)); objRoot.addChild(GMnOnly_singAlong); objRoot.addChild(gmNonlySinger); Appearance gmNonlySphere = new Appearance(); ColoringAttributes gmNonlyCA = new ColoringAttributes(); gmNonlyCA.setColor(0.0f,0.0f,1.0f); gmNonlySphere.setColoringAttributes(gmNonlyCA); GMnOnly_singAlong.addChild(new Sphere(0.015f,gmNonlySphere)); objRoot.addChild(GMeOnly_singAlong); objRoot.addChild(gmEonlySinger); Appearance gmEonlySphere = new Appearance(); ColoringAttributes gmEonlyCA = new ColoringAttributes(); gmEonlyCA.setColor(0.0f,1.0f,0.0f); gmEonlySphere.setColoringAttributes(gmEonlyCA); GMeOnly_singAlong.addChild(new Sphere(0.015f,gmEonlySphere)); objRoot.addChild(GMsingAlong); objRoot.addChild(gmSinger); Appearance gmSphere = new Appearance(); ColoringAttributes gmCA = new ColoringAttributes(); gmCA.setColor(0.4f,0.2f,0.2f); gmSphere.setColoringAttributes(gmCA); GMsingAlong.addChild(new Sphere(0.02f,gmSphere)); // Let Java 3D perform optimizations on this scene graph. objRoot.compile(); //System.out.println("returning from CreaetScene Graph"); return objRoot; } // end of CreateSceneGraph method
ViewHandler realHandler = getViewHandlerForContext(ctx); if(realHandler!=null){ return realHandler.calculateLocale(ctx); } else{ throw new RuntimeException ("No ViewHandler Found to calculate Locale"); }
IWContext iwc = IWContext.getIWContext(ctx); Locale locale = iwc.getCurrentLocale(); return locale;
public Locale calculateLocale(FacesContext ctx) { ViewHandler realHandler = getViewHandlerForContext(ctx); if(realHandler!=null){ return realHandler.calculateLocale(ctx); } else{ throw new RuntimeException ("No ViewHandler Found to calculate Locale"); } }
return realHandler.createView(ctx,viewId);
UIViewRoot root = realHandler.createView(ctx,viewId); root.setLocale(IWContext.getIWContext(ctx).getCurrentLocale()); return root;
public UIViewRoot createView(FacesContext ctx, String viewId) { ViewHandler realHandler = getViewHandlerForContext(ctx); if(realHandler!=null){ return realHandler.createView(ctx,viewId); } else{ throw new RuntimeException ("No ViewHandler Found to create View"); } }
return realHandler.restoreView(ctx,viewId);
UIViewRoot root = realHandler.restoreView(ctx,viewId); if(root != null){ root.setLocale(IWContext.getIWContext(ctx).getCurrentLocale()); } return root;
public UIViewRoot restoreView(FacesContext ctx, String viewId) { ViewHandler realHandler = getViewHandlerForContext(ctx); if(realHandler!=null){ return realHandler.restoreView(ctx,viewId); } else{ throw new RuntimeException ("No ViewHandler Found for restoreView"); } }
public KortathjonustanAuthorisationEntries findByAuthorizationCode(java.lang.String p0)throws javax.ejb.FinderException{
public KortathjonustanAuthorisationEntries findByAuthorizationCode(java.lang.String p0, IWTimestamp stamp)throws javax.ejb.FinderException{
public KortathjonustanAuthorisationEntries findByAuthorizationCode(java.lang.String p0)throws javax.ejb.FinderException{ com.idega.data.IDOEntity entity = this.idoCheckOutPooledEntity(); Object pk = ((KortathjonustanAuthorisationEntriesBMPBean)entity).ejbFindByAuthorizationCode(p0); this.idoCheckInPooledEntity(entity); return this.findByPrimaryKey(pk);}