rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
assertEquals("stat["+i+"]", 0, out[0], 0.0000001); assertEquals("stat["+i+"]", 1, out[1], 0.0000001); | assertEquals("stat["+i+"]", 0, out[0], 0.0000001*size); assertEquals("stat["+i+"]", 1, out[1], 0.0000001*size); | public void testLinearLeastSquares() throws Exception { // JUnitDoclet begin method linearLeastSquares for ( int i = 0; i<stat.length; i++) { double[] out = stat[i].linearLeastSquares(); assertEquals("stat["+i+"]", 0, out[0], 0.0000001); assertEquals("stat["+i+"]", 1, out[1], 0.0000001); } // end of for () // JUnitDoclet end method linearLeastSquares } |
suite.addTestSuite(LexicalRootTest.class); suite.addTestSuite(NATNamespaceTest.class); | public static Test suite() { TestSuite suite = new TestSuite("All AT2 Interpreter-related tests."); //$JUnit-BEGIN$ suite.addTestSuite(InvocationTest.class); suite.addTestSuite(MirrorTest.class); suite.addTestSuite(ReflectionTest.class); suite.addTestSuite(NATObjectClosureTest.class); suite.addTestSuite(TestFieldMap.class); suite.addTestSuite(TestEval.class); suite.addTestSuite(PrimitivesTest.class); //$JUnit-END$ return suite; } |
|
ServiceContext context = new ServiceContext(id, propBytes); | ServiceContext context = new ServiceContext(ID, propBytes); | public void send_request(ClientRequestInfo info) throws ForwardRequest { ServiceContext context = new ServiceContext(id, propBytes); info.add_request_service_context(context, true); } |
new URLDataSetSeismogram(names[i], sacURL, | new URLDataSetSeismogram(sacURL, | protected void checkForLegacySeismograms() { //this supports loading of classic seismogram datasets that were //created before dataset seismograms if(getDataSetSeismogramNames().length == 0) { String[] names = getSeismogramNames(); logger.info("No DataSetSeismograms in dataset "+getName()+", using legacy dataset option: creating DataSetSeismogram per LocalSeismogram. LS length="+names.length); for (int i = 0 ;i < names.length ;i++ ) { URL sacURL = getSeismogramURL(names[i]); if(sacURL != null) { DataSetSeismogram dsstemp = new URLDataSetSeismogram(names[i], sacURL, SeismogramFileTypes.SAC, this); addDataSetSeismogram(dsstemp, new AuditInfo[0]); } } } } |
this); | this, names[i]); | protected void checkForLegacySeismograms() { //this supports loading of classic seismogram datasets that were //created before dataset seismograms if(getDataSetSeismogramNames().length == 0) { String[] names = getSeismogramNames(); logger.info("No DataSetSeismograms in dataset "+getName()+", using legacy dataset option: creating DataSetSeismogram per LocalSeismogram. LS length="+names.length); for (int i = 0 ;i < names.length ;i++ ) { URL sacURL = getSeismogramURL(names[i]); if(sacURL != null) { DataSetSeismogram dsstemp = new URLDataSetSeismogram(names[i], sacURL, SeismogramFileTypes.SAC, this); addDataSetSeismogram(dsstemp, new AuditInfo[0]); } } } } |
BwUser filterOwner = globals.getFixOwner(); if (filterOwner == null) { error("Filter owner " + globals.fixOwner + " does not exist"); } entity.setOwner(filterOwner); | entity.setOwner(globals.getPublicUser()); | public void end(String ns, String name) throws Exception { BwFilter entity = (BwFilter)pop(); globals.filters++; globals.filtersTbl.put(entity); try { if (globals.from2p3px) { /* We are converting filter definitions into calendar definitions. */ BwCalendar cal = new BwCalendar(); cal.setName(fixName(entity.getName())); BwUser calOwner = globals.getPublicUser(); cal.setCreator(calOwner); cal.setOwner(calOwner); cal.setPublick(true); if (entity instanceof BwAndFilter) { error("Unable to map filter " + entity); cal = null; globals.calMapErrors++; } else if (entity instanceof BwCategoryFilter) { BwCategoryFilter catf = (BwCategoryFilter)entity; cal.setCalendarCollection(true); globals.calLeaves.add(entity); globals.catCalTbl.put(catf.getCategory().getId(), cal); } else if (entity instanceof BwCreatorFilter) { cal.setCalendarCollection(true); globals.calLeaves.add(entity); } else if (entity instanceof BwLocationFilter) { cal.setCalendarCollection(true); globals.calLeaves.add(entity); } else if (entity instanceof BwOrFilter) { if (entity.getId() == 2) { if (globals.publicCalRoot != null) { error("Seen two roots " + entity); cal = null; globals.calMapErrors++; } // This is the root globals.publicCalRoot = cal; globals.publicCalRoot.setName(globals.syspars.getPublicCalendarRoot()); globals.publicCalRoot.setPath("/" + globals.syspars.getPublicCalendarRoot()); globals.publicCalRoot.setAccess(globals.getDefaultPublicCalendarsAccess()); } } else if (entity instanceof BwSponsorFilter) { cal.setCalendarCollection(true); globals.calLeaves.add(entity); } else if (entity instanceof BwNotFilter) { error("Unable to map filter " + entity); cal = null; globals.calMapErrors++; } else if (entity instanceof RestoreGlobals.AliasFilter) { error("Unable to map filter " + entity); cal = null; globals.calMapErrors++; } if (cal != null) { cal.setId(globals.nextCalKey); globals.nextCalKey++; globals.calendarsTbl.put(new Integer(cal.getId()), cal); if (entity.getParent() != null) { BwCalendar parent = (BwCalendar)globals.filterToCal.get( new Integer(entity.getParent().getId())); if (parent == null) { error("Missing parent in mapping tbl " + entity); globals.calMapErrors++; } else { cal.setCalendar(parent); cal.setPath(parent.getPath() + "/" + cal.getName()); if (cal.getPath().equals(globals.defaultPublicCalPath)) { globals.defaultPublicCal = cal; } parent.addChild(cal); } } globals.filterToCal.put(new Integer(entity.getId()), cal); } BwUser filterOwner = globals.getFixOwner(); if (filterOwner == null) { error("Filter owner " + globals.fixOwner + " does not exist"); } entity.setOwner(filterOwner); entity.setPublick(true); } if (globals.rintf != null) { trace("About to restore filter " + entity); globals.rintf.restoreFilter(entity); } } catch (Throwable t) { throw new Exception(t); } } |
_designDoc.setPageWidth(595); _designDoc.setPageHeight(842); | _designDoc.setPageWidth(PAGE_WIDTH_PORTRAIT_A4); _designDoc.setPageHeight(PAGE_HEIGHT_PORTRAIT_A4); | private void initializeDocument(String name) { _designDoc = new DesignDocument(name); // set A 4 paper size _designDoc.setPageWidth(595); _designDoc.setPageHeight(842); _designDoc.setColumnWidth(540); _designDoc.setColumnSpacing(15); _designDoc.setLeftMargin(20); _designDoc.setRightMargin(20); _designDoc.setTopMargin(10); _designDoc.setBottomMargin(30); _designDoc.setColumnCount(1); _designDoc.setPrintOrderVertical(); _designDoc.setOrientationPortrait(); _designDoc.setWhenNoDataTypeAsAllSectionNoDetail(); _designDoc.setIsTitleNewPage(false); _designDoc.setIsSummaryNewPage(false); _designDoc.addParameter(PRM_REPORT_NAME,String.class,true); if (showDate) { _designDoc.addParameter(PRM_DATE, String.class, true); } if (showUser) { _designDoc.addParameter(PRM_USER, String.class, true); } } |
_designDoc.setLeftMargin(20); _designDoc.setRightMargin(20); _designDoc.setTopMargin(10); _designDoc.setBottomMargin(30); | _designDoc.setLeftMargin(PAGE_LEFT_MARGIN); _designDoc.setRightMargin(PAGE_RIGHT_MARGIN); _designDoc.setTopMargin(PAGE_TOP_MARGIN); _designDoc.setBottomMargin(PAGE_BOTTOM_MARGIN); | private void initializeDocument(String name) { _designDoc = new DesignDocument(name); // set A 4 paper size _designDoc.setPageWidth(595); _designDoc.setPageHeight(842); _designDoc.setColumnWidth(540); _designDoc.setColumnSpacing(15); _designDoc.setLeftMargin(20); _designDoc.setRightMargin(20); _designDoc.setTopMargin(10); _designDoc.setBottomMargin(30); _designDoc.setColumnCount(1); _designDoc.setPrintOrderVertical(); _designDoc.setOrientationPortrait(); _designDoc.setWhenNoDataTypeAsAllSectionNoDetail(); _designDoc.setIsTitleNewPage(false); _designDoc.setIsSummaryNewPage(false); _designDoc.addParameter(PRM_REPORT_NAME,String.class,true); if (showDate) { _designDoc.addParameter(PRM_DATE, String.class, true); } if (showUser) { _designDoc.addParameter(PRM_USER, String.class, true); } } |
this.setAttribute(ATTRIBUTE_IS_BLANK_WHEN_NULL, Boolean.toString(value)); | this.setAttribute(ATTRIBUTE_IS_BLANK_WHEN_NULL, String.valueOf(value)); | public void setIsBlankWhenNull(boolean value){ this.setAttribute(ATTRIBUTE_IS_BLANK_WHEN_NULL, Boolean.toString(value)); } |
this.setAttribute(ATTRIBUTE_IS_STRETCH_WITH_OVERFLOW, Boolean.toString(value)); | this.setAttribute(ATTRIBUTE_IS_STRETCH_WITH_OVERFLOW, String.valueOf(value)); | public void setIsStretchWithOverflow(boolean value){ this.setAttribute(ATTRIBUTE_IS_STRETCH_WITH_OVERFLOW, Boolean.toString(value)); } |
this.setAttribute(ATTRIBUTE_IS_PRINT_REPEATED_VALUES,Boolean.toString(value)); | this.setAttribute(ATTRIBUTE_IS_PRINT_REPEATED_VALUES,String.valueOf(value)); | public void setIsPrintRepeatedValues(boolean value){ this.setAttribute(ATTRIBUTE_IS_PRINT_REPEATED_VALUES,Boolean.toString(value)); } |
this.setAttribute(ATTRIBUTE_IS_REMOVE_LINE_WHEN_BLANK,Boolean.toString(value)); | this.setAttribute(ATTRIBUTE_IS_REMOVE_LINE_WHEN_BLANK,String.valueOf(value)); | public void setIsRemoveLineWhenBlank(boolean value){ this.setAttribute(ATTRIBUTE_IS_REMOVE_LINE_WHEN_BLANK,Boolean.toString(value)); } |
this.setAttribute(ATTRIBUTE_IS_PRINT_IN_FIRST_WHOLE_BAND,Boolean.toString(value)); | this.setAttribute(ATTRIBUTE_IS_PRINT_IN_FIRST_WHOLE_BAND,String.valueOf(value)); | public void setIsPrintInFirstWholeBand(boolean value){ this.setAttribute(ATTRIBUTE_IS_PRINT_IN_FIRST_WHOLE_BAND,Boolean.toString(value)); } |
this.setAttribute(ATTRIBUTE_IS_PRINT_WHEN_DETAIL_OVERFLOWS,Boolean.toString(value)); | this.setAttribute(ATTRIBUTE_IS_PRINT_WHEN_DETAIL_OVERFLOWS,String.valueOf(value)); | public void setIsPrintWhenDetailOverflows(boolean value){ this.setAttribute(ATTRIBUTE_IS_PRINT_WHEN_DETAIL_OVERFLOWS,Boolean.toString(value)); } |
ev.setCalendar(svci.getPreferredCalendar()); | int id = getIntReqPar(request, "calId", -1); if (id < 0) { ev.setCalendar(svci.getPreferredCalendar()); } else { BwCalendar calendar = svci.getCalendar(id); if (calendar == null) { form.getErr().emit("org.bedework.client.error.nosuchcalendar", id); return "notFound"; } ev.setCalendar(calendar); } | 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(); BwSubscription sub = null; if (!findSubscribedCalendar(request, form, false)) { // No subscription specified, set the default calendar ev.setCalendar(svci.getPreferredCalendar()); } else { sub = form.getSubscription(); if ((sub == null) || (sub.getCalendar() == null)) { // XXX more work for external subscriptions here return "doNothing"; } ev.setCalendar(sub.getCalendar()); } 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.client.message.added.events", 1); form.refreshIsNeeded(); return "success"; } |
if ((sub == null) || (sub.getCalendar() == null)) { | if ((sub != null) && (!sub.getInternalSubscription())) { | 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(); BwSubscription sub = null; if (!findSubscribedCalendar(request, form, false)) { // No subscription specified, set the default calendar ev.setCalendar(svci.getPreferredCalendar()); } else { sub = form.getSubscription(); if ((sub == null) || (sub.getCalendar() == null)) { // XXX more work for external subscriptions here return "doNothing"; } ev.setCalendar(sub.getCalendar()); } 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.client.message.added.events", 1); form.refreshIsNeeded(); return "success"; } |
ev.setCalendar(sub.getCalendar()); | 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(); BwSubscription sub = null; if (!findSubscribedCalendar(request, form, false)) { // No subscription specified, set the default calendar ev.setCalendar(svci.getPreferredCalendar()); } else { sub = form.getSubscription(); if ((sub == null) || (sub.getCalendar() == null)) { // XXX more work for external subscriptions here return "doNothing"; } ev.setCalendar(sub.getCalendar()); } 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.client.message.added.events", 1); form.refreshIsNeeded(); return "success"; } |
|
auth.setCurrency(properties.get(PROPERTY_CURRENCY_CODE).toString()); | auth.setCurrency(getCurrencyAbbreviation(properties.get(PROPERTY_CURRENCY_CODE).toString())); | private void storeAuthorizationEntry(String encodedCardnumber, Object parentDataPK, Hashtable properties, String authorizationType) throws IDOLookupException, CreateException { KortathjonustanAuthorisationEntriesHome authHome = (KortathjonustanAuthorisationEntriesHome) IDOLookup.getHome(KortathjonustanAuthorisationEntries.class); KortathjonustanAuthorisationEntries auth = authHome.create(); if (properties.containsKey(PROPERTY_AMOUNT)) auth.setAmount(Double.parseDouble(properties.get(PROPERTY_AMOUNT).toString()));//Double.parseDouble(strAmount)); if (properties.containsKey(PROPERTY_APPROVAL_CODE)) auth.setAuthorizationCode(properties.get(PROPERTY_APPROVAL_CODE).toString());//authCode); if (properties.containsKey(PROPERTY_CARD_BRAND_NAME)) auth.setBrandName(properties.get(PROPERTY_CARD_BRAND_NAME).toString()); if (properties.containsKey(PROPERTY_CC_EXPIRE)) auth.setCardExpires(properties.get(PROPERTY_CC_EXPIRE).toString());//monthExpires+yearExpires); if (properties.containsKey(PROPERTY_CURRENCY_CODE)) auth.setCurrency(properties.get(PROPERTY_CURRENCY_CODE).toString());//currency); if (properties.containsKey(PROPERTY_ERROR_CODE)) auth.setErrorNumber(properties.get(PROPERTY_ERROR_CODE).toString()); if (properties.containsKey(PROPERTY_ERROR_TEXT)) auth.setErrorText(properties.get(PROPERTY_ERROR_TEXT).toString()); if (properties.containsKey(PROPERTY_TOTAL_RESPONSE)) auth.setServerResponse(properties.get(PROPERTY_TOTAL_RESPONSE).toString()); auth.setTransactionType(authorizationType); auth.setCardNumber(encodedCardnumber); auth.setDate(IWTimestamp.RightNow().getDate()); if (parentDataPK != null) { try { auth.setParentID(((Integer) parentDataPK).intValue()); } catch (Exception e) { System.out.println("KortathjonustanCCCleint : could not set parentID : " + parentDataPK); } } auth.store(); } |
form.assignAddingSponsor(false); | public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getAuthorisedUser()) { return "noAccess"; } String reqpar = request.getParameter("delete"); if (reqpar != null) { return "delete"; } CalSvcI svci = form.fetchSvci(); boolean add = form.getAddingSponsor(); /** We are just updating from the current form values. */ BwSponsor sp = form.getSponsor(); if (!BwWebUtil.validateSponsor(sp, form.getErr())) { return "retry"; } /* if the sponsor exists use it otherwise add one. */ if (!add && (sp.getId() <= CalFacadeDefs.maxReservedSponsorId)) { // claim it doesn't exist form.getErr().emit("org.bedework.client.error.nosuchsponsor", sp.getId()); return "noSuchSponsor"; } boolean added = false; if (add) { added = svci.addSponsor(sp); } else { svci.replaceSponsor(sp); } updateAuthPrefs(form, null, sp, null, null); if (add) { if (added) { form.getMsg().emit("org.bedework.client.message.sponsor.added"); } else { form.getErr().emit("org.bedework.client.error.sponsor.alreadyexists"); } } else { form.getMsg().emit("org.bedework.client.message.sponsor.updated"); } return "continue"; } |
|
public IdeaView(Idea anIdea) { this(anIdea, true); | public IdeaView() { this(null); | public IdeaView(Idea anIdea) { this(anIdea, true); } |
paint(g, new Point(0, 0), this); | paint(g, new Point(0, 0), this, getAngle()); | public void paint(Graphics g) { paint(g, new Point(0, 0), this); } |
return new Vector(); | return new ArrayList(); | private Collection getCategoryCollection(int kind) { try { if (kind == publicEntity) { return calsvci.getPublicCategories(); } if (kind == ownersEntity) { return calsvci.getCategories(); } if (kind == editableEntity) { return calsvci.getEditableCategories(); } // Won't need this with 1.5 throw new Exception("Software error - bad kind " + kind); } catch (Throwable t) { if (debug) { t.printStackTrace(); } err.emit(t); return new Vector(); } } |
currentSubscriptions = new Vector(); | currentSubscriptions = new ArrayList(); | public Collection getCurrentSubscriptions() { if (currentSubscriptions == null) { currentSubscriptions = new Vector(); } return currentSubscriptions; } |
return new Vector(); | return new ArrayList(); | public Collection getInstanceOwners() { try { return fetchSvci().getInstanceOwners(); } catch (Throwable t) { err.emit(t); return new Vector(); } } |
return new Vector(); | return new ArrayList(); | private Collection getSponsorCollection(int kind) { try { if (kind == publicEntity) { return calsvci.getPublicSponsors(); } if (kind == ownersEntity) { return calsvci.getSponsors(); } if (kind == editableEntity) { return calsvci.getEditableSponsors(); } // Won't need this with 1.5 throw new Exception("Software error - bad kind " + kind); } catch (Throwable t) { if (debug) { t.printStackTrace(); } err.emit(t); return new Vector(); } } |
subscriptions = new Vector(); | subscriptions = new ArrayList(); | public Collection getSubscriptions() { if (subscriptions == null) { subscriptions = new Vector(); } return subscriptions; } |
sysStats = new Vector(); | sysStats = new ArrayList(); | public Collection getSysStats() { if (sysStats == null) { sysStats = new Vector(); } return sysStats; } |
String vsdate = viewStart.getDateTime().getDate().substring(0, 8); | String vsdate = viewStart.getDateTime().getDtval().substring(0, 8); if (debug) { action.logIt("vsdate=" + vsdate); } | public static void gotoDateView(BwCalAbstractAction action, BwActionForm form, String date, int newViewTypeI, boolean debug) throws Throwable { /* We get a new view if either the date changed or the view changed. */ boolean newView = false; if (debug) { action.logIt("ViewTypeI=" + newViewTypeI); } MyCalendarVO dt; TimeView tv = form.getCurTimeView(); if (newViewTypeI == BedeworkDefs.todayView) { // dt = new MyCalendarVO(new Date(System.currentTimeMillis())); dt = new MyCalendarVO(); newView = true; newViewTypeI = BedeworkDefs.dayView; } else if (date == null) { if (newViewTypeI == BedeworkDefs.dayView) { // selected specific day to display from personal event entry screen. dt = new MyCalendarVO(form.getViewStartDate().getDateTime()); newView = true; } else { if (debug) { action.logIt("No date supplied: go with current date"); } // Just stay here dt = tv.getCurDay(); } } else { if (debug) { action.logIt("Date=" + date + ": go with that"); } dt = new MyCalendarVO(CalFacadeUtil.fromISODate(date)); newView = true; } if ((newViewTypeI >= 0) && (newViewTypeI != form.getCurViewPeriod())) { // Change of view newView = true; } if (newView && (newViewTypeI < 0)) { newViewTypeI = form.getCurViewPeriod(); if (newViewTypeI < 0) { newViewTypeI = BedeworkDefs.defaultView; } } TimeDateComponents viewStart = form.getViewStartDate(); if (!newView) { /* See if we were given an explicit date as view start date components. If so we'll set a new view of the same period as the current. */ String vsdate = viewStart.getDateTime().getDate().substring(0, 8); if (!(vsdate.equals(form.getCurTimeView().getFirstDay().getDateDigits()))) { newView = true; newViewTypeI = form.getCurViewPeriod(); dt = new MyCalendarVO(CalFacadeUtil.fromISODate(vsdate)); } } if (newView) { form.setCurViewPeriod(newViewTypeI); form.setViewMcDate(dt); form.refreshIsNeeded(); } tv = form.getCurTimeView(); // dt = tv.getCurDay(); /** Set first day, month and year */ MyCalendarVO firstDay = tv.getFirstDay(); viewStart.setDay(firstDay.getTwoDigitDay()); viewStart.setMonth(firstDay.getTwoDigitMonth()); viewStart.setYear(firstDay.getFourDigitYear()); form.getEventStartDate().setDateTime(tv.getCurDay().getTime()); form.getEventEndDate().setDateTime(tv.getCurDay().getTime()); } |
String calSuiteName = getReqPar(request, "calSuite"); | String calSuiteName = getReqPar(request, "calSuiteName"); | public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "notFound"; } CalSvcI svci = form.fetchSvci(); BwCalendar cal = null; BwCalSuite calSuite = null; EventInfo ei = null; BwEvent ev = null; String rpar = getReqPar(request, "guid"); String calPath = getReqPar(request, "calPath"); if (rpar != null) { // Assume event ei = findEvent(request, form); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.client.error.nosuchevent"); return "doNothing"; } ev = ei.getEvent(); } else if (calPath != null) { // calendar cal = svci.getCalendar(calPath); if (cal == null) { form.getErr().emit("org.bedework.client.error.nosuchcalendar", calPath); return "notFound"; } } else { String calSuiteName = getReqPar(request, "calSuite"); if (calSuiteName == null) { // bogus request return "notFound"; } calSuite = svci.getCalSuite(calSuiteName); if (calSuite == null) { form.getErr().emit("org.bedework.client.error.nosuchcalendarsuite", calSuite); return "notFound"; } } String whoTypeStr = request.getParameter("whoType"); int whoType = -1; if (whoTypeStr == null) { whoType = Ace.whoTypeUser; } else if (whoTypeStr.equals("owner")) { whoType = Ace.whoTypeOwner; } else if (whoTypeStr.equals("user")) { whoType = Ace.whoTypeUser; } else if (whoTypeStr.equals("group")) { whoType = Ace.whoTypeGroup; form.getErr().emit("org.bedework.client.error.unimplemented"); return "error"; } else if (whoTypeStr.equals("unauth")) { whoType = Ace.whoTypeUnauthenticated; } else if (whoTypeStr.equals("other")) { whoType = Ace.whoTypeOther; } else { form.getErr().emit("org.bedework.client.error.badwhotype"); return "error"; } String who = request.getParameter("who"); if (who != null) { BwUser user = svci.findUser(who); if (user == null) { form.getErr().emit("org.bedework.client.error.usernotfound"); return "notFound"; } } else { who = null; } ArrayList aces = new ArrayList(); String how = getReqPar(request, "how"); if (how == null) { form.getErr().emit("org.bedework.client.error.nohowaccess"); return "error"; } char[] howchs = how.toCharArray(); for (int hi = 0; hi < howchs.length; hi++) { char howch = howchs[hi]; boolean found = false; for (int pi = 0; pi <= PrivilegeDefs.privMaxType; pi++) { if (howch == PrivilegeDefs.privEncoding[pi]) { aces.add(new Ace(who, false, whoType, Privileges.makePriv(pi))); found = true; break; } } if (!found) { form.getErr().emit("org.bedework.client.error.badhow"); return "error"; } } if (ev != null) { svci.changeAccess(ev, aces); //svci.updateEvent(ev); } else if (calSuite != null) { svci.changeAccess(calSuite, aces); } else { svci.changeAccess(cal, aces); //svci.updateCalendar(cal); } return "success"; } |
Graphics2D copy = (Graphics2D)g; | Graphics2D copy = (Graphics2D)g.create(); | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g; if (copy != null) { try { AffineTransform insetMove = AffineTransform.getTranslateInstance(x, y); copy.transform(insetMove); FontMetrics fm = copy.getFontMetrics(); copy.drawString(title, left+(width-left - right - fm.stringWidth(title))/2, (top+fm.getAscent())/2); } finally { copy.dispose(); } } } |
if (parentView.isRoot()) { previousAngle = views.get(views.size() - 1).getAngle() - 2 * Math.PI; } | private double getNewAngle(final IdeaView parentView, final IdeaView previousView, final IdeaView view, final IdeaView nextView) { final List<IdeaView> views = parentView.getSubViews(); final double v = view.getV(); double minDiffAngle = Math.PI / 2 / views.size(); double oldAngle = view.getAngle(); double newAngle = oldAngle + (view.getV() / view.getLength()); if (previousView != null) { double previousAngle = previousView.getAngle(); if (previousAngle > newAngle - minDiffAngle) { previousView.setAngle(newAngle - minDiffAngle); newAngle = previousAngle + minDiffAngle; double previousV = previousView.getV(); double diffV = v - previousV; if (diffV > 0) { view.setV(diffV); previousView.setV(-diffV); } else { view.setV(-diffV); previousView.setV(diffV); } } } else { double previousAngle = -Math.PI; if (parentView.isRoot()) { previousAngle = views.get(views.size() - 1).getAngle() - 2 * Math.PI; } if (previousAngle > newAngle - minDiffAngle) { newAngle = previousAngle + minDiffAngle; double previousV = 0.0; double diffV = v - previousV; if (diffV > 0) { view.setV(diffV); } else { view.setV(-diffV); } } } if (nextView != null) { double nextAngle = nextView.getAngle(); if (nextAngle < newAngle + minDiffAngle) { nextView.setAngle(newAngle + minDiffAngle); newAngle = nextAngle - minDiffAngle; double nextV = nextView.getV(); double diffV = 0.0; if (diffV > 0) { view.setV(-diffV); nextView.setV(diffV); } else { view.setV(diffV); nextView.setV(-diffV); } } } else { double nextAngle = Math.PI; if (parentView.isRoot()) { nextAngle = views.get(0).getAngle() + 2 * Math.PI; } if (nextAngle < newAngle + minDiffAngle) { newAngle = nextAngle - minDiffAngle; double nextV = 0.0; double diffV = 0.0; if (diffV > 0) { view.setV(-diffV); } else { view.setV(diffV); } } } return newAngle; } |
|
if (parentView.isRoot()) { nextAngle = views.get(0).getAngle() + 2 * Math.PI; } | private double getNewAngle(final IdeaView parentView, final IdeaView previousView, final IdeaView view, final IdeaView nextView) { final List<IdeaView> views = parentView.getSubViews(); final double v = view.getV(); double minDiffAngle = Math.PI / 2 / views.size(); double oldAngle = view.getAngle(); double newAngle = oldAngle + (view.getV() / view.getLength()); if (previousView != null) { double previousAngle = previousView.getAngle(); if (previousAngle > newAngle - minDiffAngle) { previousView.setAngle(newAngle - minDiffAngle); newAngle = previousAngle + minDiffAngle; double previousV = previousView.getV(); double diffV = v - previousV; if (diffV > 0) { view.setV(diffV); previousView.setV(-diffV); } else { view.setV(-diffV); previousView.setV(diffV); } } } else { double previousAngle = -Math.PI; if (parentView.isRoot()) { previousAngle = views.get(views.size() - 1).getAngle() - 2 * Math.PI; } if (previousAngle > newAngle - minDiffAngle) { newAngle = previousAngle + minDiffAngle; double previousV = 0.0; double diffV = v - previousV; if (diffV > 0) { view.setV(diffV); } else { view.setV(-diffV); } } } if (nextView != null) { double nextAngle = nextView.getAngle(); if (nextAngle < newAngle + minDiffAngle) { nextView.setAngle(newAngle + minDiffAngle); newAngle = nextAngle - minDiffAngle; double nextV = nextView.getV(); double diffV = 0.0; if (diffV > 0) { view.setV(-diffV); nextView.setV(diffV); } else { view.setV(diffV); nextView.setV(-diffV); } } } else { double nextAngle = Math.PI; if (parentView.isRoot()) { nextAngle = views.get(0).getAngle() + 2 * Math.PI; } if (nextAngle < newAngle + minDiffAngle) { newAngle = nextAngle - minDiffAngle; double nextV = 0.0; double diffV = 0.0; if (diffV > 0) { view.setV(-diffV); } else { view.setV(diffV); } } } return newAngle; } |
|
NodeList seisAttrNode = XMLUtil.evalNodeList(e, "seismogramAttr"); | NodeList seisAttrNode = XMLUtil.evalNodeList(e, "../seismogramAttr"); | public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { return (LocalSeismogramImpl)seismogramCache.get(name); } // end of if (seismogramCache.containsKey(name)) String urlString = "NONE"; NodeList nList = evalNodeList(config, "localSeismogram/seismogramAttr/property[name="+dquote+"Name"+dquote+ "]"+"[value="+dquote+name+dquote+"]"+"/../../data"); if(nList == null || (nList != null && nList.getLength() == 0)) { nList = getNoNameSeismogram(name); } if (nList != null && nList.getLength() != 0) { try { Node n = nList.item(0); if (n instanceof Element) { Element e = (Element)n; //System.out.println("**********************The name of the element is "+e.getTagName()); urlString = e.getAttribute("xlink:href"); if (urlString == null || urlString == "") { throw new MalformedURLException(name+" does not have an xlink:href attribute"); } // end of if (urlString == null || urlString == "") URL sacURL = new URL(base, urlString); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); //get the Seismogram Attributes from the xml .. only the data must // must be obtained fromt the SAC. NodeList seisAttrNode = XMLUtil.evalNodeList(e, "seismogramAttr"); if(seisAttrNode != null && seisAttrNode.getLength() != 0) { seis.setAttributes(XMLSeismogramAttr.getSeismogramAttr((Element)seisAttrNode.item(0))); } NodeList propList = evalNodeList(e, "property"); int numDSProps = 0; if (propList != null && propList.getLength() != 0) { numDSProps = nList.getLength(); } else { // no properties in dataset numDSProps = 0; } // end of else Property[] props = seis.getProperties(); Property[] newProps = new Property[1+props.length+numDSProps]; System.arraycopy(props, 0, newProps, 0, props.length); for (int i=0; i<propList.getLength(); i++) { Element propElement = (Element)propList.item(i); newProps[props.length+i] = new Property(xpath.eval(propElement, "name/text()").str(), xpath.eval(propElement, "value/text()").str()); } // end of for newProps[newProps.length-1] = new Property(seisNameKey, name); seis.setProperties(newProps); if (seis != null) { seismogramCache.put(name, seis); } // end of if (seis != null) return seis; } } catch (MalformedURLException e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } catch (Exception e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } // end of try-catch } return null; } |
seis.setAttributes(XMLSeismogramAttr.getSeismogramAttr((Element)seisAttrNode.item(0))); | SeismogramAttr seisAttr = XMLSeismogramAttr.getSeismogramAttr((Element)seisAttrNode.item(0)); logger.debug("The &&&&&&&&&&&&&&&&&&& chan_cdoe from dsml file is "+ ((SeismogramAttrImpl)seisAttr).getChannelID().channel_code); seis.setAttributes(seisAttr); logger.debug("The &&&&&&&&&&&&&&&&&&& chan_code after setting is "+ seis.getChannelID().channel_code); | public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { return (LocalSeismogramImpl)seismogramCache.get(name); } // end of if (seismogramCache.containsKey(name)) String urlString = "NONE"; NodeList nList = evalNodeList(config, "localSeismogram/seismogramAttr/property[name="+dquote+"Name"+dquote+ "]"+"[value="+dquote+name+dquote+"]"+"/../../data"); if(nList == null || (nList != null && nList.getLength() == 0)) { nList = getNoNameSeismogram(name); } if (nList != null && nList.getLength() != 0) { try { Node n = nList.item(0); if (n instanceof Element) { Element e = (Element)n; //System.out.println("**********************The name of the element is "+e.getTagName()); urlString = e.getAttribute("xlink:href"); if (urlString == null || urlString == "") { throw new MalformedURLException(name+" does not have an xlink:href attribute"); } // end of if (urlString == null || urlString == "") URL sacURL = new URL(base, urlString); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); //get the Seismogram Attributes from the xml .. only the data must // must be obtained fromt the SAC. NodeList seisAttrNode = XMLUtil.evalNodeList(e, "seismogramAttr"); if(seisAttrNode != null && seisAttrNode.getLength() != 0) { seis.setAttributes(XMLSeismogramAttr.getSeismogramAttr((Element)seisAttrNode.item(0))); } NodeList propList = evalNodeList(e, "property"); int numDSProps = 0; if (propList != null && propList.getLength() != 0) { numDSProps = nList.getLength(); } else { // no properties in dataset numDSProps = 0; } // end of else Property[] props = seis.getProperties(); Property[] newProps = new Property[1+props.length+numDSProps]; System.arraycopy(props, 0, newProps, 0, props.length); for (int i=0; i<propList.getLength(); i++) { Element propElement = (Element)propList.item(i); newProps[props.length+i] = new Property(xpath.eval(propElement, "name/text()").str(), xpath.eval(propElement, "value/text()").str()); } // end of for newProps[newProps.length-1] = new Property(seisNameKey, name); seis.setProperties(newProps); if (seis != null) { seismogramCache.put(name, seis); } // end of if (seis != null) return seis; } } catch (MalformedURLException e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } catch (Exception e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } // end of try-catch } return null; } |
boolean taggedStart = false; boolean annotations = false; | if (annotations) { tagStart(sectionEventAnnotations); } else { tagStart(sectionEvents); } | public void dumpSection(Iterator it) throws Throwable { boolean taggedStart = false; boolean annotations = false; while (it.hasNext()) { BwEvent e = (BwEvent)it.next(); if (!taggedStart) { if (e instanceof BwEventAnnotation) { tagStart(sectionEventAnnotations); annotations = true; } else { tagStart(sectionEvents); } taggedStart = true; } dumpEvent(e); } if (annotations) { tagEnd(sectionEventAnnotations); } else { tagEnd(sectionEvents); } } |
BwEvent e = (BwEvent)it.next(); if (!taggedStart) { if (e instanceof BwEventAnnotation) { tagStart(sectionEventAnnotations); annotations = true; } else { tagStart(sectionEvents); } taggedStart = true; } dumpEvent(e); | dumpEvent((BwEvent)it.next()); | public void dumpSection(Iterator it) throws Throwable { boolean taggedStart = false; boolean annotations = false; while (it.hasNext()) { BwEvent e = (BwEvent)it.next(); if (!taggedStart) { if (e instanceof BwEventAnnotation) { tagStart(sectionEventAnnotations); annotations = true; } else { tagStart(sectionEvents); } taggedStart = true; } dumpEvent(e); } if (annotations) { tagEnd(sectionEventAnnotations); } else { tagEnd(sectionEvents); } } |
JDBCStation jdbcStation = new JDBCStation(conn); | public static void main(String[] args) throws SQLException, IOException { BasicConfigurator.configure(); Properties props = Initializer.loadProperties(args); ConnectionCreator connCreator = new ConnectionCreator(props); Connection conn = connCreator.createConnection(); JDBCSeismogramFiles jdbcSeisFile = new JDBCSeismogramFiles(conn); JDBCStation jdbcStation = new JDBCStation(conn); boolean verbose = false; for(int i = 1; i < args.length; i++) { if(args[i].equals("-h")) { printHelp(); } } for(int i = 1; i < args.length; i++) { if(args[i].equals("-v")) { verbose = true; System.out.println(); System.out.println("/---------------Station Code Updater---"); System.out.println(); System.out.println("Verbose messages: ON"); } } for(int i = 1; i < args.length - 1; i++) { if(verbose) { if(args[i].equals("-props")) { String propFileLocation = args[i + 1]; File file = new File(propFileLocation); System.out.println("Properties file location: " + file.getCanonicalPath()); } } } if(verbose) { System.out.println(); System.out.println("\\------------------------------------"); } if(args.length > 0) { String oldName = args[args.length - 2]; String newName = args[args.length - 1]; if(verbose) { int numOld = numOfStationCodes(jdbcStation, oldName); System.out.println(); System.out.println("Updating " + numOld + " instances of " + oldName + " to " + newName + "."); } jdbcSeisFile.updateStationCode(oldName, newName); if(verbose) { int numNew = numOfStationCodes(jdbcStation, newName); System.out.println("Now " + numNew + " instances of " + newName + "."); System.out.println(); System.out.println("Update complete."); } } } |
|
String oldName = args[args.length - 2]; String newName = args[args.length - 1]; if(verbose) { int numOld = numOfStationCodes(jdbcStation, oldName); System.out.println(); System.out.println("Updating " + numOld + " instances of " + oldName + " to " + newName + "."); } jdbcSeisFile.updateStationCode(oldName, newName); if(verbose) { int numNew = numOfStationCodes(jdbcStation, newName); System.out.println("Now " + numNew + " instances of " + newName + "."); System.out.println(); System.out.println("Update complete."); } | jdbcSeisFile.populateStationName(); | public static void main(String[] args) throws SQLException, IOException { BasicConfigurator.configure(); Properties props = Initializer.loadProperties(args); ConnectionCreator connCreator = new ConnectionCreator(props); Connection conn = connCreator.createConnection(); JDBCSeismogramFiles jdbcSeisFile = new JDBCSeismogramFiles(conn); JDBCStation jdbcStation = new JDBCStation(conn); boolean verbose = false; for(int i = 1; i < args.length; i++) { if(args[i].equals("-h")) { printHelp(); } } for(int i = 1; i < args.length; i++) { if(args[i].equals("-v")) { verbose = true; System.out.println(); System.out.println("/---------------Station Code Updater---"); System.out.println(); System.out.println("Verbose messages: ON"); } } for(int i = 1; i < args.length - 1; i++) { if(verbose) { if(args[i].equals("-props")) { String propFileLocation = args[i + 1]; File file = new File(propFileLocation); System.out.println("Properties file location: " + file.getCanonicalPath()); } } } if(verbose) { System.out.println(); System.out.println("\\------------------------------------"); } if(args.length > 0) { String oldName = args[args.length - 2]; String newName = args[args.length - 1]; if(verbose) { int numOld = numOfStationCodes(jdbcStation, oldName); System.out.println(); System.out.println("Updating " + numOld + " instances of " + oldName + " to " + newName + "."); } jdbcSeisFile.updateStationCode(oldName, newName); if(verbose) { int numNew = numOfStationCodes(jdbcStation, newName); System.out.println("Now " + numNew + " instances of " + newName + "."); System.out.println(); System.out.println("Update complete."); } } } |
} else if (path.endsWith(".rdo")) { | } else if (path.endsWith(".do")) { | public int doStartTag() throws JspException { if (!PortletServlet.isPortletRequest(pageContext.getRequest())) { return super.doStartTag(); } String urlStr = null; BodyContent bodyContent = pageContext.pushBody(); try { super.doStartTag(); URL url = new URL(bodyContent.getString()); String path = url.getPath(); if (path.endsWith(".rdo")) { setRenderURL("true"); } else if (path.endsWith(".rdo")) { setActionURL("true"); } /* We want a context relative url */ urlStr = url.getFile(); //System.out.println("RRRRRRRRRRRRRRRRRUrlStr = " + urlStr); /* Drop the context */ int pos = urlStr.indexOf('/'); if (pos > 0) { urlStr = urlStr.substring(pos); } urlStr = TagsSupport.getURL(pageContext, urlStr, urlType); /* remove embedded anchor because calendar xsl stylesheet * adds extra parameters later during transformation */ pos = urlStr.indexOf('#'); if (pos > -1) { urlStr = urlStr.substring(0, pos); } /* Remove bedework dummy request parameter - * it's an encoded form of ?b=de */ urlStr = urlStr.replaceAll(bedeworkDummyPar, ""); //Generate valid xml markup for transformationthrow new urlStr = urlStr.replaceAll("&", "&"); //System.out.println("RRRRRRRRRRRRRRRRRUrlStr = " + urlStr); } catch (MalformedURLException mue) { throw new JspException(mue); } finally { pageContext.popBody(); } TagUtils.getInstance().write(pageContext, urlStr); return (SKIP_BODY); } |
final JFileChooser fc = new JFileChooser(); String extensions[] = new String[1]; extensions[0] = "pdf"; fc.setFileFilter(new FileNameFilter(extensions)); fc.setDialogTitle("SAVE as PDF"); fc.setSelectedFile(new File("output.pdf")); int returnVal = fc.showSaveDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); String fileName = file.getAbsolutePath(); return file.getAbsolutePath(); } else { } return null; | final JFileChooser fc = new JFileChooser(); String extensions[] = {"pdf"}; fc.setFileFilter(new FileNameFilter(extensions)); fc.setDialogTitle("Save as PDF"); fc.setSelectedFile(new File("output.pdf")); int returnVal = fc.showSaveDialog(display); if (returnVal == JFileChooser.APPROVE_OPTION) { return fc.getSelectedFile().getAbsolutePath(); } return null; | private String chooseOutputFile() { final JFileChooser fc = new JFileChooser(); String extensions[] = new String[1]; extensions[0] = "pdf"; fc.setFileFilter(new FileNameFilter(extensions)); fc.setDialogTitle("SAVE as PDF"); fc.setSelectedFile(new File("output.pdf")); int returnVal = fc.showSaveDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); String fileName = file.getAbsolutePath(); return file.getAbsolutePath(); } else { //log.append("Open command cancelled by user."); } return null; } |
if (display != null) { if (display instanceof VerticalSeismogramDisplay) { verticleDisplays = ((VerticalSeismogramDisplay)display).getDisplays(); if (verticleDisplays == null) return; if (verticleDisplays.size() == 0) { return; | if (display != null) { if (display instanceof VerticalSeismogramDisplay) { basicDisplays = ((VerticalSeismogramDisplay)display).getDisplays(); if (basicDisplays == null) return; if (basicDisplays.size() == 0) { return; } } getImagesPerPage(basicDisplays.size()); if(seisPerPageSet){ String tmp = chooseOutputFile(); if (tmp != null) { createPDF(tmp); } } | public void createPDF() { if (display != null) { if (display instanceof VerticalSeismogramDisplay) { verticleDisplays = ((VerticalSeismogramDisplay)display).getDisplays(); if (verticleDisplays == null) return; if (verticleDisplays.size() == 0) { return; } } init(verticleDisplays.size()); String tmp = this.chooseOutputFile(); if (tmp == null) { createPDF("default.pdf"); } else { createPDF(tmp); } } } |
} init(verticleDisplays.size()); String tmp = this.chooseOutputFile(); if (tmp == null) { createPDF("default.pdf"); } else { createPDF(tmp); } | public void createPDF() { if (display != null) { if (display instanceof VerticalSeismogramDisplay) { verticleDisplays = ((VerticalSeismogramDisplay)display).getDisplays(); if (verticleDisplays == null) return; if (verticleDisplays.size() == 0) { return; } } init(verticleDisplays.size()); String tmp = this.chooseOutputFile(); if (tmp == null) { createPDF("default.pdf"); } else { createPDF(tmp); } } } |
|
} | public void createPDF() { if (display != null) { if (display instanceof VerticalSeismogramDisplay) { verticleDisplays = ((VerticalSeismogramDisplay)display).getDisplays(); if (verticleDisplays == null) return; if (verticleDisplays.size() == 0) { return; } } init(verticleDisplays.size()); String tmp = this.chooseOutputFile(); if (tmp == null) { createPDF("default.pdf"); } else { createPDF(tmp); } } } |
|
int currentNumber = ((Integer)options.getSelectedItem()).intValue(); if(currentNumber < 0){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must be greater than 0", "Selected Too Few", JOptionPane.WARNING_MESSAGE); }else if(currentNumber > numOfSeis){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must less than " + (numOfSeis + 1), "Selected Too Many", JOptionPane.WARNING_MESSAGE); }else{ setSeisPerPage(currentNumber); dialog.dispose(); | int currentNumber = ((Integer)options.getSelectedItem()).intValue(); if(currentNumber < 0){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must be greater than 0", "Selected Too Few", JOptionPane.WARNING_MESSAGE); }else if(currentNumber > numOfSeis){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must less than " + (numOfSeis + 1), "Selected Too Many", JOptionPane.WARNING_MESSAGE); }else{ setSeisPerPage(currentNumber); dialog.dispose(); } | public void actionPerformed(ActionEvent e){ int currentNumber = ((Integer)options.getSelectedItem()).intValue(); if(currentNumber < 0){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must be greater than 0", "Selected Too Few", JOptionPane.WARNING_MESSAGE); }else if(currentNumber > numOfSeis){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must less than " + (numOfSeis + 1), "Selected Too Many", JOptionPane.WARNING_MESSAGE); }else{ setSeisPerPage(currentNumber); dialog.dispose(); } } |
} | public void actionPerformed(ActionEvent e){ int currentNumber = ((Integer)options.getSelectedItem()).intValue(); if(currentNumber < 0){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must be greater than 0", "Selected Too Few", JOptionPane.WARNING_MESSAGE); }else if(currentNumber > numOfSeis){ JOptionPane.showMessageDialog(null, "The number of seismograms selected must less than " + (numOfSeis + 1), "Selected Too Many", JOptionPane.WARNING_MESSAGE); }else{ setSeisPerPage(currentNumber); dialog.dispose(); } } |
|
setSeisPerPage(-1); dialog.dispose(); } | dialog.dispose(); } | public void actionPerformed(ActionEvent e){ setSeisPerPage(-1); dialog.dispose(); } |
imagesPerPage = num; | seisPerPageSet = true; imagesPerPage = num; | private void setSeisPerPage(int num) { imagesPerPage = num; } |
sb.append("name="); | sb.append(", name="); | public String toString() { StringBuffer sb = new StringBuffer("BwCalendar{"); toStringSegment(sb); sb.append("name="); sb.append(String.valueOf(getName())); sb.append(", path="); sb.append(String.valueOf(getPath())); sb.append(", summary="); sb.append(String.valueOf(getSummary())); sb.append(", description="); sb.append(String.valueOf(getDescription())); sb.append(", mailListId="); sb.append(String.valueOf(getMailListId())); sb.append(", calendarCollection="); sb.append(String.valueOf(getCalendarCollection())); sb.append(")"); return sb.toString(); } |
if (getCurrentAccess() != null) { sb.append(", currentAccess="); sb.append(getCurrentAccess()); } sb.append("}"); | public String toString() { StringBuffer sb = new StringBuffer("BwCalendar{"); toStringSegment(sb); sb.append("name="); sb.append(String.valueOf(getName())); sb.append(", path="); sb.append(String.valueOf(getPath())); sb.append(", summary="); sb.append(String.valueOf(getSummary())); sb.append(", description="); sb.append(String.valueOf(getDescription())); sb.append(", mailListId="); sb.append(String.valueOf(getMailListId())); sb.append(", calendarCollection="); sb.append(String.valueOf(getCalendarCollection())); sb.append(")"); return sb.toString(); } |
|
CalSvcIPars pars = new CalSvcIPars(account, UserAuth.superUser, | CalSvcIPars pars = new CalSvcIPars(account, | private void init() throws Throwable { svci = new CalSvc(); CalSvcIPars pars = new CalSvcIPars(account, UserAuth.superUser, account, null, // XXX needs envPrefix true, // public false, // caldav null, // synchId debug); svci.init(pars); } |
fail("Expected IllegalArgumentException on getUserAttributes(String null)"); | fail("Expected IllegalArgumentException on getUserAttributes((Map)null)"); | public void testNullSeed() { IPersonAttributeDao dao = getPersonAttributeDaoInstance(); Map nullMap = null; try { dao.getUserAttributes(nullMap); } catch (IllegalArgumentException iae) { // good, as expected return; } fail("Expected IllegalArgumentException on getUserAttributes(String null)"); } |
fail("Expected IllegalArgumentException on getUserAttributes(String null)"); | fail("Expected IllegalArgumentException on getUserAttributes((String)null)"); | public void testNullUid() { IPersonAttributeDao dao = getPersonAttributeDaoInstance(); String nullString = null; try { dao.getUserAttributes(nullString); } catch (IllegalArgumentException iae) { // good, as expected return; } fail("Expected IllegalArgumentException on getUserAttributes(String null)"); } |
public Vector getParamFilters() { | public Collection getParamFilters() { | public Vector getParamFilters() { if (paramFilters == null) { paramFilters = new Vector(); } return paramFilters; } |
paramFilters = new Vector(); | paramFilters = new ArrayList(); | public Vector getParamFilters() { if (paramFilters == null) { paramFilters = new Vector(); } return paramFilters; } |
} else { ok = BwWebUtil.validateEvent(svci, event, true, err); | } else if (!BwWebUtil.validateEvent(svci, event, true, err)) { ok = false; | private boolean validateEvent(PEActionForm form, CalSvcI svci, BwEvent event, MessageEmit err) throws Throwable { boolean ok = validateEventCategory(form, svci, event, err); if (!validateEventSponsor(form, svci, event, err)) { ok = false; } if (!validateEventLocation(form, svci, event, err)) { ok = false; } if (!validateEventCalendar(form, svci, event, err)) { ok = false; } if (!form.getEventDates().updateEvent(event, svci.getTimezones())) { ok = false; } else { ok = BwWebUtil.validateEvent(svci, event, true, // ENUM descriptionRequired err); } return ok; } |
String appName = env.getAppProperty("app.name"); String appRoot = env.getAppProperty("app.root"); | String appName = env.getAppProperty("name"); String appRoot = env.getAppProperty("root"); | public void setup(HttpServletRequest request, ActionForm form, MessageResources messages) throws Throwable { BwSession s = BwWebUtil.getState(request); if (s != null) { } else { CalEnv env = getEnv(form); String appName = env.getAppProperty("app.name"); String appRoot = env.getAppProperty("app.root"); s = new BwSessionImpl(form.getCurrentUser(), appRoot, appName, form.getPresentationState(), messages, form.getSchemeHostPort(), debug); BwWebUtil.setState(request, s); } } |
return AGSymbol.alloc(javaToAmbientTalkSelector(jSelector).replaceFirst(JavaInterfaceAdaptor._BASE_PREFIX_, "")); | if (jSelector.startsWith(JavaInterfaceAdaptor._BGET_PREFIX_)) { return downFieldName(stripPrefix(jSelector, JavaInterfaceAdaptor._BGET_PREFIX_)); } else if (jSelector.startsWith(JavaInterfaceAdaptor._BSET_PREFIX_)) { return downFieldName(stripPrefix(jSelector, JavaInterfaceAdaptor._BSET_PREFIX_)); } else if (jSelector.startsWith(JavaInterfaceAdaptor._BASE_PREFIX_)) { return downSelector(stripPrefix(jSelector, JavaInterfaceAdaptor._BASE_PREFIX_)); } else { throw new XIllegalArgument("Reflection.downBaseLevelSelector was asked to down a non-base level selector: " + jSelector); } | public static final ATSymbol downBaseLevelSelector(String jSelector) throws NATException { return AGSymbol.alloc(javaToAmbientTalkSelector(jSelector).replaceFirst(JavaInterfaceAdaptor._BASE_PREFIX_, "")); } |
return AGSymbol.alloc(javaToAmbientTalkSelector(jSelector).replaceFirst(JavaInterfaceAdaptor._META_PREFIX_, "")); | if (jSelector.startsWith(JavaInterfaceAdaptor._BGET_PREFIX_)) { return downFieldName(stripPrefix(jSelector, JavaInterfaceAdaptor._BGET_PREFIX_)); } else if (jSelector.startsWith(JavaInterfaceAdaptor._BSET_PREFIX_)) { return downFieldName(stripPrefix(jSelector, JavaInterfaceAdaptor._BSET_PREFIX_)); } else if (jSelector.startsWith(JavaInterfaceAdaptor._BASE_PREFIX_)) { return downSelector(stripPrefix(jSelector, JavaInterfaceAdaptor._BASE_PREFIX_)); } else { throw new XIllegalArgument("Reflection.downBaseLevelSelector was asked to down a non-base level selector: " + jSelector); } | public static final ATSymbol downMetaLevelSelector(String jSelector) throws NATException { return AGSymbol.alloc(javaToAmbientTalkSelector(jSelector).replaceFirst(JavaInterfaceAdaptor._META_PREFIX_, "")); } |
String nam = atSelector.getText().asNativeText().javaValue; | String nam = atSelector.base_getText().asNativeText().javaValue; | public static final String upSelector(ATSymbol atSelector) throws NATException { // : -> _ String nam = atSelector.getText().asNativeText().javaValue; nam = nam.replaceAll(":", "_"); // operator symbol -> _op{code}_ Matcher m = symbol.matcher(nam); StringBuffer sb = new StringBuffer(); while (m.find()) { // find every occurence of a non-word character and convert it into a symbol String oprCode = symbol2oprCode(m.group(0)); // only add the _op prefix and _ postfix if the code has been found... m.appendReplacement(sb, (oprCode.length() == 3) ? "_op" + oprCode + "_" : oprCode); } m.appendTail(sb); return sb.toString(); } |
if (Main.getMain().getMode() >= Main.MODE_IN_GAME) { Main.getNetworkConnection().writeMessage("LV;"); } | public void doAction() { if (Main.getMain().getMode() >= Main.MODE_IN_GAME) { Main.getNetworkConnection().writeMessage("LV;"); } Main.getNetworkConnection().writeMessage("SG;" + SerializedData.getSerializedData().getMaxPlayerCount()); } |
|
if (syspars == null) { sess.namedQuery("getSystemPars"); sess.setString("name", getSystemName()); syspars = (BwSystem)sess.getUnique(); if (syspars == null) { throw new CalFacadeException("No system parameters with name " + getSystemName()); } if (debug) { trace("Read system parameters: " + syspars); } } return syspars; | return getSyspars(getSystemName()); | public BwSystem getSyspars() throws CalFacadeException { if (syspars == null) { sess.namedQuery("getSystemPars"); sess.setString("name", getSystemName()); syspars = (BwSystem)sess.getUnique(); if (syspars == null) { throw new CalFacadeException("No system parameters with name " + getSystemName()); } if (debug) { trace("Read system parameters: " + syspars); } } return syspars; } |
int i = table.getSelectedRow(); int j = table.getSelectedColumn(); String arg = (String)table.getCellEditor(i, j).getCellEditorValue(); model.args.set(i, arg); model.fireTableCellUpdated(i, j); | int row = table.getSelectedRow(); String arg = (String)table.getCellEditor(row, 1).getCellEditorValue(); model.updateArg(row, arg); | public LoadPanel() { super(new GridLayout(1, 0)); setBorder(new TitledBorder(Messages.getString("ModuleAutoStartConfigurationPanel.START_AUTOMATICALLY") +":")); //$NON-NLS-1$ //$NON-NLS-2$ final JTable table = new JTable(model); DefaultCellEditor dce = new DefaultCellEditor(new JTextField()); dce.addCellEditorListener(new CellEditorListener() { public void editingCanceled(ChangeEvent arg0) { } public void editingStopped(ChangeEvent arg0) { int i = table.getSelectedRow(); int j = table.getSelectedColumn(); String arg = (String)table.getCellEditor(i, j).getCellEditorValue(); model.args.set(i, arg); model.fireTableCellUpdated(i, j); } }); table.setDefaultEditor(String.class, dce); table.setCellEditor(dce); table.setToolTipText(Messages.getString("ModuleAutoStartConfigurationPanel.DOUBLE_CLICK_TO_MODIFY_ARGUMENTS")); //$NON-NLS-1$ final JPopupMenu rightClickMenu = new JPopupMenu(); JMenuItem editArgsItem = new JMenuItem(Messages.getString("ModuleAutoStartConfigurationPanel.EDIT_ARGUMENTS")); //$NON-NLS-1$ editArgsItem.setToolTipText(Messages.getString("ModuleAutoStartConfigurationPanel.ARGUMENTS_ARE_GIVEN_TO_MODULE")); //$NON-NLS-1$ editArgsItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int[] selected = table.getSelectedRows(); if (selected.length > 0) { table.editCellAt(selected[0], 1); } } }); rightClickMenu.add(editArgsItem); JMenuItem removeItem = new JMenuItem(Messages.getString("ModuleAutoStartConfigurationPanel.REMOVE")); //$NON-NLS-1$ removeItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int[] selected = table.getSelectedRows(); for (int i = selected.length - 1; i >= 0; i--) { model.remove(selected[i]); } } }); rightClickMenu.add(removeItem); table.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { if (e.getClickCount() == 1 && e.getButton() == MouseEvent.BUTTON3 && table.getSelectedRow() != -1) { rightClickMenu.show(table, e.getX(), e.getY()); } else if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) { int selected = table.getSelectedRow(); if (selected != -1) { table.editCellAt(selected, 1); } } } public void mouseReleased(MouseEvent e) { } }); JScrollPane scrollPane = new JScrollPane(table); add(scrollPane); } |
int i = table.getSelectedRow(); int j = table.getSelectedColumn(); String arg = (String)table.getCellEditor(i, j).getCellEditorValue(); model.args.set(i, arg); model.fireTableCellUpdated(i, j); | int row = table.getSelectedRow(); String arg = (String)table.getCellEditor(row, 1).getCellEditorValue(); model.updateArg(row, arg); | public void editingStopped(ChangeEvent arg0) { int i = table.getSelectedRow(); int j = table.getSelectedColumn(); String arg = (String)table.getCellEditor(i, j).getCellEditorValue(); model.args.set(i, arg); model.fireTableCellUpdated(i, j); } |
if (getPath() == null) { return null; } | public String getEncodedPath() throws CalFacadeException { try { return URLEncoder.encode(getPath(), "UTF-8"); } catch (Throwable t) { throw new CalFacadeException(t); } } |
|
TimeScaleCalc (int totalPixels, MicroSecondDate beginTime, MicroSecondDate endTime, TimeConfigRegistrar tr){ if (endTime.before(beginTime)) { throw new IllegalArgumentException("endTime must be after beginTime, "+beginTime.toString()+" "+endTime.toString()); } | TimeScaleCalc (int totalPixels, TimeConfigRegistrar tr){ | TimeScaleCalc (int totalPixels, MicroSecondDate beginTime, MicroSecondDate endTime, TimeConfigRegistrar tr){ if (endTime.before(beginTime)) { throw new IllegalArgumentException("endTime must be after beginTime, "+beginTime.toString()+" "+endTime.toString()); } this.totalPixels = totalPixels; setTimes(); calculateTicks(); } |
calculateTicks(); | TimeScaleCalc (int totalPixels, MicroSecondDate beginTime, MicroSecondDate endTime, TimeConfigRegistrar tr){ if (endTime.before(beginTime)) { throw new IllegalArgumentException("endTime must be after beginTime, "+beginTime.toString()+" "+endTime.toString()); } this.totalPixels = totalPixels; setTimes(); calculateTicks(); } |
|
LinkedList tmp = new LinkedList(dssDataListeners); | LinkedList tmp; synchronized(dssDataListeners){ tmp = new LinkedList(dssDataListeners); } | protected void fireNewDataEvent(SeisDataChangeEvent event) { // use temp array to avoid concurrentModificationException LinkedList tmp = new LinkedList(dssDataListeners); Iterator iterator = tmp.iterator(); while(iterator.hasNext()) { SeisDataChangeListener dssDataListener = (SeisDataChangeListener) iterator.next(); dssDataListener.pushData(event); } } |
this.hAmpConfigRegistrar = hAmpConfigRegistrar; this.vAmpConfigRegistrar = vAmpConfigRegistrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); | public ParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar, Color color, boolean advancedOption) { this.hAmpConfigRegistrar = hAmpConfigRegistrar; this.vAmpConfigRegistrar = vAmpConfigRegistrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); if(timeConfigRegistrar != null) { timeConfigRegistrar.addTimeSyncListener(this); } view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, new UnitRangeImpl(-100, 100, UnitImpl.COUNT) ); vAmpScaleMap = new AmpScaleMapper(50, 4, new UnitRangeImpl(-100, 100, UnitImpl.COUNT) ); scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder("X - axis Title"); vTitleBorder = new LeftTitleBorder("Y - axis Title"); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), // hTitleBorder), BorderFactory.createCompoundBorder(hTitleBorder, vTitleBorder)), BorderFactory.createCompoundBorder( scaleBorder, BorderFactory.createLoweredBevelBorder())) ); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); // radioPanel.addContainerListener(new ContainerAdapter() {// public void componentAdded(ContainerEvent e) {// System.out.println("******************************* COMPONENT is ADDED");// resize();// }// public void componentRemove(ContainerEvent e) {// resize();// }// }); updateTimeRange(); ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(hseis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, advancedOption, true, this); t.execute(); } |
|
radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); | JFrame displayFrame = new JFrame(); JPanel informationPanel = new JPanel(); String message = " Please Wait ....For the Particle Motion Window"; JLabel jLabel = new JLabel(message); JTextArea textArea = new JTextArea(); informationPanel.setLayout(new BorderLayout()); informationPanel.add(textArea, BorderLayout.CENTER); informationPanel.setSize(new java.awt.Dimension(500, 300)); | public ParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar, Color color, boolean advancedOption) { this.hAmpConfigRegistrar = hAmpConfigRegistrar; this.vAmpConfigRegistrar = vAmpConfigRegistrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); if(timeConfigRegistrar != null) { timeConfigRegistrar.addTimeSyncListener(this); } view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, new UnitRangeImpl(-100, 100, UnitImpl.COUNT) ); vAmpScaleMap = new AmpScaleMapper(50, 4, new UnitRangeImpl(-100, 100, UnitImpl.COUNT) ); scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder("X - axis Title"); vTitleBorder = new LeftTitleBorder("Y - axis Title"); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), // hTitleBorder), BorderFactory.createCompoundBorder(hTitleBorder, vTitleBorder)), BorderFactory.createCompoundBorder( scaleBorder, BorderFactory.createLoweredBevelBorder())) ); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); // radioPanel.addContainerListener(new ContainerAdapter() {// public void componentAdded(ContainerEvent e) {// System.out.println("******************************* COMPONENT is ADDED");// resize();// }// public void componentRemove(ContainerEvent e) {// resize();// }// }); updateTimeRange(); ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(hseis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, advancedOption, true, this); t.execute(); } |
if(timeConfigRegistrar != null) { timeConfigRegistrar.addTimeSyncListener(this); } | displayFrame.getContentPane().add(informationPanel); displayFrame.setSize(new java.awt.Dimension(500, 300)); displayFrame.pack(); displayFrame.show(); try { Thread.sleep(5000); }catch(Exception e) {} createGUI(timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar); | public ParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar, Color color, boolean advancedOption) { this.hAmpConfigRegistrar = hAmpConfigRegistrar; this.vAmpConfigRegistrar = vAmpConfigRegistrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); if(timeConfigRegistrar != null) { timeConfigRegistrar.addTimeSyncListener(this); } view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, new UnitRangeImpl(-100, 100, UnitImpl.COUNT) ); vAmpScaleMap = new AmpScaleMapper(50, 4, new UnitRangeImpl(-100, 100, UnitImpl.COUNT) ); scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder("X - axis Title"); vTitleBorder = new LeftTitleBorder("Y - axis Title"); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), // hTitleBorder), BorderFactory.createCompoundBorder(hTitleBorder, vTitleBorder)), BorderFactory.createCompoundBorder( scaleBorder, BorderFactory.createLoweredBevelBorder())) ); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); // radioPanel.addContainerListener(new ContainerAdapter() {// public void componentAdded(ContainerEvent e) {// System.out.println("******************************* COMPONENT is ADDED");// resize();// }// public void componentRemove(ContainerEvent e) {// resize();// }// }); updateTimeRange(); ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(hseis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, advancedOption, true, this); t.execute(); } |
view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, new UnitRangeImpl(-100, 100, UnitImpl.COUNT) ); vAmpScaleMap = new AmpScaleMapper(50, 4, new UnitRangeImpl(-100, 100, UnitImpl.COUNT) ); scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder("X - axis Title"); vTitleBorder = new LeftTitleBorder("Y - axis Title"); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), BorderFactory.createCompoundBorder(hTitleBorder, vTitleBorder)), BorderFactory.createCompoundBorder( scaleBorder, BorderFactory.createLoweredBevelBorder())) ); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); updateTimeRange(); | public ParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar, Color color, boolean advancedOption) { this.hAmpConfigRegistrar = hAmpConfigRegistrar; this.vAmpConfigRegistrar = vAmpConfigRegistrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); if(timeConfigRegistrar != null) { timeConfigRegistrar.addTimeSyncListener(this); } view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, new UnitRangeImpl(-100, 100, UnitImpl.COUNT) ); vAmpScaleMap = new AmpScaleMapper(50, 4, new UnitRangeImpl(-100, 100, UnitImpl.COUNT) ); scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder("X - axis Title"); vTitleBorder = new LeftTitleBorder("Y - axis Title"); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), // hTitleBorder), BorderFactory.createCompoundBorder(hTitleBorder, vTitleBorder)), BorderFactory.createCompoundBorder( scaleBorder, BorderFactory.createLoweredBevelBorder())) ); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); // radioPanel.addContainerListener(new ContainerAdapter() {// public void componentAdded(ContainerEvent e) {// System.out.println("******************************* COMPONENT is ADDED");// resize();// }// public void componentRemove(ContainerEvent e) {// resize();// }// }); updateTimeRange(); ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(hseis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, advancedOption, true, this); t.execute(); } |
|
displayFrame.dispose(); | public ParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar, Color color, boolean advancedOption) { this.hAmpConfigRegistrar = hAmpConfigRegistrar; this.vAmpConfigRegistrar = vAmpConfigRegistrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); if(timeConfigRegistrar != null) { timeConfigRegistrar.addTimeSyncListener(this); } view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, new UnitRangeImpl(-100, 100, UnitImpl.COUNT) ); vAmpScaleMap = new AmpScaleMapper(50, 4, new UnitRangeImpl(-100, 100, UnitImpl.COUNT) ); scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder("X - axis Title"); vTitleBorder = new LeftTitleBorder("Y - axis Title"); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), // hTitleBorder), BorderFactory.createCompoundBorder(hTitleBorder, vTitleBorder)), BorderFactory.createCompoundBorder( scaleBorder, BorderFactory.createLoweredBevelBorder())) ); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); // radioPanel.addContainerListener(new ContainerAdapter() {// public void componentAdded(ContainerEvent e) {// System.out.println("******************************* COMPONENT is ADDED");// resize();// }// public void componentRemove(ContainerEvent e) {// resize();// }// }); updateTimeRange(); ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(hseis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, advancedOption, true, this); t.execute(); } |
|
public void changeAccess(Object o, Collection aces) throws CalFacadeException { getCal().changeAccess(o, aces); | public void changeAccess(BwShareableDbentity ent, Collection aces) throws CalFacadeException { getCal().changeAccess(ent, aces); | public void changeAccess(Object o, Collection aces) throws CalFacadeException { getCal().changeAccess(o, aces); } |
public Collection getAces(Object o) throws CalFacadeException { return getCal().getAces(o); | public Collection getAces(BwShareableDbentity ent) throws CalFacadeException { return getCal().getAces(ent); | public Collection getAces(Object o) throws CalFacadeException { return getCal().getAces(o); } |
} if (uri.endsWith("/")) { uri = uri.substring(0, uri.length() - 1); | private CaldavURI findURI(String uri, boolean decoded, BwCalendar cal) throws WebdavIntfException { try { /*Remove all "." and ".." components */ if (decoded) { try { uri = new URI(null, null, uri, null).toString(); } catch (Throwable t) { if (debug) { error(t); } throw WebdavIntfException.badRequest(); } } uri = new URI(uri).normalize().getPath(); if (debug) { debugMsg("Normalized uri=" + uri); } try { uri = URLDecoder.decode(uri, "UTF-8"); } catch (Throwable t) { if (debug) { error(t); } throw WebdavIntfException.badRequest(); } if (!uri.startsWith("/")) { return null; } String[] ss = uri.split("/"); int pathLength = ss.length - 1; // First element is empty string String namePart = null; if (pathLength == 0) { throw WebdavIntfException.badRequest(); } boolean publicUri = ss[1].equals(publicCalendarRoot); int minLength = 1; if (!publicUri) { minLength = 2; if (!ss[1].equals(userCalendarRoot)) { if (debug) { debugMsg("First path component \"" + ss[1] + "\" neither " + publicCalendarRoot + "\" nor \"" + userCalendarRoot + "\""); } throw WebdavIntfException.notFound(); } /* For the time being at least stop somebody browsing the user ids. */ if (pathLength < 2) { throw WebdavIntfException.notFound(); } } /* If the uri ends with .ics or .ifb split it off */ if (uri.endsWith(".ics") || uri.endsWith(".ifb")) { if (pathLength == minLength) { throw WebdavIntfException.notFound(); } int pos = uri.lastIndexOf("/"); if (pos < 0) { // bad uri throw WebdavIntfException.badRequest(); } namePart = uri.substring(pos + 1); uri = uri.substring(0, pos); } if (cal == null) { // See if the full path is in the map CaldavURI curi = getUriPath(uri); if (curi != null) { /* We've avoided a search - can we use this caldavuri object */ if (curi.sameURI(publicUri, curi.getCal(), namePart)) { if (debug) { debugMsg("reuse uri - ispublic=" + publicUri + " cal=\"" + curi.getCal().getPath() + "\" entityName=\"" + namePart + "\""); } return curi; } if (debug) { debugMsg("create uri from mapped uri - ispublic=" + publicUri + " cal=\"" + curi.getCal().getPath() + "\" entityName=\"" + namePart + "\""); } curi = new CaldavURI(publicUri, curi.getCal(), namePart); putUriPath(curi); return curi; } // Search to see if the uri exists try { if (debug) { trace("SEARCH: for calendar " + uri); } cal = getSvci().getCalendar(uri); } catch (CalFacadeAccessException cae) { throw WebdavIntfException.unauthorized(); } if (cal == null) { if (namePart != null) { throw WebdavIntfException.notFound(); } /* Try removing the last element - this could be mkcalendar/mkcol */ if (pathLength == minLength) { throw WebdavIntfException.notFound(); } int pos = uri.lastIndexOf("/"); if (pos < 0) { // bad uri throw WebdavIntfException.notFound(); } namePart = uri.substring(pos + 1); uri = uri.substring(0, pos); // See if the uri exists try { if (debug) { trace("SEARCH: for calendar " + uri); } cal = getSvci().getCalendar(uri); } catch (CalFacadeAccessException cae) { throw WebdavIntfException.unauthorized(); } } if (cal == null) { throw WebdavIntfException.notFound(); } } /* The situation now is that the uri is the path of a collection that exists and that we have access to. namePart, if not null, represents an entity we are going to access or create, or possibly a calendar we want to create. */ if (debug) { debugMsg("create uri - ispublic=" + publicUri + " cal=\"" + cal.getPath() + "\" entityName=\"" + namePart + "\""); } CaldavURI curi = new CaldavURI(publicUri, cal, namePart); putUriPath(curi); return curi; } catch (WebdavIntfException wi) { throw wi; } catch (Throwable t) { throw new WebdavIntfException(t); } } |
|
if (!ns.equals(CaldavDefs.caldavNamespace)) { | if ((!ns.equals(CaldavDefs.caldavNamespace) && !ns.equals(CaldavDefs.icalNamespace))) { | public void generatePropValue(WebdavNsNode node, WebdavProperty pr) throws WebdavIntfException { QName tag = pr.getTag(); String ns = tag.getNamespaceURI(); boolean isCalendar = node instanceof CaldavCalNode; CaldavCalNode calNode = null; BwCalendar cal = null; if (isCalendar) { calNode = (CaldavCalNode)node; cal = calNode.getCDURI().getCal(); } try { /* Deal with webdav properties */ if (!ns.equals(CaldavDefs.caldavNamespace)) { // Not ours super.generatePropValue(node, pr); return; } if (tag.equals(CaldavTags.calendarDescription)) { if ((cal != null) && (cal.getDescription() != null)) { // XXX lang openPropstat(); xml.property(tag, cal.getDescription()); closePropstat(); } } else if (tag.equals(CaldavTags.calendarTimezone)) { TimeZone tz = getSvci().getTimezones().getDefaultTimeZone(); openPropstat(); xml.property(tag, trans.toStringTzCalendar(tz.getID())); closePropstat(); } else if (tag.equals(CaldavTags.supportedCalendarComponentSet)) { /* e.g. * <C:supported-calendar-component-set * xmlns:C="urn:ietf:params:xml:ns:caldav"> * <C:comp name="VEVENT"/> * <C:comp name="VTODO"/> * </C:supported-calendar-component-set> */ openPropstat(); xml.openTag(tag); xml.startTag(CaldavTags.comp); xml.atribute("name", "VEVENT"); xml.closeTag(tag); closePropstat(); } else if (tag.equals(CaldavTags.supportedCalendarData)) { /* e.g. * <C:supported-calendar-data * xmlns:C="urn:ietf:params:xml:ns:caldav"> * <C:calendar-data content-type="text/calendar" version="2.0"/> * </C:supported-calendar-data> */ openPropstat(); xml.openTag(tag); xml.startTag(CaldavTags.calendarData); xml.atribute("content-type", "text/calendar"); xml.atribute("version", "2.0"); xml.closeTag(tag); closePropstat(); } else if (tag.equals(CaldavTags.maxAttendeesPerInstance)) { } else if (tag.equals(CaldavTags.maxDateTime)) { } else if (tag.equals(CaldavTags.maxInstances)) { } else if (tag.equals(CaldavTags.maxResourceSize)) { /* e.g. * <C:max-resource-size * xmlns:C="urn:ietf:params:xml:ns:caldav">102400</C:max-resource-size> */ openPropstat(); xml.property(tag, String.valueOf(getSvci().getSyspars().getMaxUserEntitySize())); closePropstat(); } else if (tag.equals(CaldavTags.minDateTime)) { } else { // Not known openPropstat(); xml.emptyTag(tag); closePropstat(HttpServletResponse.SC_NOT_FOUND); } } catch (WebdavIntfException wie) { throw wie; } catch (Throwable t) { throw new WebdavIntfException(t); } } |
if (tag.equals(CaldavTags.calendarDescription)) { | if (tag.equals(ICalTags.summary)) { openPropstat(); xml.property(tag, pr.getPval()); closePropstat(); } else if (tag.equals(ICalTags.dtstart)) { openPropstat(); xml.property(tag, pr.getPval()); closePropstat(); } else if (tag.equals(ICalTags.dtend)) { openPropstat(); xml.property(tag, pr.getPval()); closePropstat(); } else if (tag.equals(ICalTags.duration)) { openPropstat(); xml.property(tag, pr.getPval()); closePropstat(); } else if (tag.equals(ICalTags.transp)) { openPropstat(); xml.property(tag, pr.getPval()); closePropstat(); } else if (tag.equals(ICalTags.due)) { openPropstat(); xml.property(tag, pr.getPval()); closePropstat(); } else if (tag.equals(ICalTags.status)) { openPropstat(); xml.property(tag, pr.getPval()); closePropstat(); } else if (tag.equals(ICalTags.uid)) { openPropstat(); xml.property(tag, pr.getPval()); closePropstat(); } else if (tag.equals(ICalTags.sequence)) { openPropstat(); xml.property(tag, pr.getPval()); closePropstat(); } else if (tag.equals(ICalTags.hasRecurrence)) { openPropstat(); xml.property(tag, pr.getPval()); closePropstat(); } else if (tag.equals(ICalTags.hasAlarm)) { openPropstat(); xml.property(tag, pr.getPval()); closePropstat(); } else if (tag.equals(ICalTags.hasAttachment)) { openPropstat(); xml.property(tag, pr.getPval()); closePropstat(); } else if (tag.equals(CaldavTags.calendarDescription)) { | public void generatePropValue(WebdavNsNode node, WebdavProperty pr) throws WebdavIntfException { QName tag = pr.getTag(); String ns = tag.getNamespaceURI(); boolean isCalendar = node instanceof CaldavCalNode; CaldavCalNode calNode = null; BwCalendar cal = null; if (isCalendar) { calNode = (CaldavCalNode)node; cal = calNode.getCDURI().getCal(); } try { /* Deal with webdav properties */ if (!ns.equals(CaldavDefs.caldavNamespace)) { // Not ours super.generatePropValue(node, pr); return; } if (tag.equals(CaldavTags.calendarDescription)) { if ((cal != null) && (cal.getDescription() != null)) { // XXX lang openPropstat(); xml.property(tag, cal.getDescription()); closePropstat(); } } else if (tag.equals(CaldavTags.calendarTimezone)) { TimeZone tz = getSvci().getTimezones().getDefaultTimeZone(); openPropstat(); xml.property(tag, trans.toStringTzCalendar(tz.getID())); closePropstat(); } else if (tag.equals(CaldavTags.supportedCalendarComponentSet)) { /* e.g. * <C:supported-calendar-component-set * xmlns:C="urn:ietf:params:xml:ns:caldav"> * <C:comp name="VEVENT"/> * <C:comp name="VTODO"/> * </C:supported-calendar-component-set> */ openPropstat(); xml.openTag(tag); xml.startTag(CaldavTags.comp); xml.atribute("name", "VEVENT"); xml.closeTag(tag); closePropstat(); } else if (tag.equals(CaldavTags.supportedCalendarData)) { /* e.g. * <C:supported-calendar-data * xmlns:C="urn:ietf:params:xml:ns:caldav"> * <C:calendar-data content-type="text/calendar" version="2.0"/> * </C:supported-calendar-data> */ openPropstat(); xml.openTag(tag); xml.startTag(CaldavTags.calendarData); xml.atribute("content-type", "text/calendar"); xml.atribute("version", "2.0"); xml.closeTag(tag); closePropstat(); } else if (tag.equals(CaldavTags.maxAttendeesPerInstance)) { } else if (tag.equals(CaldavTags.maxDateTime)) { } else if (tag.equals(CaldavTags.maxInstances)) { } else if (tag.equals(CaldavTags.maxResourceSize)) { /* e.g. * <C:max-resource-size * xmlns:C="urn:ietf:params:xml:ns:caldav">102400</C:max-resource-size> */ openPropstat(); xml.property(tag, String.valueOf(getSvci().getSyspars().getMaxUserEntitySize())); closePropstat(); } else if (tag.equals(CaldavTags.minDateTime)) { } else { // Not known openPropstat(); xml.emptyTag(tag); closePropstat(HttpServletResponse.SC_NOT_FOUND); } } catch (WebdavIntfException wie) { throw wie; } catch (Throwable t) { throw new WebdavIntfException(t); } } |
Object o = RequestUtils.lookup(pageContext, name, property, scope); | Object o = TagUtils.getInstance().lookup(pageContext, name, property, scope); | protected Object getObject(String name, String scope, String property, boolean required) throws JspTagException { try { Object o = RequestUtils.lookup(pageContext, name, property, scope); if (o == null) { if (required) { throw new JspTagException("Unable to find " + name + " in " + scope + " for property " + property); } return null; } return o; } catch (JspTagException jte) { throw jte; } catch (Throwable t) { throw new JspTagException(t.getMessage()); } } |
int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if (label != null && label.length() != 0 && pixelLoc + labelWidth < width) { copy.drawString(label, pixelLoc - labelWidth/2, top - majorTickLength- fm.getLeading()); | 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()); } | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D copy = (Graphics2D)g.create(); if (copy != null) { try { Font f = new Font("SansSerif", Font.PLAIN, 9); copy.setFont(f); // in case there are borders inside of this one Insets insets = ((JComponent)c).getInsets(); /*System.out.println("x: " + x + " y: " + y); System.out.println("itop: " + insets.top + " ibottom: " + insets.bottom + "ileft: " + insets.left + " iright: " + insets.right); System.out.println("top: " + top + " bottom: " + bottom + " right: " + right + "left: " + left);*/ 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); int labelWidth = (int)fm.getStringBounds(label, copy).getWidth(); if (label != null && label.length() != 0 && pixelLoc + labelWidth < width) { copy.drawString(label, pixelLoc - labelWidth/2, top - majorTickLength- fm.getLeading()); } } } // left if (leftScaleMap != null) { numTicks = leftScaleMap.getNumTicks(); if ( numTicks == 0) { copy.drawString("No Data", 0, 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); } } } // 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(); } } } |
Acl acl = getAces(ent, privWriteAcl); | Acl acl = checkAccess(ent, privWriteAcl, false).acl; | public void changeAccess(BwShareableDbentity ent, Collection aces) throws CalFacadeException { try { Acl acl = getAces(ent, privWriteAcl); Iterator it = aces.iterator(); while (it.hasNext()) { Ace ace = (Ace)it.next(); acl.removeAccess(ace); acl.addAce(ace); } ent.setAccess(new String(acl.encode())); } catch (Throwable t) { throw new CalFacadeException(t); } } |
if (accessible(sdbe, desiredAccess, nullForNoAccess)) { | if (checkAccess(sdbe, desiredAccess, nullForNoAccess).accessAllowed) { | public Collection checkAccess(Collection ents, int desiredAccess, boolean nullForNoAccess) throws CalFacadeException { TreeSet out = new TreeSet(); Iterator it = ents.iterator(); while (it.hasNext()) { BwShareableDbentity sdbe = (BwShareableDbentity)it.next(); if (accessible(sdbe, desiredAccess, nullForNoAccess)) { out.add(sdbe); } } return out; } |
CalEnv env = getEnv(request, form); String appRoot = env.getAppProperty("root"); | String appRoot = form.retrieveConfig().getAppRoot(); String portalPlatform = form.retrieveConfig().getPortalPlatform(); if (isPortlet && (portalPlatform != null)) { appRoot += "." + portalPlatform; } | private synchronized BwSession getState(HttpServletRequest request, BwActionFormBase form, MessageResources messages, String adminUserId, boolean admin) throws Throwable { BwSession s = BwWebUtil.getState(request); HttpSession sess = request.getSession(false); String appName = getAppName(sess); if (s != null) { if (debug) { debugMsg("getState-- obtainedfrom session"); debugMsg("getState-- timeout interval = " + sess.getMaxInactiveInterval()); } form.assignNewSession(false); } else { if (debug) { debugMsg("getState-- get new object"); } form.assignNewSession(true); CalEnv env = getEnv(request, form); String appRoot = env.getAppProperty("root"); /** The actual session class used is possibly site dependent */ s = new BwSessionImpl(form.getCurrentUser(), appRoot, appName, form.getPresentationState(), messages, form.getSchemeHostPort(), debug); BwWebUtil.setState(request, s); setSessionAttr(request, "cal.pubevents.client.uri", messages.getMessage("org.bedework.public.calendar.uri")); setSessionAttr(request, "cal.personal.client.uri", messages.getMessage("org.bedework.personal.calendar.uri")); setSessionAttr(request, "cal.admin.client.uri", messages.getMessage("org.bedework.public.admin.uri")); String temp = messages.getMessage("org.bedework.host"); if (temp == null) { temp = form.getSchemeHostPort(); } setSessionAttr(request, "cal.server.host", temp); String raddr = request.getRemoteAddr(); String rhost = request.getRemoteHost(); info("===============" + appName + ": New session (" + s.getSessionNum() + ") from " + rhost + "(" + raddr + ")"); if (!admin) { /** Ensure the session timeout interval is longer than our refresh period */ // Should come from db -- int refInt = s.getRefreshInterval(); int refInt = 60; // 1 min refresh? if (refInt > 0) { int timeout = sess.getMaxInactiveInterval(); if (timeout <= refInt) { // An extra minute should do it. debugMsg("@+@+@+@+@+ set timeout to " + (refInt + 60)); sess.setMaxInactiveInterval(refInt + 60); } } } } //int access = getAccess(request, messages); //if (debug) { // debugMsg("Container says that current user has the type: " + access); //} /** Ensure we have a CalAdminSvcI object */ String calSuite = form.retrieveConfig().getCalSuite(); checkSvci(request, form, s, adminUserId, calSuite, getPublicAdmin(form), false, debug); /* UserAuth ua = null; UserAuthPar par = new UserAuthPar(); par.svlt = servlet; par.req = request; try { ua = form.fetchSvci().getUserAuth(s.getUser(), par); form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); if (debug) { debugMsg("UserAuth says that current user has the type: " + ua.getUsertype()); } } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); form.getErr().emit(t); return null; } */ return s; } |
fail("Expected an exception of type " + interpreterExceptionClass.getSimpleName()); | fail("Expected an exception of type " + Evaluator.getSimpleName(interpreterExceptionClass)); | public void evalAndTestException(String input, Class interpreterExceptionClass) { try { ATAbstractGrammar ptree = NATParser._INSTANCE_.base_parse(NATText.atValue(input)); ptree.meta_eval(ctx_); fail("Expected an exception of type " + interpreterExceptionClass.getSimpleName()); // test should throw an exception } catch (InterpreterException ex) { if (!interpreterExceptionClass.isInstance(ex)) { ex.printStackTrace(); fail("Unexpected exception: "+ex.getMessage()); } } } |
File inFile = new File(forTestClass.getResource(forTestClass.getSimpleName() + "-" + name).toURI()); | File inFile = new File(new URI(forTestClass.getResource(Evaluator.getSimpleName(forTestClass) + "-" + name).toString())); | public static final ATObject evalSnippet(Class forTestClass, String name, ATContext inContext) throws InterpreterException { try { File inFile = new File(forTestClass.getResource(forTestClass.getSimpleName() + "-" + name).toURI()); // load the code from the file String code = Evaluator.loadContentOfFile(inFile); // parse and evaluate the code in the proper context and return its result ATAbstractGrammar source = NATParser.parse(inFile.getName(), code); return source.meta_eval(inContext); } catch (IOException e) { throw new XIOProblem(e); } catch (URISyntaxException e) { fail(e.getMessage()); return null; } } |
return null; | return NATNil._INSTANCE_; | public static final ATObject evalSnippet(Class forTestClass, String name, ATContext inContext) throws InterpreterException { try { File inFile = new File(forTestClass.getResource(forTestClass.getSimpleName() + "-" + name).toURI()); // load the code from the file String code = Evaluator.loadContentOfFile(inFile); // parse and evaluate the code in the proper context and return its result ATAbstractGrammar source = NATParser.parse(inFile.getName(), code); return source.meta_eval(inContext); } catch (IOException e) { throw new XIOProblem(e); } catch (URISyntaxException e) { fail(e.getMessage()); return null; } } |
paramNames[i] = AGSymbol.alloc(Evaluator.valueNameOf(paramTypes[i])); | paramNames[i] = AGSymbol.jAlloc(Evaluator.valueNameOf(paramTypes[i])); | public ATTable base_getParameters() throws InterpreterException { Class[] paramTypes = javaMethod_.getParameterTypes(); AGSymbol[] paramNames = new AGSymbol[paramTypes.length]; for (int i = 0; i < paramTypes.length; i++) { paramNames[i] = AGSymbol.alloc(Evaluator.valueNameOf(paramTypes[i])); } return new NATTable(paramNames); } |
null, | 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, 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(); } } |
|
access.accessible(parent, privWrite, false); if (parent.getCalendarCollection()) { throw new CalFacadeException(CalFacadeException.illegalCalendarCreation); } String path = parent.getPath(); if (path == null) { if (parent.getPublick()) { path = ""; } else { path = "/users/" + parent.getOwner().getAccount(); } } path += "/" + val.getName(); sess.namedQuery("getCalendarByPath"); sess.setString("path", path); if (sess.getUnique() != null) { throw new CalFacadeException(CalFacadeException.duplicateCalendar); } val.setPath(path); val.setOwner(user); val.setCalendar(parent); parent.addChild(val); sess.save(parent); | calendars.addCalendar(val, parent); | public void addCalendar(BwCalendar val, BwCalendar parent) throws CalFacadeException { checkOpen(); /* We need write access to the parent */ access.accessible(parent, privWrite, false); /** Is the parent a calendar collection? *//* sess.namedQuery("countCalendarEventRefs"); sess.setEntity("cal", parent); Integer res = (Integer)sess.getUnique(); if (res.intValue() > 0) {*/ if (parent.getCalendarCollection()) { throw new CalFacadeException(CalFacadeException.illegalCalendarCreation); } /* Ensure the path is unique */ String path = parent.getPath(); if (path == null) { if (parent.getPublick()) { path = ""; } else { path = "/users/" + parent.getOwner().getAccount(); } } path += "/" + val.getName(); sess.namedQuery("getCalendarByPath"); sess.setString("path", path); if (sess.getUnique() != null) { throw new CalFacadeException(CalFacadeException.duplicateCalendar); } val.setPath(path); val.setOwner(user); val.setCalendar(parent); parent.addChild(val); sess.save(parent); } |
checkOpen(); user.setCategoryAccess(access.getDefaultPersonalAccess()); user.setLocationAccess(access.getDefaultPersonalAccess()); user.setSponsorAccess(access.getDefaultPersonalAccess()); user.setQuota(getSyspars().getDefaultUserQuota()); sess.save(user); sess.namedQuery("getCalendarByPath"); String path = "/" + getSyspars().getUserCalendarRoot(); sess.setString("path", path); BwCalendar userrootcal = (BwCalendar)sess.getUnique(); if (userrootcal == null) { throw new CalFacadeException("No user root at " + path); } path += "/" + user.getAccount(); sess.namedQuery("getCalendarByPath"); sess.setString("path", path); BwCalendar usercal = (BwCalendar)sess.getUnique(); if (usercal != null) { throw new CalFacadeException("User calendar already exists at " + path); } usercal = new BwCalendar(); usercal.setName(user.getAccount()); usercal.setCreator(user); usercal.setOwner(user); usercal.setPublick(false); usercal.setPath(path); usercal.setCalendar(userrootcal); userrootcal.addChild(usercal); sess.save(userrootcal); BwCalendar cal = new BwCalendar(); cal.setName(getSyspars().getUserDefaultCalendar()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserDefaultCalendar()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); cal = new BwCalendar(); cal.setName(getSyspars().getDefaultTrashCalendar()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getDefaultTrashCalendar()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); cal = new BwCalendar(); cal.setName(getSyspars().getUserInbox()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserInbox()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); cal = new BwCalendar(); cal.setName(getSyspars().getUserOutbox()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserOutbox()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); sess.save(usercal); sess.update(user); | addNewUser(user); calendars.addNewCalendars(); | public void addUser(BwUser user) throws CalFacadeException { checkOpen(); user.setCategoryAccess(access.getDefaultPersonalAccess()); user.setLocationAccess(access.getDefaultPersonalAccess()); user.setSponsorAccess(access.getDefaultPersonalAccess()); user.setQuota(getSyspars().getDefaultUserQuota()); sess.save(user); /* Add a user collection to the userCalendarRoot and then a default calendar collection. */ sess.namedQuery("getCalendarByPath"); String path = "/" + getSyspars().getUserCalendarRoot(); sess.setString("path", path); BwCalendar userrootcal = (BwCalendar)sess.getUnique(); if (userrootcal == null) { throw new CalFacadeException("No user root at " + path); } path += "/" + user.getAccount(); sess.namedQuery("getCalendarByPath"); sess.setString("path", path); BwCalendar usercal = (BwCalendar)sess.getUnique(); if (usercal != null) { throw new CalFacadeException("User calendar already exists at " + path); } /* Create a folder for the user */ usercal = new BwCalendar(); usercal.setName(user.getAccount()); usercal.setCreator(user); usercal.setOwner(user); usercal.setPublick(false); usercal.setPath(path); usercal.setCalendar(userrootcal); userrootcal.addChild(usercal); sess.save(userrootcal); /* Create a default calendar */ BwCalendar cal = new BwCalendar(); cal.setName(getSyspars().getUserDefaultCalendar()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserDefaultCalendar()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the trash calendar */ cal = new BwCalendar(); cal.setName(getSyspars().getDefaultTrashCalendar()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getDefaultTrashCalendar()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the inbox */ cal = new BwCalendar(); cal.setName(getSyspars().getUserInbox()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserInbox()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the outbox */ cal = new BwCalendar(); cal.setName(getSyspars().getUserOutbox()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserOutbox()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); sess.save(usercal); sess.update(user); } |
sess.namedQuery("countCalendarEventRefs"); sess.setEntity("cal", val); Integer res = (Integer)sess.getUnique(); if (debug) { trace(" ----------- count = " + res); } if (res == null) { return false; } return res.intValue() > 0; | return calendars.checkCalendarRefs(val); | public boolean checkCalendarRefs(BwCalendar val) throws CalFacadeException { checkOpen(); sess.namedQuery("countCalendarEventRefs"); sess.setEntity("cal", val); Integer res = (Integer)sess.getUnique(); if (debug) { trace(" ----------- count = " + res); } if (res == null) { return false; } return res.intValue() > 0; } |
BwCalendar parent = val.getCalendar(); if (parent == null) { throw new CalFacadeException(CalFacadeException.cannotDeleteCalendarRoot); } parent.removeChild(val); sess.update(parent); return true; | return calendars.deleteCalendar(val); | public boolean deleteCalendar(BwCalendar val) throws CalFacadeException { checkOpen(); BwCalendar parent = val.getCalendar(); if (parent == null) { throw new CalFacadeException(CalFacadeException.cannotDeleteCalendarRoot); } //sess.delete(val); parent.removeChild(val); sess.update(parent); return true; } |
sess.namedQuery("getUserCalendarCollections"); sess.setEntity("owner", user); sess.cacheableQuery(); return access.checkAccess(sess.getList(), privWriteContent, true); | return calendars.getAddContentCalendarCollections(); | public Collection getAddContentCalendarCollections() throws CalFacadeException { if (currentMode == CalintfUtil.guestMode) { return new TreeSet(); } checkOpen(); sess.namedQuery("getUserCalendarCollections"); sess.setEntity("owner", user); sess.cacheableQuery(); return access.checkAccess(sess.getList(), privWriteContent, true); } |
sess.namedQuery("getPublicCalendarCollections"); sess.cacheableQuery(); return access.checkAccess(sess.getList(), privWriteContent, true); | return calendars.getAddContentPublicCalendarCollections(); | public Collection getAddContentPublicCalendarCollections() throws CalFacadeException { checkOpen(); sess.namedQuery("getPublicCalendarCollections"); sess.cacheableQuery(); return access.checkAccess(sess.getList(), privWriteContent, true); } |
sess.namedQuery("getCalendarById"); sess.setInt("id", val); sess.cacheableQuery(); return (BwCalendar)sess.getUnique(); | return calendars.getCalendar(val); | public BwCalendar getCalendar(int val) throws CalFacadeException { checkOpen(); sess.namedQuery("getCalendarById"); sess.setInt("id", val); sess.cacheableQuery(); return (BwCalendar)sess.getUnique(); } |
sess.namedQuery("getUserCalendarCollections"); sess.setEntity("owner", user); sess.cacheableQuery(); return access.checkAccess(sess.getList(), privWrite, true); | return calendars.getCalendarCollections(); | public Collection getCalendarCollections() throws CalFacadeException { checkOpen(); sess.namedQuery("getUserCalendarCollections"); sess.setEntity("owner", user); sess.cacheableQuery(); return access.checkAccess(sess.getList(), privWrite, true); } |
sess.namedQuery("getCalendarByPath"); sess.setString("path", userCalendarRootPath + "/" + user.getAccount()); sess.cacheableQuery(); return (BwCalendar)sess.getUnique(); | return calendars.getCalendars(); | public BwCalendar getCalendars() throws CalFacadeException { if (currentMode == CalintfUtil.guestMode) { return getPublicCalendars(); } checkOpen(); sess.namedQuery("getCalendarByPath"); sess.setString("path", userCalendarRootPath + "/" + user.getAccount()); sess.cacheableQuery(); return (BwCalendar)sess.getUnique(); } |
StringBuffer sb = new StringBuffer(); sb.append("/"); sb.append(getSyspars().getUserCalendarRoot()); sb.append("/"); sb.append(user.getAccount()); sb.append("/"); sb.append(getSyspars().getUserDefaultCalendar()); return getCalendar(sb.toString()); | return calendars.getDefaultCalendar(); | public BwCalendar getDefaultCalendar() throws CalFacadeException { StringBuffer sb = new StringBuffer(); sb.append("/"); sb.append(getSyspars().getUserCalendarRoot()); sb.append("/"); sb.append(user.getAccount()); sb.append("/"); sb.append(getSyspars().getUserDefaultCalendar()); return getCalendar(sb.toString()); } |
sess.namedQuery("getPublicCalendarCollections"); sess.cacheableQuery(); return access.checkAccess(sess.getList(), privWrite, true); | return calendars.getPublicCalendarCollections(); | public Collection getPublicCalendarCollections() throws CalFacadeException { checkOpen(); sess.namedQuery("getPublicCalendarCollections"); sess.cacheableQuery(); return access.checkAccess(sess.getList(), privWrite, true); } |
sess.namedQuery("getCalendarByPath"); sess.setString("path", publicCalendarRootPath); sess.cacheableQuery(); return (BwCalendar)sess.getUnique(); | return calendars.getPublicCalendars(); | public BwCalendar getPublicCalendars() throws CalFacadeException { checkOpen(); sess.namedQuery("getCalendarByPath"); sess.setString("path", publicCalendarRootPath); sess.cacheableQuery(); /* XXX access checks */ return (BwCalendar)sess.getUnique(); } |
StringBuffer sb = new StringBuffer(); sb.append("/"); sb.append(getSyspars().getUserCalendarRoot()); sb.append("/"); sb.append(user.getAccount()); sb.append("/"); sb.append(getSyspars().getDefaultTrashCalendar()); return getCalendar(sb.toString()); | return calendars.getTrashCalendar(); | public BwCalendar getTrashCalendar() throws CalFacadeException { StringBuffer sb = new StringBuffer(); sb.append("/"); sb.append(getSyspars().getUserCalendarRoot()); sb.append("/"); sb.append(user.getAccount()); sb.append("/"); sb.append(getSyspars().getDefaultTrashCalendar()); return getCalendar(sb.toString()); } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.