rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
selectionDisplay.removeAll(); | removeSelectionDisplay(); | public void createSelectionDisplay(Selection creator){ if(selectionDisplay == null){ logger.debug("creating selection display"); selectionDisplay = new MultiSeismogramWindowDisplay(mouseForwarder, motionForwarder, this); addSelection(creator, selectionDisplay); selectionWindow = new JFrame(tagWindowName); selectionWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { selectionDisplay.removeAll(); } }); selectionWindow.setSize(400, 200); selectionWindow.getContentPane().add(new JScrollPane(selectionDisplay)); Toolkit tk = Toolkit.getDefaultToolkit(); selectionWindow.setLocation((tk.getScreenSize().width - selectionWindow.getSize().width)/2, (tk.getScreenSize().height - selectionWindow.getSize().height)/2); selectionWindow.setVisible(true); }else{ logger.debug("adding another selection"); addSelection(creator,selectionDisplay); selectionWindow.toFront(); } } |
null, | private CalSvcI getSvci() throws CalFacadeException { boolean publicMode = true; if (svci != null) { if (!svci.isOpen()) { svci.open(); svci.beginTransaction(); } return svci; } svci = new CalSvc(); /* account is what we authenticated with. * user, if non-null, is the user calendar we want to access. */ CalSvcIPars pars = new CalSvcIPars(null, // account, null, // account, "org.bedework.app.freebusy.", publicMode, true, // caldav null, // synchId debug); svci.init(pars); svci.open(); svci.beginTransaction(); trans = new IcalTranslator(svci.getIcalCallback(), debug); return svci; } |
|
if (isDefined) { log.debug(indent + " " + "<is-defined/>"); | if (isNotDefined) { log.debug(indent + " " + "<is-not-defined/>"); | public void dump(Logger log, String indent) { StringBuffer sb = new StringBuffer(indent); sb.append("<comp-filter name=\""); sb.append(name); sb.append("\">"); log.debug(sb.toString()); if (isDefined) { log.debug(indent + " " + "<is-defined/>"); } else if (timeRange != null) { timeRange.dump(log, indent + " "); } if (compFilters != null) { Iterator it = compFilters.iterator(); while (it.hasNext()) { CompFilter cf = (CompFilter)it.next(); cf.dump(log, indent + " "); } } if (propFilters != null) { Iterator it = propFilters.iterator(); while (it.hasNext()) { PropFilter pf = (PropFilter)it.next(); pf.dump(log, indent + " "); } } log.debug(indent + "<comp-filter/>"); } |
EtoolsProxyCommand c = (EtoolsProxyCommand) super | ICommandProxy c = (ICommandProxy) super | protected Command getConnectionWithReorientedViewCompleteCommand( CreateConnectionRequest request) { EtoolsProxyCommand c = (EtoolsProxyCommand) super .getConnectionCompleteCommand(request); CompositeCommand cc = (CompositeCommand) c.getICommand(); TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) .getEditingDomain(); ProVerVisualReorientConnectionViewCommand rcvCommand = new ProVerVisualReorientConnectionViewCommand( editingDomain, null); rcvCommand.setEdgeAdaptor(getViewAdapter()); cc.compose(rcvCommand); return c; } |
if (getNsIntf().getAccessControl()) { resp.addHeader("DAV", "1, 2, access-control"); } else { resp.addHeader("DAV", "1, 2"); } | addDavHeader(resp); | public void doMethod(HttpServletRequest req, HttpServletResponse resp) throws WebdavException { if (debug) { trace("GetMethod: doMethod"); } try { WebdavNsNode node = getNsIntf().getNode(getResourceUri(req)); /* Apparently if the node doesn't exist we're supposed to respond * not found, rather than indicate if PUT is allowed for example. */ if ((node == null) || !node.getExists()) { resp.setStatus(HttpServletResponse.SC_NOT_FOUND); return; } if (getNsIntf().getAccessControl()) { resp.addHeader("DAV", "1, 2, access-control"); } else { resp.addHeader("DAV", "1, 2"); } // Lisa say's we need this resp.addHeader("MS-Author-Via", "DAV"); // This probably needs changes StringBuffer methods = new StringBuffer(); Iterator mnames = getNsIntf().getMethods().keySet().iterator(); while (mnames.hasNext()) { if (methods.length() > 0) { methods.append(", "); } methods.append(mnames.next()); } resp.addHeader("Allow", methods.toString()); } catch (WebdavException we) { throw we; } catch (Throwable t) { throw new WebdavException(t); } } |
this.ideaMap.addMouseMotionListener(this); | public IdeaMapController(IdeaMap newIdeaMap) { this.ideaMap = newIdeaMap; this.ideaMap.setFocusTraversalKeysEnabled(false); this.ideaMap.setFocusable(true); this.ideaMap.addFocusListener(this); this.ideaMap.addKeyListener(this); this.ideaMap.addMouseListener(this); } |
|
Dimension size = this.ideaMap.getSize(); Point2D p = new Point2D.Double(evt.getX() - (size.width / 2), evt.getY() - (size.height / 2)); IdeaView hit = this.ideaMap.getRootView().getViewAt(p); if (hit != null) { this.ideaMap.setSelectedView(hit); } | public void mouseClicked(MouseEvent evt) { Dimension size = this.ideaMap.getSize(); Point2D p = new Point2D.Double(evt.getX() - (size.width / 2), evt.getY() - (size.height / 2)); IdeaView hit = this.ideaMap.getRootView().getViewAt(p); if (hit != null) { this.ideaMap.setSelectedView(hit); } } |
|
Dimension size = this.ideaMap.getSize(); Point2D p = new Point2D.Double(evt.getX() - (size.width / 2), evt.getY() - (size.height / 2)); IdeaView hit = this.ideaMap.getRootView().getViewAt(p); if (hit != null) { this.ideaMap.setSelectedView(hit); } | public void mousePressed(MouseEvent evt) { } |
|
if(zoomIn) clickCount = 1; if(zoomOut) clickCount = 2; | if(zoomIn) { clickCount = 1; } if(zoomOut) { clickCount = 2; } | public ParticleMotionView (final LocalSeismogramImpl hseis, LocalSeismogramImpl vseis, TimeRangeConfig timeRangeConfig, final AmpRangeConfig hAmpRangeConfig, AmpRangeConfig vAmpRangeConfig, ParticleMotionDisplay particleMotionDisplay){ this.particleMotionDisplay = particleMotionDisplay; if(timeRangeConfig != null) { this.microSecondTimeRange = timeRangeConfig.getTimeRange(); } ParticleMotion particleMotion = new ParticleMotion(hseis, vseis, hAmpRangeConfig, vAmpRangeConfig); displays.add(particleMotion); vunitRangeImpl = vAmpRangeConfig.getAmpRange(vseis); hunitRangeImpl = hAmpRangeConfig.getAmpRange(hseis); this.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent me) { //UnitRangeImpl unitRangeImpl = hAmpRangeConfig.getAmpRange(hseis); //double min = unitRangeImpl.getMinValue(); //double max = unitRangeImpl.getMaxValue(); ///Insets insets = getInsets(); //double fmin = getSize().getWidth() - insets.left - insets.right; //double fmax = getSize().getHeight() - insets.top - insets.bottom; //int newx = (int)(((max - min) / fmin * me.getX()) - max); //(int)(max - (((max - min) * (fmin - me.getX()) )/ (fmax - me.getY()))); //int newy = (int)(((min - max) / fmax * me.getY()) + max); int clickCount = 0; if(zoomIn) clickCount = 1; if(zoomOut) clickCount = 2; zoomInParticleMotionDisplay(clickCount, me.getX(), me.getY()); //logger.debug("me x "+me.getX()+" me y "+me.getY()); //findPoint(me.getClickCount(), me.getX(), me.getY()); startPoint = null; endPoint = null; } public void mousePressed(MouseEvent me) { startPoint = new java.awt.geom.Point2D.Float((float)me.getX(), (float)me.getY()); } public void mouseReleased(MouseEvent me) { // endPoint = new java.awt.geom.Point2D.Float(me.getX(), me.getY()); // zoomInParticleMotionDisplay(me.getX(), me.getY()); } }); this.addMouseMotionListener(new MouseMotionAdapter() { public void mouseDragged(MouseEvent me) { endPoint = new java.awt.geom.Point2D.Float((float)me.getX(), (float)me.getY()); repaint(); } }); } |
if(zoomIn) clickCount = 1; if(zoomOut) clickCount = 2; | if(zoomIn) { clickCount = 1; } if(zoomOut) { clickCount = 2; } | public void mouseClicked(MouseEvent me) { //UnitRangeImpl unitRangeImpl = hAmpRangeConfig.getAmpRange(hseis); //double min = unitRangeImpl.getMinValue(); //double max = unitRangeImpl.getMaxValue(); ///Insets insets = getInsets(); //double fmin = getSize().getWidth() - insets.left - insets.right; //double fmax = getSize().getHeight() - insets.top - insets.bottom; //int newx = (int)(((max - min) / fmin * me.getX()) - max); //(int)(max - (((max - min) * (fmin - me.getX()) )/ (fmax - me.getY()))); //int newy = (int)(((min - max) / fmax * me.getY()) + max); int clickCount = 0; if(zoomIn) clickCount = 1; if(zoomOut) clickCount = 2; zoomInParticleMotionDisplay(clickCount, me.getX(), me.getY()); //logger.debug("me x "+me.getX()+" me y "+me.getY()); //findPoint(me.getClickCount(), me.getX(), me.getY()); startPoint = null; endPoint = null; } |
particleMotionDisplay.fireAmpRangeEvent(new AmpSyncEvent(ya, ys, true)); | public void zoomInParticleMotionDisplay(int clickCount, int mx, int my) { double hmin = hunitRangeImpl.getMinValue(); double hmax = hunitRangeImpl.getMaxValue(); double vmin = vunitRangeImpl.getMinValue(); double vmax = vunitRangeImpl.getMaxValue(); if(hmin > hmax) { double temp = hmax; hmax = hmin; hmin = temp;} if(vmin > vmax) { double temp = vmax; vmax = vmin; vmin = temp;} Insets insets = getInsets(); double width = getSize().getWidth() - insets.left - insets.right; double height = getSize().getHeight() - insets.top - insets.bottom; int centerx, centery; if(clickCount == 1) { centerx = (int)((hmax - hmin) / 4); centery = (int)((vmax - vmin) / 4); } else { centerx = (int)((hmax - hmin) / 4); centery = (int)((hmax - hmin) / 4); } int xone = (int)(((hmax - hmin)/width * mx) + hmin); int yone = (int)(((vmin - vmax)/height * my) + vmax); logger.debug("----------------------------------------------------------"); logger.debug("clickCount = "+clickCount); logger.debug(" hmin = "+hmin+" hmax = "+hmax); logger.debug(" vmin = "+vmin+" vmax = "+vmax); logger.debug(" xone = "+xone+" yone = "+yone); logger.debug(" bcenterx = "+centerx+" bcentery = "+centery); if(clickCount == 1) { if(xone < 0) centerx = -centerx; if(yone < 0) centery = -centery; } else { //if(hmin < 0 ) centerx = -centerx; // if(vmin < 0) centery = -centery; } int xa, xs, ya, ys; if(clickCount == 1) { xa = xone - centerx; xs = xone + centerx; ya = yone - centery; ys = yone + centery; } else { if(centerx < 0) centerx = -centerx; if(centery < 0) centery = -centery; xa = (int)hmin - centerx; xs = (int)hmax + centerx; ya = (int)vmin - centery; ys = (int)vmax + centery; if((xs - xa) < 50){ xs = xs + 50; xa = xa - 50;} if((ys - ya) < 50) { ys = ys + 50; ya = ya - 50;} } if(xa > xs) { int temp = xs; xs = xa; xa = temp;} if(ya > ys) {int temp = ys; ys = ya; ya = temp;} logger.debug(" acenterx = "+centerx+" acentery = "+centery); logger.debug(" xa = "+xa+" xs = "+xs); logger.debug(" ya = "+ya+" ys = "+ys); //int xtwo = (int)(((hmax - hmin)/width * endPoint.getX()) - hmax); //int ytwo = (int)(((vmin - vmax)/height * endPoint.getY()) + vmax); startPoint = null; endPoint = null; if(xa < xs && ya < ys || clickCount != 1) { particleMotionDisplay.updateHorizontalAmpScale(new UnitRangeImpl(xa, xs, UnitImpl.COUNT)); particleMotionDisplay.updateVerticalAmpScale(new UnitRangeImpl(ya, ys, UnitImpl.COUNT)); vunitRangeImpl = new UnitRangeImpl(ya, ys, UnitImpl.COUNT); hunitRangeImpl = new UnitRangeImpl(xa, xs, UnitImpl.COUNT); } } |
|
sb.append(", rights="); sb.append(getRights()); | public String toString() { StringBuffer sb = new StringBuffer("CalSvcIPars{"); sb.append("authUser="); sb.append(getAuthUser()); sb.append(", rights="); sb.append(getRights()); sb.append(", user="); sb.append(getUser()); sb.append(", publicAdmin="); sb.append(getPublicAdmin()); sb.append(", caldav="); sb.append(getCaldav()); sb.append(", synchid="); sb.append(getSynchId()); sb.append(", debug="); sb.append(getDebug()); sb.append("}"); return sb.toString(); } |
|
for (int i = 0; i < size; i++) { | for (int i = 0, j = 0; i < size; i++) { | public int indexOf(URL url) { int size = list.size(); for (int i = 0; i < size; i++) { ItemWrapper iw = (ItemWrapper)list.get(i); if (iw.isVisible() && iw.getURL().equals(url)) { return i; } } return -1; } |
if (iw.isVisible() && iw.getURL().equals(url)) { return i; | if (iw.isVisible()) { if (iw.getURL().equals(url)) { return j; } j++; | public int indexOf(URL url) { int size = list.size(); for (int i = 0; i < size; i++) { ItemWrapper iw = (ItemWrapper)list.get(i); if (iw.isVisible() && iw.getURL().equals(url)) { return i; } } return -1; } |
String label; | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g.create(); if (copy != null) { copy.translate(x,y); try { copy.setFont(DisplayUtils.BORDER_FONT); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); FontMetrics fm = copy.getFontMetrics(); String label; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.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)); label = topScaleMap.getLabel(i); if (label != null && label.length() != 0 ) { int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if(pixelLoc + labelWidth < width){ copy.drawString(label, pixelLoc - labelWidth/2, top - majorTickLength- fm.getLeading()); } } } copy.drawString(topScaleMap.getAxisLabel(), width/2, fontHeight); } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); if ( numTicks == 0 || numTicks ==1) { copy.drawString("No Data", fontHeight + 2, top + (height - top - bottom)/2- fm.getLeading()); } // end of if () for (int i=0; i<numTicks; i++) { 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)); } label = leftScaleMap.getLabel(i); if (label != null && label.length() != 0) { if(i == 0) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else if(i == numTicks - 1) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else copy.drawString(label, insets.left - insets.right - 45, pixelLoc); } } if(leftAxisLabelBounds == null){ leftAxisLabelBounds = copy.getFontMetrics().getStringBounds(leftScaleMap.getAxisLabel(), copy); } double yTranslate = height - (height - leftAxisLabelBounds.getWidth())/2; double xTranslate = leftAxisLabelBounds.getHeight(); copy.translate(xTranslate, yTranslate); copy.rotate(-Math.PI/2); copy.drawString(leftScaleMap.getAxisLabel(), 0, 0); copy.rotate(Math.PI/2); copy.translate(-xTranslate, -yTranslate); } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + bottomScaleMap.getPixelLocation(i); 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)); } label = bottomScaleMap.getLabel(i); int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if (label != null && label.length() != 0 && pixelLoc + labelWidth < width) { copy.drawString(label, pixelLoc - labelWidth/2, height-fm.getLeading()); } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = height - rightScaleMap.getPixelLocation(i) - bottom; copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); label = rightScaleMap.getLabel(i); if (label != null && label.length() != 0) { copy.drawString(label, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } } |
|
if(topScaleMap.isMajorTick(i)) | if(topScaleMap.isMajorTick(i)){ | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g.create(); if (copy != null) { copy.translate(x,y); try { copy.setFont(DisplayUtils.BORDER_FONT); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); FontMetrics fm = copy.getFontMetrics(); String label; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.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)); label = topScaleMap.getLabel(i); if (label != null && label.length() != 0 ) { int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if(pixelLoc + labelWidth < width){ copy.drawString(label, pixelLoc - labelWidth/2, top - majorTickLength- fm.getLeading()); } } } copy.drawString(topScaleMap.getAxisLabel(), width/2, fontHeight); } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); if ( numTicks == 0 || numTicks ==1) { copy.drawString("No Data", fontHeight + 2, top + (height - top - bottom)/2- fm.getLeading()); } // end of if () for (int i=0; i<numTicks; i++) { 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)); } label = leftScaleMap.getLabel(i); if (label != null && label.length() != 0) { if(i == 0) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else if(i == numTicks - 1) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else copy.drawString(label, insets.left - insets.right - 45, pixelLoc); } } if(leftAxisLabelBounds == null){ leftAxisLabelBounds = copy.getFontMetrics().getStringBounds(leftScaleMap.getAxisLabel(), copy); } double yTranslate = height - (height - leftAxisLabelBounds.getWidth())/2; double xTranslate = leftAxisLabelBounds.getHeight(); copy.translate(xTranslate, yTranslate); copy.rotate(-Math.PI/2); copy.drawString(leftScaleMap.getAxisLabel(), 0, 0); copy.rotate(Math.PI/2); copy.translate(-xTranslate, -yTranslate); } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + bottomScaleMap.getPixelLocation(i); 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)); } label = bottomScaleMap.getLabel(i); int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if (label != null && label.length() != 0 && pixelLoc + labelWidth < width) { copy.drawString(label, pixelLoc - labelWidth/2, height-fm.getLeading()); } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = height - rightScaleMap.getPixelLocation(i) - bottom; copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); label = rightScaleMap.getLabel(i); if (label != null && label.length() != 0) { copy.drawString(label, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } } |
else copy.draw(new Line2D.Float(pixelLoc, top, pixelLoc, top - minorTickLength)); label = topScaleMap.getLabel(i); if (label != null && label.length() != 0 ) { int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if(pixelLoc + labelWidth < width){ | String label = topScaleMap.getLabel(i); if (label != null && label.length() != 0 ) { int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g.create(); if (copy != null) { copy.translate(x,y); try { copy.setFont(DisplayUtils.BORDER_FONT); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); FontMetrics fm = copy.getFontMetrics(); String label; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.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)); label = topScaleMap.getLabel(i); if (label != null && label.length() != 0 ) { int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if(pixelLoc + labelWidth < width){ copy.drawString(label, pixelLoc - labelWidth/2, top - majorTickLength- fm.getLeading()); } } } copy.drawString(topScaleMap.getAxisLabel(), width/2, fontHeight); } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); if ( numTicks == 0 || numTicks ==1) { copy.drawString("No Data", fontHeight + 2, top + (height - top - bottom)/2- fm.getLeading()); } // end of if () for (int i=0; i<numTicks; i++) { 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)); } label = leftScaleMap.getLabel(i); if (label != null && label.length() != 0) { if(i == 0) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else if(i == numTicks - 1) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else copy.drawString(label, insets.left - insets.right - 45, pixelLoc); } } if(leftAxisLabelBounds == null){ leftAxisLabelBounds = copy.getFontMetrics().getStringBounds(leftScaleMap.getAxisLabel(), copy); } double yTranslate = height - (height - leftAxisLabelBounds.getWidth())/2; double xTranslate = leftAxisLabelBounds.getHeight(); copy.translate(xTranslate, yTranslate); copy.rotate(-Math.PI/2); copy.drawString(leftScaleMap.getAxisLabel(), 0, 0); copy.rotate(Math.PI/2); copy.translate(-xTranslate, -yTranslate); } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + bottomScaleMap.getPixelLocation(i); 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)); } label = bottomScaleMap.getLabel(i); int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if (label != null && label.length() != 0 && pixelLoc + labelWidth < width) { copy.drawString(label, pixelLoc - labelWidth/2, height-fm.getLeading()); } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = height - rightScaleMap.getPixelLocation(i) - bottom; copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); label = rightScaleMap.getLabel(i); if (label != null && label.length() != 0) { copy.drawString(label, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } } |
copy.draw(new Line2D.Float(insets.left -majorTickLength - insets.right, | copy.draw(new Line2D.Float(left, | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g.create(); if (copy != null) { copy.translate(x,y); try { copy.setFont(DisplayUtils.BORDER_FONT); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); FontMetrics fm = copy.getFontMetrics(); String label; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.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)); label = topScaleMap.getLabel(i); if (label != null && label.length() != 0 ) { int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if(pixelLoc + labelWidth < width){ copy.drawString(label, pixelLoc - labelWidth/2, top - majorTickLength- fm.getLeading()); } } } copy.drawString(topScaleMap.getAxisLabel(), width/2, fontHeight); } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); if ( numTicks == 0 || numTicks ==1) { copy.drawString("No Data", fontHeight + 2, top + (height - top - bottom)/2- fm.getLeading()); } // end of if () for (int i=0; i<numTicks; i++) { 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)); } label = leftScaleMap.getLabel(i); if (label != null && label.length() != 0) { if(i == 0) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else if(i == numTicks - 1) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else copy.drawString(label, insets.left - insets.right - 45, pixelLoc); } } if(leftAxisLabelBounds == null){ leftAxisLabelBounds = copy.getFontMetrics().getStringBounds(leftScaleMap.getAxisLabel(), copy); } double yTranslate = height - (height - leftAxisLabelBounds.getWidth())/2; double xTranslate = leftAxisLabelBounds.getHeight(); copy.translate(xTranslate, yTranslate); copy.rotate(-Math.PI/2); copy.drawString(leftScaleMap.getAxisLabel(), 0, 0); copy.rotate(Math.PI/2); copy.translate(-xTranslate, -yTranslate); } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + bottomScaleMap.getPixelLocation(i); 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)); } label = bottomScaleMap.getLabel(i); int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if (label != null && label.length() != 0 && pixelLoc + labelWidth < width) { copy.drawString(label, pixelLoc - labelWidth/2, height-fm.getLeading()); } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = height - rightScaleMap.getPixelLocation(i) - bottom; copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); label = rightScaleMap.getLabel(i); if (label != null && label.length() != 0) { copy.drawString(label, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } } |
insets.left - insets.right, | left - majorTickLength, | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g.create(); if (copy != null) { copy.translate(x,y); try { copy.setFont(DisplayUtils.BORDER_FONT); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); FontMetrics fm = copy.getFontMetrics(); String label; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.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)); label = topScaleMap.getLabel(i); if (label != null && label.length() != 0 ) { int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if(pixelLoc + labelWidth < width){ copy.drawString(label, pixelLoc - labelWidth/2, top - majorTickLength- fm.getLeading()); } } } copy.drawString(topScaleMap.getAxisLabel(), width/2, fontHeight); } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); if ( numTicks == 0 || numTicks ==1) { copy.drawString("No Data", fontHeight + 2, top + (height - top - bottom)/2- fm.getLeading()); } // end of if () for (int i=0; i<numTicks; i++) { 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)); } label = leftScaleMap.getLabel(i); if (label != null && label.length() != 0) { if(i == 0) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else if(i == numTicks - 1) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else copy.drawString(label, insets.left - insets.right - 45, pixelLoc); } } if(leftAxisLabelBounds == null){ leftAxisLabelBounds = copy.getFontMetrics().getStringBounds(leftScaleMap.getAxisLabel(), copy); } double yTranslate = height - (height - leftAxisLabelBounds.getWidth())/2; double xTranslate = leftAxisLabelBounds.getHeight(); copy.translate(xTranslate, yTranslate); copy.rotate(-Math.PI/2); copy.drawString(leftScaleMap.getAxisLabel(), 0, 0); copy.rotate(Math.PI/2); copy.translate(-xTranslate, -yTranslate); } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + bottomScaleMap.getPixelLocation(i); 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)); } label = bottomScaleMap.getLabel(i); int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if (label != null && label.length() != 0 && pixelLoc + labelWidth < width) { copy.drawString(label, pixelLoc - labelWidth/2, height-fm.getLeading()); } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = height - rightScaleMap.getPixelLocation(i) - bottom; copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); label = rightScaleMap.getLabel(i); if (label != null && label.length() != 0) { copy.drawString(label, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } } |
copy.draw(new Line2D.Float(insets.left - insets.right - minorTickLength, | copy.draw(new Line2D.Float(left - minorTickLength, | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g.create(); if (copy != null) { copy.translate(x,y); try { copy.setFont(DisplayUtils.BORDER_FONT); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); FontMetrics fm = copy.getFontMetrics(); String label; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.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)); label = topScaleMap.getLabel(i); if (label != null && label.length() != 0 ) { int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if(pixelLoc + labelWidth < width){ copy.drawString(label, pixelLoc - labelWidth/2, top - majorTickLength- fm.getLeading()); } } } copy.drawString(topScaleMap.getAxisLabel(), width/2, fontHeight); } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); if ( numTicks == 0 || numTicks ==1) { copy.drawString("No Data", fontHeight + 2, top + (height - top - bottom)/2- fm.getLeading()); } // end of if () for (int i=0; i<numTicks; i++) { 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)); } label = leftScaleMap.getLabel(i); if (label != null && label.length() != 0) { if(i == 0) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else if(i == numTicks - 1) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else copy.drawString(label, insets.left - insets.right - 45, pixelLoc); } } if(leftAxisLabelBounds == null){ leftAxisLabelBounds = copy.getFontMetrics().getStringBounds(leftScaleMap.getAxisLabel(), copy); } double yTranslate = height - (height - leftAxisLabelBounds.getWidth())/2; double xTranslate = leftAxisLabelBounds.getHeight(); copy.translate(xTranslate, yTranslate); copy.rotate(-Math.PI/2); copy.drawString(leftScaleMap.getAxisLabel(), 0, 0); copy.rotate(Math.PI/2); copy.translate(-xTranslate, -yTranslate); } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + bottomScaleMap.getPixelLocation(i); 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)); } label = bottomScaleMap.getLabel(i); int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if (label != null && label.length() != 0 && pixelLoc + labelWidth < width) { copy.drawString(label, pixelLoc - labelWidth/2, height-fm.getLeading()); } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = height - rightScaleMap.getPixelLocation(i) - bottom; copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); label = rightScaleMap.getLabel(i); if (label != null && label.length() != 0) { copy.drawString(label, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } } |
insets.left - insets.right, | left, | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g.create(); if (copy != null) { copy.translate(x,y); try { copy.setFont(DisplayUtils.BORDER_FONT); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); FontMetrics fm = copy.getFontMetrics(); String label; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.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)); label = topScaleMap.getLabel(i); if (label != null && label.length() != 0 ) { int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if(pixelLoc + labelWidth < width){ copy.drawString(label, pixelLoc - labelWidth/2, top - majorTickLength- fm.getLeading()); } } } copy.drawString(topScaleMap.getAxisLabel(), width/2, fontHeight); } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); if ( numTicks == 0 || numTicks ==1) { copy.drawString("No Data", fontHeight + 2, top + (height - top - bottom)/2- fm.getLeading()); } // end of if () for (int i=0; i<numTicks; i++) { 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)); } label = leftScaleMap.getLabel(i); if (label != null && label.length() != 0) { if(i == 0) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else if(i == numTicks - 1) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else copy.drawString(label, insets.left - insets.right - 45, pixelLoc); } } if(leftAxisLabelBounds == null){ leftAxisLabelBounds = copy.getFontMetrics().getStringBounds(leftScaleMap.getAxisLabel(), copy); } double yTranslate = height - (height - leftAxisLabelBounds.getWidth())/2; double xTranslate = leftAxisLabelBounds.getHeight(); copy.translate(xTranslate, yTranslate); copy.rotate(-Math.PI/2); copy.drawString(leftScaleMap.getAxisLabel(), 0, 0); copy.rotate(Math.PI/2); copy.translate(-xTranslate, -yTranslate); } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + bottomScaleMap.getPixelLocation(i); 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)); } label = bottomScaleMap.getLabel(i); int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if (label != null && label.length() != 0 && pixelLoc + labelWidth < width) { copy.drawString(label, pixelLoc - labelWidth/2, height-fm.getLeading()); } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = height - rightScaleMap.getPixelLocation(i) - bottom; copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); label = rightScaleMap.getLabel(i); if (label != null && label.length() != 0) { copy.drawString(label, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } } |
} label = leftScaleMap.getLabel(i); if (label != null && label.length() != 0) { if(i == 0) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else if(i == numTicks - 1) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else copy.drawString(label, 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.create(); if (copy != null) { copy.translate(x,y); try { copy.setFont(DisplayUtils.BORDER_FONT); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); FontMetrics fm = copy.getFontMetrics(); String label; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.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)); label = topScaleMap.getLabel(i); if (label != null && label.length() != 0 ) { int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if(pixelLoc + labelWidth < width){ copy.drawString(label, pixelLoc - labelWidth/2, top - majorTickLength- fm.getLeading()); } } } copy.drawString(topScaleMap.getAxisLabel(), width/2, fontHeight); } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); if ( numTicks == 0 || numTicks ==1) { copy.drawString("No Data", fontHeight + 2, top + (height - top - bottom)/2- fm.getLeading()); } // end of if () for (int i=0; i<numTicks; i++) { 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)); } label = leftScaleMap.getLabel(i); if (label != null && label.length() != 0) { if(i == 0) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else if(i == numTicks - 1) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else copy.drawString(label, insets.left - insets.right - 45, pixelLoc); } } if(leftAxisLabelBounds == null){ leftAxisLabelBounds = copy.getFontMetrics().getStringBounds(leftScaleMap.getAxisLabel(), copy); } double yTranslate = height - (height - leftAxisLabelBounds.getWidth())/2; double xTranslate = leftAxisLabelBounds.getHeight(); copy.translate(xTranslate, yTranslate); copy.rotate(-Math.PI/2); copy.drawString(leftScaleMap.getAxisLabel(), 0, 0); copy.rotate(Math.PI/2); copy.translate(-xTranslate, -yTranslate); } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + bottomScaleMap.getPixelLocation(i); 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)); } label = bottomScaleMap.getLabel(i); int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if (label != null && label.length() != 0 && pixelLoc + labelWidth < width) { copy.drawString(label, pixelLoc - labelWidth/2, height-fm.getLeading()); } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = height - rightScaleMap.getPixelLocation(i) - bottom; copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); label = rightScaleMap.getLabel(i); if (label != null && label.length() != 0) { copy.drawString(label, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } } |
|
double yTranslate = height - (height - leftAxisLabelBounds.getWidth())/2; | double yTranslate = height - bottom + top - (height - bottom + top - leftAxisLabelBounds.getWidth())/2; | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g.create(); if (copy != null) { copy.translate(x,y); try { copy.setFont(DisplayUtils.BORDER_FONT); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); FontMetrics fm = copy.getFontMetrics(); String label; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.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)); label = topScaleMap.getLabel(i); if (label != null && label.length() != 0 ) { int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if(pixelLoc + labelWidth < width){ copy.drawString(label, pixelLoc - labelWidth/2, top - majorTickLength- fm.getLeading()); } } } copy.drawString(topScaleMap.getAxisLabel(), width/2, fontHeight); } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); if ( numTicks == 0 || numTicks ==1) { copy.drawString("No Data", fontHeight + 2, top + (height - top - bottom)/2- fm.getLeading()); } // end of if () for (int i=0; i<numTicks; i++) { 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)); } label = leftScaleMap.getLabel(i); if (label != null && label.length() != 0) { if(i == 0) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else if(i == numTicks - 1) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else copy.drawString(label, insets.left - insets.right - 45, pixelLoc); } } if(leftAxisLabelBounds == null){ leftAxisLabelBounds = copy.getFontMetrics().getStringBounds(leftScaleMap.getAxisLabel(), copy); } double yTranslate = height - (height - leftAxisLabelBounds.getWidth())/2; double xTranslate = leftAxisLabelBounds.getHeight(); copy.translate(xTranslate, yTranslate); copy.rotate(-Math.PI/2); copy.drawString(leftScaleMap.getAxisLabel(), 0, 0); copy.rotate(Math.PI/2); copy.translate(-xTranslate, -yTranslate); } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + bottomScaleMap.getPixelLocation(i); 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)); } label = bottomScaleMap.getLabel(i); int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if (label != null && label.length() != 0 && pixelLoc + labelWidth < width) { copy.drawString(label, pixelLoc - labelWidth/2, height-fm.getLeading()); } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = height - rightScaleMap.getPixelLocation(i) - bottom; copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); label = rightScaleMap.getLabel(i); if (label != null && label.length() != 0) { copy.drawString(label, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } } |
label = bottomScaleMap.getLabel(i); int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if (label != null && label.length() != 0 && pixelLoc + labelWidth < width) { copy.drawString(label, pixelLoc - labelWidth/2, height-fm.getLeading()); } | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g.create(); if (copy != null) { copy.translate(x,y); try { copy.setFont(DisplayUtils.BORDER_FONT); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); FontMetrics fm = copy.getFontMetrics(); String label; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.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)); label = topScaleMap.getLabel(i); if (label != null && label.length() != 0 ) { int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if(pixelLoc + labelWidth < width){ copy.drawString(label, pixelLoc - labelWidth/2, top - majorTickLength- fm.getLeading()); } } } copy.drawString(topScaleMap.getAxisLabel(), width/2, fontHeight); } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); if ( numTicks == 0 || numTicks ==1) { copy.drawString("No Data", fontHeight + 2, top + (height - top - bottom)/2- fm.getLeading()); } // end of if () for (int i=0; i<numTicks; i++) { 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)); } label = leftScaleMap.getLabel(i); if (label != null && label.length() != 0) { if(i == 0) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else if(i == numTicks - 1) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else copy.drawString(label, insets.left - insets.right - 45, pixelLoc); } } if(leftAxisLabelBounds == null){ leftAxisLabelBounds = copy.getFontMetrics().getStringBounds(leftScaleMap.getAxisLabel(), copy); } double yTranslate = height - (height - leftAxisLabelBounds.getWidth())/2; double xTranslate = leftAxisLabelBounds.getHeight(); copy.translate(xTranslate, yTranslate); copy.rotate(-Math.PI/2); copy.drawString(leftScaleMap.getAxisLabel(), 0, 0); copy.rotate(Math.PI/2); copy.translate(-xTranslate, -yTranslate); } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + bottomScaleMap.getPixelLocation(i); 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)); } label = bottomScaleMap.getLabel(i); int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if (label != null && label.length() != 0 && pixelLoc + labelWidth < width) { copy.drawString(label, pixelLoc - labelWidth/2, height-fm.getLeading()); } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = height - rightScaleMap.getPixelLocation(i) - bottom; copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); label = rightScaleMap.getLabel(i); if (label != null && label.length() != 0) { copy.drawString(label, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } } |
|
label = rightScaleMap.getLabel(i); | String label = rightScaleMap.getLabel(i); | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g.create(); if (copy != null) { copy.translate(x,y); try { copy.setFont(DisplayUtils.BORDER_FONT); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); FontMetrics fm = copy.getFontMetrics(); String label; // top int numTicks; int pixelLoc; if (topScaleMap != null) { numTicks = topScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.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)); label = topScaleMap.getLabel(i); if (label != null && label.length() != 0 ) { int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if(pixelLoc + labelWidth < width){ copy.drawString(label, pixelLoc - labelWidth/2, top - majorTickLength- fm.getLeading()); } } } copy.drawString(topScaleMap.getAxisLabel(), width/2, fontHeight); } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); if ( numTicks == 0 || numTicks ==1) { copy.drawString("No Data", fontHeight + 2, top + (height - top - bottom)/2- fm.getLeading()); } // end of if () for (int i=0; i<numTicks; i++) { 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)); } label = leftScaleMap.getLabel(i); if (label != null && label.length() != 0) { if(i == 0) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else if(i == numTicks - 1) copy.drawString(label, insets.left - insets.right - 45, pixelLoc + 5); else copy.drawString(label, insets.left - insets.right - 45, pixelLoc); } } if(leftAxisLabelBounds == null){ leftAxisLabelBounds = copy.getFontMetrics().getStringBounds(leftScaleMap.getAxisLabel(), copy); } double yTranslate = height - (height - leftAxisLabelBounds.getWidth())/2; double xTranslate = leftAxisLabelBounds.getHeight(); copy.translate(xTranslate, yTranslate); copy.rotate(-Math.PI/2); copy.drawString(leftScaleMap.getAxisLabel(), 0, 0); copy.rotate(Math.PI/2); copy.translate(-xTranslate, -yTranslate); } // bottom if (bottomScaleMap != null) { numTicks = bottomScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = insets.left + bottomScaleMap.getPixelLocation(i); 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)); } label = bottomScaleMap.getLabel(i); int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if (label != null && label.length() != 0 && pixelLoc + labelWidth < width) { copy.drawString(label, pixelLoc - labelWidth/2, height-fm.getLeading()); } } } // right if (rightScaleMap != null) { numTicks = rightScaleMap.getNumTicks(); for (int i=0; i<numTicks; i++) { pixelLoc = height - rightScaleMap.getPixelLocation(i) - bottom; copy.draw(new Line2D.Float(pixelLoc, c.getSize().height-bottom, pixelLoc, c.getSize().height-bottom/2)); label = rightScaleMap.getLabel(i); if (label != null && label.length() != 0) { copy.drawString(label, pixelLoc, c.getSize().height-fm.getLeading()); } } } } finally { copy.dispose(); } } } |
bottom = 20; | if(scaleMap.getAxisLabel() != null && !scaleMap.getAxisLabel().equals("")){ bottom = 20 + getFontHeight(scaleMap.getAxisLabel()); }else{ bottom = 20; } | public void setBottomScaleMapper(ScaleMapper scaleMap) { this.bottomScaleMap = scaleMap; bottom = 20; } |
LineMetrics lm = DisplayUtils.BORDER_FONT.getLineMetrics(scaleMap.getAxisLabel(), new FontRenderContext(IDENTITY_AFFINE, false, false)); fontHeight = (int)lm.getAscent(); left = 50 + fontHeight; | left = 50 + getFontHeight(scaleMap.getAxisLabel()); | public void setLeftScaleMapper(ScaleMapper scaleMap) { this.leftScaleMap = scaleMap; if(scaleMap.getAxisLabel() != null && !scaleMap.getAxisLabel().equals("")){ LineMetrics lm = DisplayUtils.BORDER_FONT.getLineMetrics(scaleMap.getAxisLabel(), new FontRenderContext(IDENTITY_AFFINE, false, false)); fontHeight = (int)lm.getAscent(); left = 50 + fontHeight; }else{ left = 50; } } |
LineMetrics lm = DisplayUtils.BORDER_FONT.getLineMetrics(scaleMap.getAxisLabel(), new FontRenderContext(IDENTITY_AFFINE, false, false)); fontHeight = (int)lm.getAscent(); top = 20 + fontHeight; | top = 20 + getFontHeight(scaleMap.getAxisLabel()); | public void setTopScaleMapper(ScaleMapper scaleMap) { this.topScaleMap = scaleMap; if(scaleMap.getAxisLabel() != null && !scaleMap.getAxisLabel().equals("")){ LineMetrics lm = DisplayUtils.BORDER_FONT.getLineMetrics(scaleMap.getAxisLabel(), new FontRenderContext(IDENTITY_AFFINE, false, false)); fontHeight = (int)lm.getAscent(); top = 20 + fontHeight; }else{ top = 20; } } |
BwUser user, int currentMode, boolean ignoreCreator, | int currentMode, boolean ignoreCreator, | public CalintfHelper(Calintf cal, AccessUtil access, BwUser user, int currentMode, boolean ignoreCreator, boolean debug) { this.cal = cal; this.access = access; this.user = user; this.currentMode = currentMode; this.ignoreCreator = ignoreCreator; this.debug = debug; } |
this.user = user; | public CalintfHelper(Calintf cal, AccessUtil access, BwUser user, int currentMode, boolean ignoreCreator, boolean debug) { this.cal = cal; this.access = access; this.user = user; this.currentMode = currentMode; this.ignoreCreator = ignoreCreator; this.debug = debug; } |
|
throws SQLException { | throws SQLException, IOException { int channel_id = chanTable.put(channelId); int begin_time_id = timeTable.put(seis.getBeginTime().getFissuresTime()); int end_time_id = timeTable.put(seis.getEndTime().getFissuresTime()); | public void saveSeismogramToDatabase(ChannelId channelId, LocalSeismogramImpl seis, String fileLocation, SeismogramFileTypes filetype) throws SQLException { // Get absolute file path out of the file path given File seismogramFile = new File(fileLocation); String absoluteFilePath = seismogramFile.getPath(); insert.setInt(1, chanTable.put(channelId)); insert.setInt(2, timeTable.put(seis.getBeginTime().getFissuresTime())); insert.setInt(3, timeTable.put(seis.getEndTime().getFissuresTime())); insert.setString(4, absoluteFilePath); insert.setInt(5, filetype.getIntValue()); insert.executeUpdate(); } |
String absoluteFilePath = seismogramFile.getPath(); insert.setInt(1, chanTable.put(channelId)); insert.setInt(2, timeTable.put(seis.getBeginTime().getFissuresTime())); insert.setInt(3, timeTable.put(seis.getEndTime().getFissuresTime())); insert.setString(4, absoluteFilePath); insert.setInt(5, filetype.getIntValue()); insert.executeUpdate(); | String absoluteFilePath = seismogramFile.getCanonicalPath(); int fileTypeInt = filetype.getIntValue(); selectSeismogram.setInt(1, channel_id); selectSeismogram.setString(2, absoluteFilePath); ResultSet results = selectSeismogram.executeQuery(); if(results.next()) { } else { insert.setInt(1, channel_id); insert.setInt(2, begin_time_id); insert.setInt(3, end_time_id); insert.setString(4, absoluteFilePath); insert.setInt(5, fileTypeInt); insert.executeUpdate(); } | public void saveSeismogramToDatabase(ChannelId channelId, LocalSeismogramImpl seis, String fileLocation, SeismogramFileTypes filetype) throws SQLException { // Get absolute file path out of the file path given File seismogramFile = new File(fileLocation); String absoluteFilePath = seismogramFile.getPath(); insert.setInt(1, chanTable.put(channelId)); insert.setInt(2, timeTable.put(seis.getBeginTime().getFissuresTime())); insert.setInt(3, timeTable.put(seis.getEndTime().getFissuresTime())); insert.setString(4, absoluteFilePath); insert.setInt(5, filetype.getIntValue()); insert.executeUpdate(); } |
public RT130ToLocalSeismogram() { this.ncFile = null; this.stationLocations = null; } | public RT130ToLocalSeismogram() {} | public RT130ToLocalSeismogram() { this.ncFile = null; this.stationLocations = null; } |
Iterator e = ampData.keySet().iterator(); while(e.hasNext()){ ((AmpConfigData)e.next()).reset(); } fireAmpEvent(); | reset(getSeismograms()); | public void reset(){ Iterator e = ampData.keySet().iterator(); while(e.hasNext()){ ((AmpConfigData)e.next()).reset(); } fireAmpEvent(); } |
player.stop(); | player.close(); player = null; | public synchronized void stop() { if (player != null) { player.stop(); } } |
int addedyear = todaycalendar.get(Calendar.YEAR); String[] yearst = new String[numberofyears]; for(int i=0; i<numberofyears ; i++) { yearst[i]= ""+addedyear; addedyear--; } yearbox.setModel(new DefaultComboBoxModel(yearst)); | public void setNumberOfYears(int totalyears){ numberofyears = totalyears; } |
|
if (newSelection == null || newSelection.length() == 0) { return; } | private void yearOption(){ int todayyear = todaycalendar.get(Calendar.YEAR); //String[] yearst = {"2001","2000","1999","1998"}; int addedyear=2000; if(pastyears == true) { addedyear=todayyear; } String[] yearst = new String[numberofyears]; for(int i=0; i<numberofyears ; i++) { if(pastyears == true) { yearst[i]= String.valueOf(addedyear); addedyear-=1; } } year = todaycalendar.get(Calendar.YEAR); yearbox= new JComboBox(yearst); yearbox.setSelectedIndex(0); yearbox.setAlignmentX(Component.LEFT_ALIGNMENT); yearbox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource(); String newSelection = (String)cb.getSelectedItem(); year= Integer.parseInt(newSelection); calendar.set(Calendar.YEAR, year); dateChanged(); } }); gbc.gridx = ++x_leftcorner; gbc.gridy = y_leftcorner; subPane.add(new JLabel("Year"), gbc); //gbc.gridx++; gbc.gridy++; subPane.add(yearbox, gbc); return; } |
|
if (newSelection == null || newSelection.length() == 0) { return; } | public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource(); String newSelection = (String)cb.getSelectedItem(); year= Integer.parseInt(newSelection); calendar.set(Calendar.YEAR, year); dateChanged(); } |
|
form.initFields(); | initFields(form); | public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getAuthorisedUser()) { return "noAccess"; } /** Set the objects to null so we get new ones. */ form.initFields(); form.assignAddingLocation(true); return "continue"; } |
BwCalendar cal = (BwCalendar)subroot.clone(); | BwCalendar cal = (BwCalendar)subroot.shallowClone(); | private BwCalendar cloneAndCheckOne(BwCalendar subroot, int desiredAccess, boolean nullForNoAccess) throws CalFacadeException { CurrentAccess ca = access.checkAccess(subroot, desiredAccess, nullForNoAccess); if (!ca.accessAllowed) { return null; } BwCalendar cal = (BwCalendar)subroot.clone(); // XXX Temp fix - add id to the clone cal.setId(subroot.getId()); cal.setCurrentAccess(ca); Iterator it = subroot.iterateChildren(); while (it.hasNext()) { BwCalendar child = (BwCalendar)it.next(); child = cloneAndCheckOne(child, desiredAccess, nullForNoAccess); if (child != null) { cal.addChild(child); } } return cal; } |
if(time.before(anotherTime){ | if(time.before(anotherTime)){ | public MicroSecondTimeRange(MicroSecondDate time, MicroSecondDate anotherTime){ if(time.before(anotherTime){ this.beginTime = time; this.endTime = anotherTime; }else{ |
this.beginTime = anotherTime; this.endTime = time; } this.interval = new TimeInterval(beginTime, endTime); } | public MicroSecondTimeRange(MicroSecondDate time, MicroSecondDate anotherTime){ if(time.before(anotherTime){ this.beginTime = time; this.endTime = anotherTime; }else{ |
|
CalSvcIPars pars = new CalSvcIPars(user, access, user, publicEvents, | CalSvcIPars pars = new CalSvcIPars(user, access, user, envPrefix, publicEvents, | public CalSvcTestWrapper(String user, int access, boolean publicEvents, boolean debug) throws Throwable { super(); //this.debug = debug; isPublic = publicEvents; this.user = user; CalSvcIPars pars = new CalSvcIPars(user, access, user, publicEvents, false, // caldav null, // synch debug); init(pars); } |
val.setCalendar((BwCalendar)getCalendar().clone()); | val.setCalendar((BwCalendar)getCalendar().shallowClone()); | public void copyTo(BwShareableContainedDbentity val) { super.copyTo(val); val.setCalendar((BwCalendar)getCalendar().clone()); } |
if (columnsWidth > DynamicReportDesign.PAGE_WIDTH_WITHOUT_MARGINS_PORTRAIT_A4) { designTemplate.setOrientationLandscape(); int landscapeWidth = (columnsWidth > DynamicReportDesign.PAGE_WIDTH_WITHOUT_MARGINS_LANDSCAPE_A4) ? columnsWidth + DynamicReportDesign.PAGE_LEFT_MARGIN + DynamicReportDesign.PAGE_RIGHT_MARGIN : DynamicReportDesign.PAGE_WIDTH_LANDSCAPE_A4; designTemplate.setPageWidth(landscapeWidth); designTemplate.setPageHeight(DynamicReportDesign.PAGE_HEIGHT_LANDSCAPE_A4); } | private void generateLayoutAndAddParameters(IWContext iwc, boolean isMethodInvocation) throws IOException, JRException { int columnWidth = 120; int prmLableWidth = 95; int prmValueWidth = 55; DynamicReportDesign designTemplate = new DynamicReportDesign("GeneratedReport"); if (_dynamicFields != null && _dynamicFields.size() > 0) { if (_queryPK != null) { Iterator iter = _dynamicFields.iterator(); while (iter.hasNext()) { ReportableField element = (ReportableField) iter.next(); String prmName = element.getName(); String tmpPrmLabel = (String) _parameterMap.get(_prmLablePrefix + prmName); String tmpPrmValue = (String) _parameterMap.get(prmName); int tmpPrmLabelWidth = (tmpPrmLabel != null) ? calculateTextFieldWidthForString(tmpPrmLabel) : prmLableWidth; int tmpPrmValueWidth = (tmpPrmValue != null) ? calculateTextFieldWidthForString(tmpPrmValue) : prmValueWidth; designTemplate.addHeaderParameter(_prmLablePrefix + prmName, tmpPrmLabelWidth, prmName, String.class, tmpPrmValueWidth); } } else { Iterator iter = _dynamicFields.iterator(); while (iter.hasNext()) { ClassDescription element = (ClassDescription) iter.next(); String prmName = element.getName(); String tmpPrmLabel = (String) _parameterMap.get(_prmLablePrefix + prmName); String tmpPrmValue = (String) _parameterMap.get(prmName); int tmpPrmLabelWidth = (tmpPrmLabel != null) ? calculateTextFieldWidthForString(tmpPrmLabel) : prmLableWidth; int tmpPrmValueWidth = (tmpPrmValue != null) ? calculateTextFieldWidthForString(tmpPrmValue) : prmValueWidth; designTemplate.addHeaderParameter(_prmLablePrefix + prmName, tmpPrmLabelWidth, prmName, String.class, tmpPrmValueWidth); } } } if (_extraHeaderParameters != null) { Iterator keyIter = _extraHeaderParameters.keySet().iterator(); Iterator valueIter = _extraHeaderParameters.values().iterator(); while (keyIter.hasNext()) { String keyLabel = (String) keyIter.next(); String valueLabel = (String) valueIter.next(); if (keyIter.hasNext()) { String keyValue = (String) keyIter.next(); String valueValue = (String) valueIter.next(); String tmpPrmLabel = valueLabel; String tmpPrmValue = valueValue; int tmpPrmLabelWidth = (tmpPrmLabel != null) ? calculateTextFieldWidthForString(tmpPrmLabel) : prmLableWidth; int tmpPrmValueWidth = (tmpPrmValue != null) ? calculateTextFieldWidthForString(tmpPrmValue) : prmValueWidth; designTemplate.addHeaderParameter(keyLabel, tmpPrmLabelWidth, keyValue, String.class, tmpPrmValueWidth); } } } if (_allFields != null && _allFields.size() > 0) { //System.out.println("ReportGenerator."); //TMP //TODO get columnspacing (15) and it to columnsWidth; int columnsWidth = columnWidth * _allFields.size() + 15 * (_allFields.size() - 1); //TMP //TODO get page Margins (20) and add them to pageWidth; // do not change the width of the page!! prior: designTemplate.setPageWidth(columnsWidth + 20 + 20); designTemplate.setColumnWidth(columnsWidth); // Locale currentLocale = iwc.getCurrentLocale(); Iterator iter = _allFields.iterator(); if (isMethodInvocation) { while (iter.hasNext()) { ReportableField field = (ReportableField) iter.next(); String name = field.getName(); _parameterMap.put(name, field.getLocalizedName(currentLocale)); designTemplate.addField(name, field.getValueClass(), columnWidth); } } else { while (iter.hasNext()) { try { QueryFieldPart element = (QueryFieldPart) iter.next(); ReportableField field = new ReportableField(element.getIDOEntityField()); String name = field.getName(); _parameterMap.put(name, field.getLocalizedName(currentLocale)); designTemplate.addField(name, field.getValueClass(), columnWidth); } catch (IDOLookupException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } } designTemplate.close(); _design = designTemplate.getJasperDesign(iwc); } |
|
public static IslamicChronology getInstance(DateTimeZone zone) { return getInstance(zone, LEAP_YEAR_16_BASED); | public static IslamicChronology getInstance() { return getInstance(DateTimeZone.getDefault(), LEAP_YEAR_16_BASED); | public static IslamicChronology getInstance(DateTimeZone zone) { return getInstance(zone, LEAP_YEAR_16_BASED); } |
Collection c = new Vector(); | Collection c = new ArrayList(); | private String tryCal(HttpServletRequest request, BwActionFormBase form) throws Throwable { CalSvcI svci = form.fetchSvci(); String url = getReqPar(request, "calUrl"); if (url == null) { return null; } BwCalendar cal = findCalendar(url, form); if (cal == null) { form.getErr().emit("org.bedework.client.error.unknowncalendar"); return "notFound"; } BwSubscription sub = BwSubscription.makeSubscription(cal); Collection c = new Vector(); c.add(sub); svci.setCurrentSubscriptions(c); form.assignCurrentSubscriptions(c); form.setSelectionType(BedeworkDefs.selectionTypeCalendar); form.refreshIsNeeded(); return "success"; } |
Collection c = new Vector(); | Collection c = new ArrayList(); | private String trySub(HttpServletRequest request, BwActionFormBase form) throws Throwable { CalSvcI svci = form.fetchSvci(); String name = getReqPar(request, "subname"); if (name == null) { return null; } BwSubscription sub = svci.findSubscription(name); if (sub == null) { form.getErr().emit("org.bedework.client.error.unknownsubscription"); return "notFound"; } Collection c = new Vector(); c.add(sub.clone()); svci.setCurrentSubscriptions(c); form.assignCurrentSubscriptions(c); form.setSelectionType(BedeworkDefs.selectionTypeSubscription); form.refreshIsNeeded(); return "success"; } |
xvalue = 0; for(i = 0, j = 0; i < uncomp[0].length; i++) { | if(uncomp[0].length != 0) xvalue = umcomp[0][0];; for(i = 1, j = 0; i < uncomp[0].length; i++) { | protected static int[][] compressYvalues(LocalSeismogram seismogram, TimePlotConfig config, Dimension size)throws UnsupportedDataEncoding { int[][] uncomp = scaleXvalues(seismogram, config, size); // enough points to take the extra time to compress the line int[][] comp = new int[2][]; int pixels = size.width; int numValuesperPixel = uncomp[0].length/size.width; comp[0] = new int[2*pixels]; comp[1] = new int[2*pixels]; int j=0, i, startIndex, endIndex; int xvalue; startIndex = 0; xvalue = 0; for(i = 0, j = 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]; } } return comp; } |
comp[0][j] = uncomp[0][i]; comp[0][j+1] = uncomp[0][i]; | comp[0][j] = uncomp[0][endIndex]; comp[0][j+1] = uncomp[0][endIndex]; | protected static int[][] compressYvalues(LocalSeismogram seismogram, TimePlotConfig config, Dimension size)throws UnsupportedDataEncoding { int[][] uncomp = scaleXvalues(seismogram, config, size); // enough points to take the extra time to compress the line int[][] comp = new int[2][]; int pixels = size.width; int numValuesperPixel = uncomp[0].length/size.width; comp[0] = new int[2*pixels]; comp[1] = new int[2*pixels]; int j=0, i, startIndex, endIndex; int xvalue; startIndex = 0; xvalue = 0; for(i = 0, j = 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]; } } return comp; } |
form.getMsg().emit("org.bedework.message.cancelled"); | form.getMsg().emit("org.bedework.client.message.cancelled"); | public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase frm) throws Throwable { PEActionForm form = (PEActionForm)frm; /* CalEnv env = getEnv(frm); / * Set some options from the environment * / form.setAutoCreateSponsors(env.getAppBoolProperty("app.autocreatesponsors")); form.setAutoCreateLocations(env.getAppBoolProperty("app.autocreatelocations")); form.setAutoDeleteSponsors(env.getAppBoolProperty("app.autodeletesponsors")); form.setAutoDeleteLocations(env.getAppBoolProperty("app.autodeletelocations")); if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } / ** Show the owner we are administering * / form.setAdminUserId(form.getCalSvcI().getUser().getAccount()); if (debug) { logIt("-------- isSuperUser: " + form.getUserAuth().isSuperUser()); } if (!form.getAuthorisedUser()) { return "noAccess"; } String temp = checkGroup(request, form, true); if (temp != null) { if (debug) { logIt("form.getGroupSet()=" + form.getGroupSet()); } return temp; } / ** Ensure we have prefs and other values for the AuthUser * / setAuthUser(form); String reqpar = request.getParameter("cancelled"); if (reqpar != null) { / ** Set the objects to null so we get new ones. * / form.initFields(); form.setEvent(null); form.getMsg().emit("org.bedework.message.cancelled"); return "cancelled"; } */ return doAction(request, sess, form); } |
logger.debug("Loading next mseed file: "+files[currentIndex].getName()); | public DataRecord getNextRecord() throws SeedFormatException, IOException { if (current == null) { throw new EOFException("Cannot read past end of file list"); } try { DataRecord d = current.getNextRecord(); numReadTotal++; return d; } catch (EOFException e) { // try next file logger.debug("Loading next mseed file: "+files[currentIndex].getName()); initNextFile(); DataRecord d = current.getNextRecord(); numReadTotal++; return d; } } |
|
logger.debug("Last load"); | protected void initNextFile() throws IOException { if (currentIndex < files.length) { if (current != null) { current.close(); current = null; } current = new MiniSeedRead(new DataInputStream(new BufferedInputStream(new FileInputStream(files[currentIndex])))); currentIndex++; } } |
|
semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.profile.edit.parts.Stereotype2EditPart.VISUAL_ID); | semanticHint = UMLVisualIDRegistry.getType(Stereotype2EditPart.VISUAL_ID); | protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) { if (semanticHint == null) { semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.profile.edit.parts.Stereotype2EditPart.VISUAL_ID); view.setType(semanticHint); } super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); if (!ProfileEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) { EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ shortcutAnnotation.getDetails().put("modelID", ProfileEditPart.MODEL_ID); //$NON-NLS-1$ view.getEAnnotations().add(shortcutAnnotation); } } |
Class dispTimeConfigClass = parent.getTimeConfig().getClass(); if(parent.getTimeConfig() instanceof RTTimeRangeConfig){ dispTimeConfigClass = ((RTTimeRangeConfig)parent.getTimeConfig()).getInternalConfig().getClass(); | TimeConfig parentConfig = parent.getTimeConfig(); if(parentConfig instanceof RTTimeRangeConfig){ parentConfig = ((RTTimeRangeConfig)parentConfig).getInternalConfig(); | public Selection (MicroSecondTimeRange range, SeismogramDisplay parent, Color color){ // tc needs to be the same class as the parents time config incase it is a relative time config Class dispTimeConfigClass = parent.getTimeConfig().getClass(); if(parent.getTimeConfig() instanceof RTTimeRangeConfig){ dispTimeConfigClass = ((RTTimeRangeConfig)parent.getTimeConfig()).getInternalConfig().getClass(); } try { tc = (TimeConfig)dispTimeConfigClass.newInstance(); } catch (IllegalAccessException e) { GlobalExceptionHandler.handleStatic("Problem trying to create new TimeCongig for pick zone", e); } catch (InstantiationException e) { GlobalExceptionHandler.handleStatic("Problem trying to create new TimeCongig for pick zone", e); } seismos = parent.getSeismograms(); this.parent = parent; this.color = color; tc.addListener(this); tc.add(seismos); setBegin(range.getBeginTime()); setInterval(range.getInterval()); parent.repaint(); } |
if(parentConfig instanceof PhaseAlignedTimeConfig){ ((PhaseAlignedTimeConfig)tc).setTauP(((PhaseAlignedTimeConfig)parentConfig).getTauP()); } | public Selection (MicroSecondTimeRange range, SeismogramDisplay parent, Color color){ // tc needs to be the same class as the parents time config incase it is a relative time config Class dispTimeConfigClass = parent.getTimeConfig().getClass(); if(parent.getTimeConfig() instanceof RTTimeRangeConfig){ dispTimeConfigClass = ((RTTimeRangeConfig)parent.getTimeConfig()).getInternalConfig().getClass(); } try { tc = (TimeConfig)dispTimeConfigClass.newInstance(); } catch (IllegalAccessException e) { GlobalExceptionHandler.handleStatic("Problem trying to create new TimeCongig for pick zone", e); } catch (InstantiationException e) { GlobalExceptionHandler.handleStatic("Problem trying to create new TimeCongig for pick zone", e); } seismos = parent.getSeismograms(); this.parent = parent; this.color = color; tc.addListener(this); tc.add(seismos); setBegin(range.getBeginTime()); setInterval(range.getInterval()); parent.repaint(); } |
|
form.getErr().emit("org.bedework.pubevents.error.nosuchevent", id); | form.getErr().emit("org.bedework.client.error.nosuchevent", id); | public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { CalSvcI svci = form.getCalSvcI(); boolean alerts = form.getAlertEvent(); /** Check access and set request parameters */ if (alerts) { if (!form.getUserAuth().isAlertUser()) { return "noAccess"; } } else { if (!form.getAuthorisedUser()) { return "noAccess"; } } form.assignAddingEvent(false); /** User requested an event from the list. Retrieve it, embed it in * the form so we can display the page */ int id = form.getEventId(); if (id <= 0) { return "notFound"; } EventInfo einf = svci.getEvent(id); if (debug) { if (einf == null) { log.debug("No event with id " + id); } else { log.debug("Retrieved event " + einf.getEvent().getId()); log.debug(" start=" + einf.getEvent().getDtstart()); } } /** ************************************ We should ensure the alert status is correct ********************************* */ form.setEventInfo(einf); if (einf == null) { form.getErr().emit("org.bedework.pubevents.error.nosuchevent", id); return "notFound"; } return "continue"; } |
((CacheEvent)o).getEventAccess() != null) { return getEventAccess().equals(((CacheEvent)o).getEventAccess()); | ((CacheEvent)o).getEventAccess() != null && getEventAccess().equals(((CacheEvent)o).getEventAccess())) { return true; | public boolean equals(Object o){ if(o == this){ return true; } else if (getEventAccess() != null && o instanceof CacheEvent && ((CacheEvent)o).getEventAccess() != null) { return getEventAccess().equals(((CacheEvent)o).getEventAccess()); }else if(o instanceof EventAccessOperations){ EventAccessOperations oEvent = (EventAccessOperations)o; if(get_attributes().equals(oEvent.get_attributes())){ Origin thisOrigin = getOrigin(); if(thisOrigin == null && thisOrigin == extractOrigin(oEvent)){ return true; }else if(thisOrigin.equals(extractOrigin(oEvent))){ return true; } } } return false; } |
public Collection getFreeBusy(InputStreamReader in) throws Throwable { | public Collection getFreeBusy(Reader in) throws Throwable { | public Collection getFreeBusy(InputStreamReader in) throws Throwable { return trans.fromIcal(null, in); } |
public void decode(char[] val) throws AccessException { TreeSet ts = new TreeSet(); setEncoded(val); if (empty()) { defaultAccess(); } else { while (hasMore()) { Ace ace = new Ace(); ace.decode(this, true); ts.add(ace); } aces = ts; } | public void decode(String val) throws AccessException { decode(val.toCharArray()); | public void decode(char[] val) throws AccessException { TreeSet ts = new TreeSet(); setEncoded(val); if (empty()) { defaultAccess(); } else { while (hasMore()) { Ace ace = new Ace(); ace.decode(this, true); ts.add(ace); } aces = ts; } } |
form.getErr().emit("org.bedework.error.noaccess", "for that action"); | form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { // Just ignore this return "doNothing"; } String reqpar = request.getParameter("updateLocation"); if (reqpar != null) { return updateLocation(request, form); } int locationId = form.getLocationId(); if (locationId <= 0) { // Do nothing return "doNothing"; } BwLocation loc = form.getCalSvcI().getLocation(locationId); if (loc == null) { return "doNothing"; } if (loc.getPublick()) { form.getErr().emit("org.bedework.error.noaccess", "for that action"); return "doNothing"; } form.setEditLocation(loc); return "edit"; } |
if(seisIndex[0] == seisIndex[1]) { | if(seisIndex[1] < 0 || seisIndex[0] >= seis.getNumPoints()) { | private boolean setAmpRange(DataSetSeismogram seismo){ AmpConfigData data = (AmpConfigData)ampData.get(seismo); LocalSeismogramImpl seis = (LocalSeismogramImpl)seismo.getSeismogram(); int[] seisIndex = DisplayUtils.getSeisPoints(seis, data.getTime()); if(seisIndex[0] == seisIndex[1]) { //no data points in window, set range to 0 data.setCalcIndex(seisIndex); return data.setCleanRange(DisplayUtils.ZERO_RANGE); } if(seisIndex[0] < 0){ seisIndex[0] = 0; } if(seisIndex[1] >= seis.getNumPoints()){ seisIndex[1] = seis.getNumPoints() -1; } double[] minMaxMean = ((Statistics)DisplayUtils.statCache.get(seismo)).minMaxMean(seisIndex[0], seisIndex[1]); double meanDiff = (Math.abs(minMaxMean[2] - minMaxMean[0]) > Math.abs(minMaxMean[2] - minMaxMean[1]) ? Math.abs(minMaxMean[2] - minMaxMean[0]) : Math.abs(minMaxMean[2] - minMaxMean[1])); data.setCalcIndex(seisIndex); return data.setCleanRange(new UnitRangeImpl(minMaxMean[2] - meanDiff, minMaxMean[2] + meanDiff, UnitImpl.COUNT)); } |
double[] minMaxMean = ((Statistics)DisplayUtils.statCache.get(seismo)).minMaxMean(seisIndex[0], seisIndex[1]); double meanDiff = (Math.abs(minMaxMean[2] - minMaxMean[0]) > Math.abs(minMaxMean[2] - minMaxMean[1]) ? Math.abs(minMaxMean[2] - minMaxMean[0]) : Math.abs(minMaxMean[2] - minMaxMean[1])); | double[] minMaxMean = ((Statistics)DisplayUtils.statCache.get(seismo)).minMaxMean(seisIndex[0], seisIndex[1]); double meanDiff; double maxToMeanDiff = Math.abs(minMaxMean[2] - minMaxMean[1]); double minToMeanDiff = Math.abs(minMaxMean[2] - minMaxMean[0]); if(maxToMeanDiff > minToMeanDiff){ meanDiff = maxToMeanDiff; }else{ meanDiff = minToMeanDiff; } | private boolean setAmpRange(DataSetSeismogram seismo){ AmpConfigData data = (AmpConfigData)ampData.get(seismo); LocalSeismogramImpl seis = (LocalSeismogramImpl)seismo.getSeismogram(); int[] seisIndex = DisplayUtils.getSeisPoints(seis, data.getTime()); if(seisIndex[0] == seisIndex[1]) { //no data points in window, set range to 0 data.setCalcIndex(seisIndex); return data.setCleanRange(DisplayUtils.ZERO_RANGE); } if(seisIndex[0] < 0){ seisIndex[0] = 0; } if(seisIndex[1] >= seis.getNumPoints()){ seisIndex[1] = seis.getNumPoints() -1; } double[] minMaxMean = ((Statistics)DisplayUtils.statCache.get(seismo)).minMaxMean(seisIndex[0], seisIndex[1]); double meanDiff = (Math.abs(minMaxMean[2] - minMaxMean[0]) > Math.abs(minMaxMean[2] - minMaxMean[1]) ? Math.abs(minMaxMean[2] - minMaxMean[0]) : Math.abs(minMaxMean[2] - minMaxMean[1])); data.setCalcIndex(seisIndex); return data.setCleanRange(new UnitRangeImpl(minMaxMean[2] - meanDiff, minMaxMean[2] + meanDiff, UnitImpl.COUNT)); } |
return data.setCleanRange(new UnitRangeImpl(minMaxMean[2] - meanDiff, minMaxMean[2] + meanDiff, UnitImpl.COUNT)); | double min = minMaxMean[2] - meanDiff; double max = minMaxMean[2] + meanDiff; System.out.println(seismo + " amp range: " + min + ", " + max + " Points: " + seisIndex[0] + ", " + seisIndex[1]); return data.setCleanRange(new UnitRangeImpl(min, max, UnitImpl.COUNT)); | private boolean setAmpRange(DataSetSeismogram seismo){ AmpConfigData data = (AmpConfigData)ampData.get(seismo); LocalSeismogramImpl seis = (LocalSeismogramImpl)seismo.getSeismogram(); int[] seisIndex = DisplayUtils.getSeisPoints(seis, data.getTime()); if(seisIndex[0] == seisIndex[1]) { //no data points in window, set range to 0 data.setCalcIndex(seisIndex); return data.setCleanRange(DisplayUtils.ZERO_RANGE); } if(seisIndex[0] < 0){ seisIndex[0] = 0; } if(seisIndex[1] >= seis.getNumPoints()){ seisIndex[1] = seis.getNumPoints() -1; } double[] minMaxMean = ((Statistics)DisplayUtils.statCache.get(seismo)).minMaxMean(seisIndex[0], seisIndex[1]); double meanDiff = (Math.abs(minMaxMean[2] - minMaxMean[0]) > Math.abs(minMaxMean[2] - minMaxMean[1]) ? Math.abs(minMaxMean[2] - minMaxMean[0]) : Math.abs(minMaxMean[2] - minMaxMean[1])); data.setCalcIndex(seisIndex); return data.setCleanRange(new UnitRangeImpl(minMaxMean[2] - meanDiff, minMaxMean[2] + meanDiff, UnitImpl.COUNT)); } |
ATObject result = base_getFieldValue(); | ATObject result = base_getValue(); | public ATObject base_setValue(ATObject newValue) throws NATException { ATObject result = base_getFieldValue(); frame_.meta_assignField(name_, newValue); return result; } |
String showClass=(String) getSessionObject(request, UMLBrowserFormConstants.CLASS_VIEW); | Object classView = getSessionObject(request, UMLBrowserFormConstants.CLASS_VIEW); String showClass = null; if (classView != null) showClass=classView.toString(); | public ActionForward resetSubProjPkgOptions( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { DynaActionForm dynaForm = (DynaActionForm) form; String projectId = ((String) dynaForm.get(UMLBrowserFormConstants.PROJECT_IDSEQ)).trim(); if (projectId == null || projectId.length() == 0) { setSessionObject(request, UMLBrowserFormConstants.SUBPROJECT_OPTIONS, getSessionObject(request, UMLBrowserFormConstants.ALL_SUBPROJECTS ),true); setSessionObject(request, UMLBrowserFormConstants.PACKAGE_OPTIONS, getSessionObject(request, UMLBrowserFormConstants.ALL_PACKAGES ),true); } else { Project project = setPackageOptionsForProjectId(request, projectId); if (project != null ){ setSessionObject(request, UMLBrowserFormConstants.SUBPROJECT_OPTIONS, project.getSubProjectCollection(), true); } } String showClass=(String) getSessionObject(request, UMLBrowserFormConstants.CLASS_VIEW); if (showClass == null || showClass.equalsIgnoreCase("true")) return mapping.findForward("umlSearch"); return mapping.findForward("showAttributes"); } |
List stationsUnderMouse = new ArrayList(); | public boolean mouseClicked(MouseEvent e){ if (currentPopup != null){ currentPopup.setVisible(false); currentPopup = null; } synchronized(omgraphics){ Iterator it = omgraphics.iterator(); List stationsUnderMouse = new ArrayList(); while(it.hasNext()){ OMStation current = (OMStation)it.next(); if(current.contains(e.getX(), e.getY())){ stationsUnderMouse.add(current.getStation()); } } if (stationsUnderMouse.size() > 0){ if (stationsUnderMouse.size() == 1){ synchronized(chooser){ chooser.toggleStationSelected((Station)stationsUnderMouse.get(0)); } } else{ final JPopupMenu popup = new JPopupMenu(); it = stationsUnderMouse.iterator(); while (it.hasNext()){ final Station current = (Station)it.next(); final JMenuItem menuItem = new JMenuItem(getStationInfo(current, currentEvent)); menuItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { synchronized(chooser){ chooser.toggleStationSelected(current); } popup.setVisible(false); } }); menuItem.addMouseListener(new MouseAdapter(){ public void mouseEntered(MouseEvent e) { menuItem.setArmed(true); } public void mouseExited(MouseEvent e) { menuItem.setArmed(false); } }); popup.add(menuItem); } Point compLocation = e.getComponent().getLocationOnScreen(); double[] popupLoc = {compLocation.getX(), compLocation.getY()}; popup.setLocation((int)popupLoc[0] + e.getX(), (int)popupLoc[1] + e.getY()); popup.setVisible(true); currentPopup = popup; } return true; } } return false; } |
|
if (stationsUnderMouse.size() > 0){ if (stationsUnderMouse.size() == 1){ synchronized(chooser){ chooser.toggleStationSelected((Station)stationsUnderMouse.get(0)); } | } if (stationsUnderMouse.size() > 0){ if (stationsUnderMouse.size() > 1){ final JPopupMenu popup = new JPopupMenu(); Iterator it = stationsUnderMouse.iterator(); while (it.hasNext()){ final Station current = (Station)it.next(); final JMenuItem menuItem = new JMenuItem(getStationInfo(current, currentEvent)); menuItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { chooser.toggleStationSelected(current); popup.setVisible(false); } }); menuItem.addMouseListener(new MouseAdapter(){ public void mouseEntered(MouseEvent e) { menuItem.setArmed(true); } public void mouseExited(MouseEvent e) { menuItem.setArmed(false); } }); popup.add(menuItem); | public boolean mouseClicked(MouseEvent e){ if (currentPopup != null){ currentPopup.setVisible(false); currentPopup = null; } synchronized(omgraphics){ Iterator it = omgraphics.iterator(); List stationsUnderMouse = new ArrayList(); while(it.hasNext()){ OMStation current = (OMStation)it.next(); if(current.contains(e.getX(), e.getY())){ stationsUnderMouse.add(current.getStation()); } } if (stationsUnderMouse.size() > 0){ if (stationsUnderMouse.size() == 1){ synchronized(chooser){ chooser.toggleStationSelected((Station)stationsUnderMouse.get(0)); } } else{ final JPopupMenu popup = new JPopupMenu(); it = stationsUnderMouse.iterator(); while (it.hasNext()){ final Station current = (Station)it.next(); final JMenuItem menuItem = new JMenuItem(getStationInfo(current, currentEvent)); menuItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { synchronized(chooser){ chooser.toggleStationSelected(current); } popup.setVisible(false); } }); menuItem.addMouseListener(new MouseAdapter(){ public void mouseEntered(MouseEvent e) { menuItem.setArmed(true); } public void mouseExited(MouseEvent e) { menuItem.setArmed(false); } }); popup.add(menuItem); } Point compLocation = e.getComponent().getLocationOnScreen(); double[] popupLoc = {compLocation.getX(), compLocation.getY()}; popup.setLocation((int)popupLoc[0] + e.getX(), (int)popupLoc[1] + e.getY()); popup.setVisible(true); currentPopup = popup; } return true; } } return false; } |
else{ final JPopupMenu popup = new JPopupMenu(); it = stationsUnderMouse.iterator(); while (it.hasNext()){ final Station current = (Station)it.next(); final JMenuItem menuItem = new JMenuItem(getStationInfo(current, currentEvent)); menuItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { synchronized(chooser){ chooser.toggleStationSelected(current); } popup.setVisible(false); } }); menuItem.addMouseListener(new MouseAdapter(){ public void mouseEntered(MouseEvent e) { menuItem.setArmed(true); } public void mouseExited(MouseEvent e) { menuItem.setArmed(false); } }); popup.add(menuItem); } Point compLocation = e.getComponent().getLocationOnScreen(); double[] popupLoc = {compLocation.getX(), compLocation.getY()}; popup.setLocation((int)popupLoc[0] + e.getX(), (int)popupLoc[1] + e.getY()); popup.setVisible(true); currentPopup = popup; } return true; | Point compLocation = e.getComponent().getLocationOnScreen(); double[] popupLoc = {compLocation.getX(), compLocation.getY()}; popup.setLocation((int)popupLoc[0] + e.getX(), (int)popupLoc[1] + e.getY()); popup.setVisible(true); currentPopup = popup; | public boolean mouseClicked(MouseEvent e){ if (currentPopup != null){ currentPopup.setVisible(false); currentPopup = null; } synchronized(omgraphics){ Iterator it = omgraphics.iterator(); List stationsUnderMouse = new ArrayList(); while(it.hasNext()){ OMStation current = (OMStation)it.next(); if(current.contains(e.getX(), e.getY())){ stationsUnderMouse.add(current.getStation()); } } if (stationsUnderMouse.size() > 0){ if (stationsUnderMouse.size() == 1){ synchronized(chooser){ chooser.toggleStationSelected((Station)stationsUnderMouse.get(0)); } } else{ final JPopupMenu popup = new JPopupMenu(); it = stationsUnderMouse.iterator(); while (it.hasNext()){ final Station current = (Station)it.next(); final JMenuItem menuItem = new JMenuItem(getStationInfo(current, currentEvent)); menuItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { synchronized(chooser){ chooser.toggleStationSelected(current); } popup.setVisible(false); } }); menuItem.addMouseListener(new MouseAdapter(){ public void mouseEntered(MouseEvent e) { menuItem.setArmed(true); } public void mouseExited(MouseEvent e) { menuItem.setArmed(false); } }); popup.add(menuItem); } Point compLocation = e.getComponent().getLocationOnScreen(); double[] popupLoc = {compLocation.getX(), compLocation.getY()}; popup.setLocation((int)popupLoc[0] + e.getX(), (int)popupLoc[1] + e.getY()); popup.setVisible(true); currentPopup = popup; } return true; } } return false; } |
else{ chooser.toggleStationSelected((Station)stationsUnderMouse.get(0)); } return true; | public boolean mouseClicked(MouseEvent e){ if (currentPopup != null){ currentPopup.setVisible(false); currentPopup = null; } synchronized(omgraphics){ Iterator it = omgraphics.iterator(); List stationsUnderMouse = new ArrayList(); while(it.hasNext()){ OMStation current = (OMStation)it.next(); if(current.contains(e.getX(), e.getY())){ stationsUnderMouse.add(current.getStation()); } } if (stationsUnderMouse.size() > 0){ if (stationsUnderMouse.size() == 1){ synchronized(chooser){ chooser.toggleStationSelected((Station)stationsUnderMouse.get(0)); } } else{ final JPopupMenu popup = new JPopupMenu(); it = stationsUnderMouse.iterator(); while (it.hasNext()){ final Station current = (Station)it.next(); final JMenuItem menuItem = new JMenuItem(getStationInfo(current, currentEvent)); menuItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { synchronized(chooser){ chooser.toggleStationSelected(current); } popup.setVisible(false); } }); menuItem.addMouseListener(new MouseAdapter(){ public void mouseEntered(MouseEvent e) { menuItem.setArmed(true); } public void mouseExited(MouseEvent e) { menuItem.setArmed(false); } }); popup.add(menuItem); } Point compLocation = e.getComponent().getLocationOnScreen(); double[] popupLoc = {compLocation.getX(), compLocation.getY()}; popup.setLocation((int)popupLoc[0] + e.getX(), (int)popupLoc[1] + e.getY()); popup.setVisible(true); currentPopup = popup; } return true; } } return false; } |
|
synchronized(chooser){ chooser.toggleStationSelected(current); } popup.setVisible(false); } | chooser.toggleStationSelected(current); popup.setVisible(false); } | public void actionPerformed(ActionEvent e) { synchronized(chooser){ chooser.toggleStationSelected(current); } popup.setVisible(false); } |
form.getMsg().emit("org.bedework.message.added.events", 1); | form.getMsg().emit("org.bedework.client.message.added.events", 1); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { // Just ignore this return "doNothing"; } BwEvent ev = form.getNewEvent(); if (ev == null) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); if (ev.getCalendar() == null) { // Set the default calendar ev.setCalendar(svci.getPreferredCalendar()); } if (!form.getEventDates().updateEvent(ev, svci.getTimezones()) || !BwWebUtil.validateEvent(svci, ev, false, // descriptionRequired form.getErr())) { return "doNothing"; } /** We might also need to add a location - for private events we don't * require a location */ BwLocation loc = null; if (form.getLocationId() != CalFacadeDefs.defaultLocationId) { loc = svci.getLocation(form.getLocationId()); } if (loc == null) { loc = form.getNewLocation(); } if (loc.getAddress() != null) { /* Location assigned */ BwLocation l = svci.ensureLocationExists(loc); boolean added = true; if (l != null) { loc = l; added = false; } ev.setLocation(loc); if (added) { form.getMsg().emit("org.bedework.client.message.locations.added", 1); } } else { ev.setLocation(null); } svci.addEvent(ev.getCalendar(), ev, null); form.resetNewEvent(); form.resetNewLocation(); form.getEventDates().setNewEvent(form.getNewEvent(), svci.getTimezones()); form.getMsg().emit("org.bedework.message.added.events", 1); form.refreshIsNeeded(); return "success"; } |
} catch (XTypeMismatch e) { | } catch (XSelectorNotFound e) { | public ATNil meta_assignField(ATSymbol name, ATObject value) throws NATException { String jSelector = null; try{ jSelector = Reflection.upMetaFieldMutationSelector(name); JavaInterfaceAdaptor.invokeJavaMethod( principal_.getClass(), principal_, jSelector, new ATObject[] { value.asMirror().base_getBase() }); } catch (XTypeMismatch e) { // Principal does not have a corresponding meta_level method // OR the passed value is not a mirror object // try for a base_level method of the mirror itself. return super.meta_assignField(name, value); } return NATNil._INSTANCE_; } |
} catch (XTypeMismatch e) { | } catch (XSelectorNotFound e) { | public ATObject meta_invoke(ATObject receiver, ATSymbol atSelector, ATTable arguments) throws NATException { String jSelector = Reflection.upMetaLevelSelector(atSelector); try { return NATMirrorFactory._INSTANCE_.base_createMirror( Reflection.downObject( Reflection.upInvocation( principal_, // implementor principal_, // self jSelector, arguments))); } catch (XTypeMismatch e) { // Principal does not have a corresponding meta_level method // try for a base_level method of the mirror itself. return super.meta_invoke(receiver, atSelector, arguments); } } |
} catch (XTypeMismatch e) { | } catch (XSelectorNotFound e) { | public ATObject meta_select(ATObject receiver, ATSymbol atSelector) throws NATException { String jSelector = null; try { jSelector = Reflection.upMetaFieldAccessSelector(atSelector); return NATMirrorFactory._INSTANCE_.base_createMirror( Reflection.downObject( Reflection.upFieldSelection( principal_, principal_, jSelector))); } catch (XTypeMismatch e) { try { jSelector = Reflection.upMetaLevelSelector(atSelector); return NATMirrorFactory._INSTANCE_.base_createMirror( Reflection.downObject( Reflection.upMethodSelection( principal_, principal_, jSelector))); } catch (XSelectorNotFound e2) { // Principal does not have a corresponding meta_level field nor // method try for a base_level field or method of the mirror itself. return super.meta_select(receiver, atSelector); } } } |
err.emit("org.bedework.config.badvalue", getName(), getValue()); | err.emit("org.bedework.config.error.badvalue", getName(), getValue()); | public boolean validate(MessageEmit err) { goodValue = true; if (!getShow()) { return true; } String val = getValue(); if (val != null) { // set as string val = val.toLowerCase(); if (val.equals("false") || val.equals("no")) { booleanVal = false; } else if (val.equals("true") || val.equals("yes")) { booleanVal = true; } else { err.emit("org.bedework.config.badvalue", getName(), getValue()); } } setValue(String.valueOf(booleanVal)); return goodValue; } |
evalAndCompareTo("`(3)", atThree_); evalAndCompareTo("`(x)", atX_); evalAndCompareTo("`(def x := 3)", "def x := 3"); evalAndCompareTo("`(def x := `(3))", "def x := `(3)"); evalAndCompareTo("`(def x := #(3))", "def x := 3"); evalAndCompareTo("`(def foo(a) { #([1,2,3]) })", "def foo(a) { [1, 2, 3] }"); evalAndCompareTo("`(def foo(#@(`([a,b,c]))) { #@([1,2,3]) })", "def foo(a, b, c) { 1; 2; 3 }"); evalAndCompareTo("`(def foo: x bar: #@(`([y,z])) { 1 })", "def foo:bar:(x, y, z) { 1 }"); | evalAndCompareTo("`3", atThree_); evalAndCompareTo("`x", atX_); evalAndCompareTo("`{def x := 3}", "def x := 3"); evalAndCompareTo("`{def x := `3}", "def x := `(3)"); evalAndCompareTo("`{def x := #3}", "def x := 3"); evalAndCompareTo("`{def foo(a) { #([1,2,3]) }}", "def foo(a) { [1, 2, 3] }"); evalAndCompareTo("`{def foo(#@(`([a,b,c]))) { #@([1,2,3]) }}", "def foo(a, b, c) { 1; 2; 3 }"); evalAndCompareTo("`{def foo: x bar: #@(`([y,z])) { 1 }}", "def foo:bar:(x, y, z) { 1 }"); | public void testQuotation() throws NATException { evalAndCompareTo("`(3)", atThree_); evalAndCompareTo("`(x)", atX_); evalAndCompareTo("`(def x := 3)", "def x := 3"); evalAndCompareTo("`(def x := `(3))", "def x := `(3)"); evalAndCompareTo("`(def x := #(3))", "def x := 3"); evalAndCompareTo("`(def foo(a) { #([1,2,3]) })", "def foo(a) { [1, 2, 3] }"); evalAndCompareTo("`(def foo(#@(`([a,b,c]))) { #@([1,2,3]) })", "def foo(a, b, c) { 1; 2; 3 }"); evalAndCompareTo("`(def foo: x bar: #@(`([y,z])) { 1 })", "def foo:bar:(x, y, z) { 1 }"); } |
(TimeConfigRegistrar)creator.getTimeConfig(), | new TimeConfigRegistrar((TimeConfigRegistrar)creator.getTimeConfig()), | public void createParticleDisplay(BasicSeismogramDisplay creator, boolean advancedOption){ if(particleDisplay == null){ logger.debug("creating particle display"); particleWindow = new JFrame(particleWindowName); particleDisplay = new ParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms().getFirst(), (TimeConfigRegistrar)creator.getTimeConfig(), creator.getAmpRegistrar(), creator.getAmpRegistrar(), advancedOption); JPanel displayPanel = new JPanel(); JButton zoomIn = new JButton("zoomIn"); JButton zoomOut = new JButton("zoomOut"); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(zoomIn); buttonPanel.add(zoomOut); displayPanel.setLayout(new BorderLayout()); displayPanel.add(particleDisplay, java.awt.BorderLayout.CENTER); displayPanel.add(buttonPanel, java.awt.BorderLayout.SOUTH); java.awt.Dimension size = new java.awt.Dimension(400, 400); displayPanel.setSize(size); particleWindow.getContentPane().add(displayPanel); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleWindow.dispose(); particleDisplay = null; } }); particleWindow.setSize(size); zoomIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomIn(true); // particleDisplay.setZoomOut(false); } }); zoomOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomOut(true); // particleDisplay.setZoomIn(false); } }); Toolkit tk = Toolkit.getDefaultToolkit(); if(particleWindow.getSize().width*particleDisplays < tk.getScreenSize().width){ particleWindow.setLocation(particleWindow.getSize().width * particleDisplays, tk.getScreenSize().height - particleWindow.getSize().width); }else{ particleWindow.setLocation(tk.getScreenSize().width - particleWindow.getSize().width, tk.getScreenSize().height - particleWindow.getSize().height); } particleDisplays++; particleWindow.setVisible(true); }else { particleDisplay.addParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms().getFirst(), (TimeConfigRegistrar)creator.getTimeConfig(), creator.getAmpRegistrar(), creator.getAmpRegistrar()); } // end of else } |
particleWindow.dispose(); particleDisplay = null; | particleDisplay.removeAll(); particleDisplays--; | public void windowClosing(WindowEvent e) { particleWindow.dispose(); particleDisplay = null; } |
threeSelectionDisplay.removeAll(); | selectionDisplay.removeAll(); | public void windowClosing(WindowEvent e) { threeSelectionDisplay.removeAll(); } |
particleDisplay.removeAll(); | public void removeAll(){ logger.debug("removing all displays"); if(parent != null){ parent.removeSelectionDisplay(this); } this.stopImageCreation(); seismograms.removeAll(); remove(seismograms); basicDisplays.clear(); sorter = new AlphaSeisSorter(); globalTimeRegistrar = new TimeConfigRegistrar(); globalAmpRegistrar = new AmpConfigRegistrar(new RMeanAmpConfig()); this.time.setText(" Time: "); this.amp.setText(" Amplitude: "); if(selectionDisplay != null){ selectionDisplay.removeAll(); selectionWindow.dispose(); //selectionDisplays -= selectionWindow.getSize().height; selectionDisplay = null; } if(threeSelectionDisplay != null){ threeSelectionDisplay.removeAll(); threeSelectionWindow.dispose(); //selectionDisplays -= threeSelectionWindow.getSize().height; selectionDisplay = null; } if(particleDisplay != null){ particleWindow.dispose(); particleDisplays--; particleDisplay = null; } repaint(); } |
|
CalSvcIPars pars = new CalSvcIPars(account, UserAuth.noPrivileges, | CalSvcIPars pars = new CalSvcIPars(account, | public Synchml(String account, String deviceId, URIgen uriGen, boolean debug) throws CalFacadeException { svci = new CalSvc(); this.deviceId = deviceId; this.debug = debug; CalSvcIPars pars = new CalSvcIPars(account, UserAuth.noPrivileges, account, null, // XXX Requires an env prefix false, // public false, // caldav deviceId, // synchId debug); svci.init(pars); /** If we were limiting our view to a particular filter we would set that now. */ svci.open(); try { trans = new IcalTranslator(svci.getIcalCallback(), debug); synchInfo = svci.getSynchInfo(); if (synchInfo == null) { svci.beginTransaction(); synchInfo = new BwSynchInfo(); synchInfo.setUser(svci.getUser()); synchInfo.setDeviceId(deviceId); svci.addSynchInfo(synchInfo); svci.endTransaction(); } } finally { svci.close(); } } |
close(svci); | trans.close(); | public void close() { try { close(svci); } catch (Throwable t) { } } |
Iterator it = uiList.iterator(); | Iterator it = infoset.getAll().iterator(); CalDavClient cd = new CalDavClient(debug); | private Collection getFreeBusy(Date start, Date end) throws Throwable { ArrayList responses = new ArrayList(); Iterator it = uiList.iterator(); while (it.hasNext()) { UserInfo ui = (UserInfo)it.next(); Req r = makeFreeBusyRequest(start, end, ui); CaldavClientIo cio = getCio(ui.host, ui.port); Response resp = new Response(); resp.ui = ui; responses.add(resp); if (r.getAuth()) { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getUser(), r.getPw(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } else { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } if (resp.responseCode != HttpServletResponse.SC_OK) { error("Got response " + resp.responseCode + " for account " + ui.account + ", host " + ui.host + " and url " + ui.url); continue; } CaldavResp cdresp = cio.getResponse(); /* We expect a VCALENDAR object containg VFREEBUSY components */ InputStream in = cdresp.getContentStream(); Collection fbs = trans.fromIcal(null, new InputStreamReader(in)); Iterator fbit = fbs.iterator(); while (fbit.hasNext()) { Object o = fbit.next(); if (o instanceof BwFreeBusy) { BwFreeBusy fb = (BwFreeBusy)o; fb.setWho(new BwUser(ui.account)); resp.fbs.add(fb); } } } return responses; } |
UserInfo ui = (UserInfo)it.next(); | FBUserInfo ui = (FBUserInfo)it.next(); | private Collection getFreeBusy(Date start, Date end) throws Throwable { ArrayList responses = new ArrayList(); Iterator it = uiList.iterator(); while (it.hasNext()) { UserInfo ui = (UserInfo)it.next(); Req r = makeFreeBusyRequest(start, end, ui); CaldavClientIo cio = getCio(ui.host, ui.port); Response resp = new Response(); resp.ui = ui; responses.add(resp); if (r.getAuth()) { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getUser(), r.getPw(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } else { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } if (resp.responseCode != HttpServletResponse.SC_OK) { error("Got response " + resp.responseCode + " for account " + ui.account + ", host " + ui.host + " and url " + ui.url); continue; } CaldavResp cdresp = cio.getResponse(); /* We expect a VCALENDAR object containg VFREEBUSY components */ InputStream in = cdresp.getContentStream(); Collection fbs = trans.fromIcal(null, new InputStreamReader(in)); Iterator fbit = fbs.iterator(); while (fbit.hasNext()) { Object o = fbit.next(); if (o instanceof BwFreeBusy) { BwFreeBusy fb = (BwFreeBusy)o; fb.setWho(new BwUser(ui.account)); resp.fbs.add(fb); } } } return responses; } |
CaldavClientIo cio = getCio(ui.host, ui.port); Response resp = new Response(); resp.ui = ui; | CalDavClient.Response resp = cd.send(r, ui); | private Collection getFreeBusy(Date start, Date end) throws Throwable { ArrayList responses = new ArrayList(); Iterator it = uiList.iterator(); while (it.hasNext()) { UserInfo ui = (UserInfo)it.next(); Req r = makeFreeBusyRequest(start, end, ui); CaldavClientIo cio = getCio(ui.host, ui.port); Response resp = new Response(); resp.ui = ui; responses.add(resp); if (r.getAuth()) { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getUser(), r.getPw(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } else { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } if (resp.responseCode != HttpServletResponse.SC_OK) { error("Got response " + resp.responseCode + " for account " + ui.account + ", host " + ui.host + " and url " + ui.url); continue; } CaldavResp cdresp = cio.getResponse(); /* We expect a VCALENDAR object containg VFREEBUSY components */ InputStream in = cdresp.getContentStream(); Collection fbs = trans.fromIcal(null, new InputStreamReader(in)); Iterator fbit = fbs.iterator(); while (fbit.hasNext()) { Object o = fbit.next(); if (o instanceof BwFreeBusy) { BwFreeBusy fb = (BwFreeBusy)o; fb.setWho(new BwUser(ui.account)); resp.fbs.add(fb); } } } return responses; } |
if (r.getAuth()) { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getUser(), r.getPw(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } else { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } | private Collection getFreeBusy(Date start, Date end) throws Throwable { ArrayList responses = new ArrayList(); Iterator it = uiList.iterator(); while (it.hasNext()) { UserInfo ui = (UserInfo)it.next(); Req r = makeFreeBusyRequest(start, end, ui); CaldavClientIo cio = getCio(ui.host, ui.port); Response resp = new Response(); resp.ui = ui; responses.add(resp); if (r.getAuth()) { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getUser(), r.getPw(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } else { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } if (resp.responseCode != HttpServletResponse.SC_OK) { error("Got response " + resp.responseCode + " for account " + ui.account + ", host " + ui.host + " and url " + ui.url); continue; } CaldavResp cdresp = cio.getResponse(); /* We expect a VCALENDAR object containg VFREEBUSY components */ InputStream in = cdresp.getContentStream(); Collection fbs = trans.fromIcal(null, new InputStreamReader(in)); Iterator fbit = fbs.iterator(); while (fbit.hasNext()) { Object o = fbit.next(); if (o instanceof BwFreeBusy) { BwFreeBusy fb = (BwFreeBusy)o; fb.setWho(new BwUser(ui.account)); resp.fbs.add(fb); } } } return responses; } |
|
error("Got response " + resp.responseCode + " for account " + ui.account + ", host " + ui.host + " and url " + ui.url); | private Collection getFreeBusy(Date start, Date end) throws Throwable { ArrayList responses = new ArrayList(); Iterator it = uiList.iterator(); while (it.hasNext()) { UserInfo ui = (UserInfo)it.next(); Req r = makeFreeBusyRequest(start, end, ui); CaldavClientIo cio = getCio(ui.host, ui.port); Response resp = new Response(); resp.ui = ui; responses.add(resp); if (r.getAuth()) { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getUser(), r.getPw(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } else { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } if (resp.responseCode != HttpServletResponse.SC_OK) { error("Got response " + resp.responseCode + " for account " + ui.account + ", host " + ui.host + " and url " + ui.url); continue; } CaldavResp cdresp = cio.getResponse(); /* We expect a VCALENDAR object containg VFREEBUSY components */ InputStream in = cdresp.getContentStream(); Collection fbs = trans.fromIcal(null, new InputStreamReader(in)); Iterator fbit = fbs.iterator(); while (fbit.hasNext()) { Object o = fbit.next(); if (o instanceof BwFreeBusy) { BwFreeBusy fb = (BwFreeBusy)o; fb.setWho(new BwUser(ui.account)); resp.fbs.add(fb); } } } return responses; } |
|
CaldavResp cdresp = cio.getResponse(); | private Collection getFreeBusy(Date start, Date end) throws Throwable { ArrayList responses = new ArrayList(); Iterator it = uiList.iterator(); while (it.hasNext()) { UserInfo ui = (UserInfo)it.next(); Req r = makeFreeBusyRequest(start, end, ui); CaldavClientIo cio = getCio(ui.host, ui.port); Response resp = new Response(); resp.ui = ui; responses.add(resp); if (r.getAuth()) { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getUser(), r.getPw(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } else { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } if (resp.responseCode != HttpServletResponse.SC_OK) { error("Got response " + resp.responseCode + " for account " + ui.account + ", host " + ui.host + " and url " + ui.url); continue; } CaldavResp cdresp = cio.getResponse(); /* We expect a VCALENDAR object containg VFREEBUSY components */ InputStream in = cdresp.getContentStream(); Collection fbs = trans.fromIcal(null, new InputStreamReader(in)); Iterator fbit = fbs.iterator(); while (fbit.hasNext()) { Object o = fbit.next(); if (o instanceof BwFreeBusy) { BwFreeBusy fb = (BwFreeBusy)o; fb.setWho(new BwUser(ui.account)); resp.fbs.add(fb); } } } return responses; } |
|
InputStream in = cdresp.getContentStream(); | InputStream in = resp.cdresp.getContentStream(); | private Collection getFreeBusy(Date start, Date end) throws Throwable { ArrayList responses = new ArrayList(); Iterator it = uiList.iterator(); while (it.hasNext()) { UserInfo ui = (UserInfo)it.next(); Req r = makeFreeBusyRequest(start, end, ui); CaldavClientIo cio = getCio(ui.host, ui.port); Response resp = new Response(); resp.ui = ui; responses.add(resp); if (r.getAuth()) { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getUser(), r.getPw(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } else { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } if (resp.responseCode != HttpServletResponse.SC_OK) { error("Got response " + resp.responseCode + " for account " + ui.account + ", host " + ui.host + " and url " + ui.url); continue; } CaldavResp cdresp = cio.getResponse(); /* We expect a VCALENDAR object containg VFREEBUSY components */ InputStream in = cdresp.getContentStream(); Collection fbs = trans.fromIcal(null, new InputStreamReader(in)); Iterator fbit = fbs.iterator(); while (fbit.hasNext()) { Object o = fbit.next(); if (o instanceof BwFreeBusy) { BwFreeBusy fb = (BwFreeBusy)o; fb.setWho(new BwUser(ui.account)); resp.fbs.add(fb); } } } return responses; } |
Collection fbs = trans.fromIcal(null, new InputStreamReader(in)); | Collection fbs = trans.getFreeBusy(new InputStreamReader(in)); | private Collection getFreeBusy(Date start, Date end) throws Throwable { ArrayList responses = new ArrayList(); Iterator it = uiList.iterator(); while (it.hasNext()) { UserInfo ui = (UserInfo)it.next(); Req r = makeFreeBusyRequest(start, end, ui); CaldavClientIo cio = getCio(ui.host, ui.port); Response resp = new Response(); resp.ui = ui; responses.add(resp); if (r.getAuth()) { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getUser(), r.getPw(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } else { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } if (resp.responseCode != HttpServletResponse.SC_OK) { error("Got response " + resp.responseCode + " for account " + ui.account + ", host " + ui.host + " and url " + ui.url); continue; } CaldavResp cdresp = cio.getResponse(); /* We expect a VCALENDAR object containg VFREEBUSY components */ InputStream in = cdresp.getContentStream(); Collection fbs = trans.fromIcal(null, new InputStreamReader(in)); Iterator fbit = fbs.iterator(); while (fbit.hasNext()) { Object o = fbit.next(); if (o instanceof BwFreeBusy) { BwFreeBusy fb = (BwFreeBusy)o; fb.setWho(new BwUser(ui.account)); resp.fbs.add(fb); } } } return responses; } |
fb.setWho(new BwUser(ui.account)); | fb.setWho(new BwUser(ui.getAccount())); | private Collection getFreeBusy(Date start, Date end) throws Throwable { ArrayList responses = new ArrayList(); Iterator it = uiList.iterator(); while (it.hasNext()) { UserInfo ui = (UserInfo)it.next(); Req r = makeFreeBusyRequest(start, end, ui); CaldavClientIo cio = getCio(ui.host, ui.port); Response resp = new Response(); resp.ui = ui; responses.add(resp); if (r.getAuth()) { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getUser(), r.getPw(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } else { resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(), 0, r.getContentType(), r.getContentLength(), r.getContentBytes()); } if (resp.responseCode != HttpServletResponse.SC_OK) { error("Got response " + resp.responseCode + " for account " + ui.account + ", host " + ui.host + " and url " + ui.url); continue; } CaldavResp cdresp = cio.getResponse(); /* We expect a VCALENDAR object containg VFREEBUSY components */ InputStream in = cdresp.getContentStream(); Collection fbs = trans.fromIcal(null, new InputStreamReader(in)); Iterator fbit = fbs.iterator(); while (fbit.hasNext()) { Object o = fbit.next(); if (o instanceof BwFreeBusy) { BwFreeBusy fb = (BwFreeBusy)o; fb.setWho(new BwUser(ui.account)); resp.fbs.add(fb); } } } return responses; } |
addUser(new UserInfo("douglm", "bedework", "douglm", "localhost", 8080, false, "/ucaldav/user/douglm")); getSvci(); | infoset = new FBInfoSet(); trans = new IcalTrans(debug); | private void init() throws Throwable { /* addUser(new UserInfo("testuser01", "bedework", "douglm", "localhost", 8080, false, "/ucaldav/user/douglm")); addUser(new UserInfo("testuser01", "bedework", "johnsa", "localhost", 8080, false, "/ucaldav/user/johnsa")); */ /* addUser(new UserInfo("testuser02", "bedework", "testuser02", "www.bedework.org", 80, false, "/ucaldav/user/testuser02")); */ addUser(new UserInfo("douglm", "bedework", "douglm", "localhost", 8080, false, "/ucaldav/user/douglm"));/* addUser(new UserInfo("testuser02", "bedework", "testuser02", "www.bedework.org", 80, false, "/ucaldav/user/testuser02")); addUser(new UserInfo("testuser08", "bedework", "testuser08", "www.bedework.org", 80, false, "/ucaldav/user/testuser08"));*/ getSvci(); // } |
Response resp = (Response)it.next(); | CalDavClient.Response resp = (CalDavClient.Response)it.next(); | public static void main(String[] args) { FreeBusyAggregator fba = new FreeBusyAggregator(); try { fba.init(); Calendar cal = Calendar.getInstance(); cal.add(Calendar.WEEK_OF_YEAR, 1); Collection responses = fba.getFreeBusy(new Date(), cal.getTime()); fba.close(); Iterator it = responses.iterator(); while (it.hasNext()) { Response resp = (Response)it.next(); if (resp.responseCode != HttpServletResponse.SC_OK) { out("Response code for " + resp.ui.account + " = " + resp.responseCode); } else { } } } catch (Throwable t) { t.printStackTrace(); fba.error(t.getMessage()); } } |
out("Response code for " + resp.ui.account + " = " + resp.responseCode); | out("Response code for " + resp.ui.getAccount() + " = " + resp.responseCode); | public static void main(String[] args) { FreeBusyAggregator fba = new FreeBusyAggregator(); try { fba.init(); Calendar cal = Calendar.getInstance(); cal.add(Calendar.WEEK_OF_YEAR, 1); Collection responses = fba.getFreeBusy(new Date(), cal.getTime()); fba.close(); Iterator it = responses.iterator(); while (it.hasNext()) { Response resp = (Response)it.next(); if (resp.responseCode != HttpServletResponse.SC_OK) { out("Response code for " + resp.ui.account + " = " + resp.responseCode); } else { } } } catch (Throwable t) { t.printStackTrace(); fba.error(t.getMessage()); } } |
private Req makeFreeBusyRequest(Date start, Date end, UserInfo ui) throws Throwable { | private Req makeFreeBusyRequest(Date start, Date end, FBUserInfo ui) throws Throwable { | private Req makeFreeBusyRequest(Date start, Date end, UserInfo ui) throws Throwable { Req req; if (ui.authUser == null) { req = new Req(); } else { req = new Req(ui.authUser, ui.authPw); } req.setUrl(ui.url); req.setContentType("text/xml"); req.setMethod("REPORT"); req.addHeader("Depth", "0"); req.addContentLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>"); req.addContentLine("<C:free-busy-query xmlns:C=\"urn:ietf:params:xml:ns:caldav\">");// req.addContentLine(" <C:time-range start=\"" +// CalFacadeUtil.isoDateTimeUTC(start) + "\"");// req.addContentLine(" end=\"" +// CalFacadeUtil.isoDateTimeUTC(end) + "\"/>"); req.addContentLine(" <C:time-range start=\"20060601T131358Z\""); req.addContentLine(" end=\"20060631T131358Z\"/>"); req.addContentLine("</C:free-busy-query>"); return req; } |
if (ui.authUser == null) { | if (ui.getAuthUser() == null) { | private Req makeFreeBusyRequest(Date start, Date end, UserInfo ui) throws Throwable { Req req; if (ui.authUser == null) { req = new Req(); } else { req = new Req(ui.authUser, ui.authPw); } req.setUrl(ui.url); req.setContentType("text/xml"); req.setMethod("REPORT"); req.addHeader("Depth", "0"); req.addContentLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>"); req.addContentLine("<C:free-busy-query xmlns:C=\"urn:ietf:params:xml:ns:caldav\">");// req.addContentLine(" <C:time-range start=\"" +// CalFacadeUtil.isoDateTimeUTC(start) + "\"");// req.addContentLine(" end=\"" +// CalFacadeUtil.isoDateTimeUTC(end) + "\"/>"); req.addContentLine(" <C:time-range start=\"20060601T131358Z\""); req.addContentLine(" end=\"20060631T131358Z\"/>"); req.addContentLine("</C:free-busy-query>"); return req; } |
req = new Req(ui.authUser, ui.authPw); | req = new Req(ui.getAuthUser(), ui.getAuthPw()); | private Req makeFreeBusyRequest(Date start, Date end, UserInfo ui) throws Throwable { Req req; if (ui.authUser == null) { req = new Req(); } else { req = new Req(ui.authUser, ui.authPw); } req.setUrl(ui.url); req.setContentType("text/xml"); req.setMethod("REPORT"); req.addHeader("Depth", "0"); req.addContentLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>"); req.addContentLine("<C:free-busy-query xmlns:C=\"urn:ietf:params:xml:ns:caldav\">");// req.addContentLine(" <C:time-range start=\"" +// CalFacadeUtil.isoDateTimeUTC(start) + "\"");// req.addContentLine(" end=\"" +// CalFacadeUtil.isoDateTimeUTC(end) + "\"/>"); req.addContentLine(" <C:time-range start=\"20060601T131358Z\""); req.addContentLine(" end=\"20060631T131358Z\"/>"); req.addContentLine("</C:free-busy-query>"); return req; } |
req.setUrl(ui.url); | req.setUrl(ui.getUrl()); | private Req makeFreeBusyRequest(Date start, Date end, UserInfo ui) throws Throwable { Req req; if (ui.authUser == null) { req = new Req(); } else { req = new Req(ui.authUser, ui.authPw); } req.setUrl(ui.url); req.setContentType("text/xml"); req.setMethod("REPORT"); req.addHeader("Depth", "0"); req.addContentLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>"); req.addContentLine("<C:free-busy-query xmlns:C=\"urn:ietf:params:xml:ns:caldav\">");// req.addContentLine(" <C:time-range start=\"" +// CalFacadeUtil.isoDateTimeUTC(start) + "\"");// req.addContentLine(" end=\"" +// CalFacadeUtil.isoDateTimeUTC(end) + "\"/>"); req.addContentLine(" <C:time-range start=\"20060601T131358Z\""); req.addContentLine(" end=\"20060631T131358Z\"/>"); req.addContentLine("</C:free-busy-query>"); return req; } |
logger.debug("NOAMP seis units are " + outSeis.y_unit); | public static LocalSeismogramImpl apply(LocalSeismogramImpl seis, Instrumentation inst) throws FissuresException { if(!isValid(inst)) { throw new IllegalArgumentException("Invalid instrumentation for " + ChannelIdUtil.toString(seis.channel_id)); } /* * Sensitivity is COUNTs per Groung Motion, so should divide in order to * convert COUNT seismogram into Ground Motion. */ Sensitivity sensitivity = inst.the_response.the_sensitivity; LocalSeismogramImpl outSeis; // don't use int or short, promote to float if(seis.can_convert_to_float()) { float[] fSeries = seis.get_as_floats(); float[] out = new float[fSeries.length]; for(int i = 0; i < fSeries.length; i++) { out[i] = fSeries[i] / sensitivity.sensitivity_factor; } outSeis = new LocalSeismogramImpl(seis, out); } else { double[] dSeries = seis.get_as_doubles(); double[] out = new double[dSeries.length]; for(int i = 0; i < dSeries.length; i++) { out[i] = dSeries[i] / sensitivity.sensitivity_factor; } outSeis = new LocalSeismogramImpl(seis, out); } // end of else outSeis.y_unit = inst.the_response.stages[0].input_units; logger.debug("NOAMP seis units are " + outSeis.y_unit); return outSeis; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.