rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
MainFrame.getInstance().dispose();
if (MainFrame.getInstance() != null) { MainFrame.getInstance().dispose(); }
public static void askToExit() { if (MainConfiguration.PROPS.getBoolean("gui.asktoexit")) { //$NON-NLS-1$ int i = JOptionPane.showConfirmDialog(null, Messages.getString("Util.19"), //$NON-NLS-1$ Messages.getString("Util.20"), JOptionPane.YES_NO_OPTION); //$NON-NLS-2$ if (i != JOptionPane.YES_OPTION) { return; } } MainFrame.getInstance().dispose(); System.exit(0); }
Idea oldSelected = newSelected;
Idea oldSelected = this.selected;
public void setSelected(Idea newSelected) { Idea oldSelected = newSelected; if (this.selected != null) { this.selected.setSelected(false); } this.selected = newSelected; if (this.selected != null) { this.selected.setSelected(true); } firePropertyChange("selected", oldSelected, this.selected); }
public Idea(String text) { setText(text);
public Idea() {
public Idea(String text) { setText(text); }
createMinuteSecondFormats(minSecDivs, borderFormats);
protected List createFormats(){ List borderFormats = new ArrayList(); borderFormats.add(new TimeBorderFormat("mm:ss.SSS", new TimeInterval(1, UnitImpl.MILLISECOND))); borderFormats.add(new TimeBorderFormat("mm:ss.SSS", new TimeInterval(10, UnitImpl.MILLISECOND))); createSecondFormats(secDivs, borderFormats); createMinuteFormats(minDivs, borderFormats); createHourFormats(hourDivs, borderFormats); return borderFormats; }
private void createHourFormat(double minutesPerDivision, int divPerLabel, List recip){ TimeInterval inter = new TimeInterval(minutesPerDivision, UnitImpl.MINUTE);
private void createHourFormat(double minutesPerDivision, int divPerLabel, List recip, UnitImpl unit){ TimeInterval inter = new TimeInterval(minutesPerDivision, unit);
private void createHourFormat(double minutesPerDivision, int divPerLabel, List recip){ TimeInterval inter = new TimeInterval(minutesPerDivision, UnitImpl.MINUTE); recip.add(new TimeBorderFormat("HH:mm:ss", inter, divPerLabel)); }
createHourFormat(minDivs[i][0], (int)minDivs[i][1], recip);
createHourFormat(minDivs[i][0], (int)minDivs[i][1], recip, UnitImpl.MINUTE);
private void createMinuteFormats(double[][] minDivs, List recip){ for (int i = 0; i < minDivs.length; i++) { createHourFormat(minDivs[i][0], (int)minDivs[i][1], recip); } }
public MicroSecondTimeRange(MicroSecondDate beginTime, TimeInterval interval){ this.beginTime = beginTime; this.endTime = beginTime.add(interval); this.interval = interval; }
public MicroSecondTimeRange(RequestFilter rf){ this(new MicroSecondDate(rf.start_time), new MicroSecondDate(rf.end_time)); }
public MicroSecondTimeRange(MicroSecondDate beginTime, TimeInterval interval){ this.beginTime = beginTime; this.endTime = beginTime.add(interval); this.interval = interval; }
public ATNumber base_inc() {
public ATNumeric base_inc() {
public ATNumber base_inc() { return NATNumber.atValue(javaValue+1); }
public ATNumber base_abs() {
public ATNumeric base_abs() {
public ATNumber base_abs() { return NATNumber.atValue(Math.abs(javaValue)); }
public Events(Calintf cal, AccessUtil access, HibSession sess, BwUser user, boolean debug) { this.cal = cal; this.access = access; this.sess = sess; this.user = user; this.debug = debug;
public Events(Calintf cal, AccessUtil access, BwUser user, boolean debug) { super(cal, access, user, debug);
public Events(Calintf cal, AccessUtil access, HibSession sess, BwUser user, boolean debug) { this.cal = cal; this.access = access; this.sess = sess; this.user = user; this.debug = debug; Properties uidprops = new Properties(); uidprops.setProperty("separator", "-"); uuidGen = new UUIDHexGenerator(); ((Configurable)uuidGen).configure(Hibernate.STRING, uidprops, null); }
HibSession sess = getSess();
public void addEvent(BwEvent val, Collection overrides) throws CalFacadeException { RecuridTable recurids = null; if ((overrides != null) && (overrides.size() != 0)) { if (!val.getRecurring()) { throw new CalFacadeException("Master event not recurring"); } recurids = new RecuridTable(overrides); } assignGuid(val); /* The guid must not exist in the system. The above call assigns a guid if * one wasn't assigned already. However, the event may have come with a guid * (caldav, import, etc) so we need to cehck here. * * It also ensures our guid allocation is working OK */ sess.namedQuery("getGuidCount"); sess.setString("guid", val.getGuid()); Collection refs = sess.getList(); Integer ct = (Integer)refs.iterator().next(); if (ct.intValue() > 0) { throw new CalFacadeException(CalFacadeException.duplicateGuid); } sess.save(val); /** If it's a recurring event see what we can do to optimise searching * and retrieval */ if (!val.getRecurring()) { return; } /* Try to create a set of occurrences for the event We'll turn it into a VEvent to use the ical4j code. */ VEvent vev = VEventUtil.toIcalEvent(val, null); /* Determine the absolute latest date. */ Date latest = VEventUtil.getLatestRecurrenceDate(vev, debug); if (latest == null) { /* Unlimited recurrences. No more to do here * We could optionally choose to limit these to say 3 years */ return; } CalTimezones tzs = cal.getTimezones(); DtStart vstart = vev.getStartDate(); String stzid = CalFacadeUtil.getTzid(vstart); TimeZone stz = null; if (stzid != null) { stz = tzs.getTimeZone(stzid); } val.getRecurrence().setLatestDate(tzs.getUtc(latest.toString(), stzid, stz)); /* Get all the times for this event. - this could be a problem. Need to limit the number. Should we do this in chunks, stepping through the whole period? */ Date start = vev.getStartDate().getDate(); PeriodList pl = vev.getConsumedTime(start, latest); Iterator it = pl.iterator(); boolean dateOnly = val.getDtstart().getDateType(); while (it.hasNext()) { Period p = (Period)it.next(); BwDateTime rstart = new BwDateTime(); rstart.init(dateOnly, p.getStart().toString(), stzid, tzs); BwDateTime rend = new BwDateTime(); rend.init(dateOnly, p.getEnd().toString(), stzid, tzs); BwRecurrenceInstance ri = new BwRecurrenceInstance(); ri.setDtstart(rstart); ri.setDtend(rend); ri.setRecurrenceId(ri.getDtstart().getDate()); ri.setMaster(val); if (recurids != null) { /* See if we have a recurrence */ String rid = ri.getRecurrenceId(); BwEventProxy ov = (BwEventProxy)recurids.get(rid); if (ov != null) { if (debug) { debugMsg("Add override with recurid " + rid); } addOverride(ov, ri); recurids.remove(rid); } } sess.save(ri); } if (recurids != null) { if (recurids.size() != 0) { throw new CalFacadeException("Invalid override"); } } val.getRecurrence().setExpanded(true); sess.saveOrUpdate(val); }
sess.saveOrUpdate(override);
getSess().saveOrUpdate(override);
private void addOverride(BwEventProxy proxy, BwRecurrenceInstance inst) throws CalFacadeException { BwEventAnnotation override = proxy.getRef(); override.setOwner(user); sess.saveOrUpdate(override); inst.setOverride(override); }
HibSession sess = getSess();
private int deleteAlarms(BwEvent ev) throws CalFacadeException { sess.namedQuery("deleteEventAlarms"); sess.setEntity("ev", ev); return sess.executeUpdate(); }
HibSession sess = getSess();
public DelEventResult deleteEvent(BwEvent val) throws CalFacadeException { DelEventResult der = new DelEventResult(false, 0); der.alarmsDeleted = deleteAlarms(val); StringBuffer sb = new StringBuffer(); /* SEG: delete from recurrences recur where */ sb.append("delete from "); sb.append(BwRecurrenceInstance.class.getName()); sb.append(" where master=:master"); sess.createQuery(sb.toString()); sess.setEntity("master", val); sess.executeUpdate(); /* XXX Cascades don't seem to do the job here - we have to explicitly delete the annotations. In any case, this won't work if we have a shared event and there are annotations to the annotation. We need a field which identifies all annotations related to the master i.e. not just a target field but a master field. */ sb = new StringBuffer(); sb.append("from "); sb.append(BwEventAnnotation.class.getName()); sb.append(" where target=:target"); sess.createQuery(sb.toString()); sess.setEntity("target", val); Collection anns = sess.getList(); Iterator it = anns.iterator(); while (it.hasNext()) { BwEventAnnotation ann = (BwEventAnnotation)it.next(); ann.getAttendees().clear(); sess.delete(ann); } sess.delete(val); /* This event was really deleted so we need to set any synch states to * indicate this is the case. */ cal.setSynchState(val, BwSynchState.DELETED); der.eventDeleted = true; return der; }
HibSession sess = getSess();
private void doCalendarEntities(boolean setUser, BwCalendar calendar) throws CalFacadeException { if (setUser) { sess.setEntity("user", user); } if (calendar != null) { if (calendar.getCalendarCollection()) { // Single leaf calendar sess.setEntity("calendar", calendar); } else { // Non leaf - add entities setCalendarEntities(calendar, new CalTerm()); } } }
HibSession sess = getSess();
private void eventQuery(Class cl, String guid, String rid, Integer seqnum, boolean masterOnly) throws CalFacadeException { StringBuffer sb = new StringBuffer(); /* SEG: from Events ev where */ sb.append("from "); sb.append(cl.getName()); sb.append(" ev "); sb.append(" where ev.guid=:guid "); if (seqnum != null) { sb.append(" and ev.sequence=:seq "); } if (masterOnly) { sb.append(" and ev.recurrence.recurrenceId is null "); } else if (rid != null) { sb.append(" and ev.recurrence.recurrenceId=:rid "); } sess.createQuery(sb.toString()); sess.setString("guid", guid); if (seqnum != null) { sess.setInt("seq", seqnum.intValue()); } if (! masterOnly && (rid != null)) { sess.setString("rid", rid); } //debugMsg("Try query " + sb.toString()); }
public BwEvent getEvent(int id) throws CalFacadeException { Criteria cr = sess.createCriteria(BwEventObj.class);
public Collection getEvent(String guid, String rid, Integer seqnum, int recurRetrieval) throws CalFacadeException { BwEvent ev = null; BwEvent master = null; TreeSet ts = new TreeSet(); HibSession sess = getSess();
public BwEvent getEvent(int id) throws CalFacadeException { Criteria cr = sess.createCriteria(BwEventObj.class); cr.add(Expression.eq("id", new Integer(id))); BwEvent ev = (BwEvent)sess.getUnique(); if (!access.accessible(ev, privRead, noAccessReturnsNull)) { return null; } return ev; }
cr.add(Expression.eq("id", new Integer(id)));
if (rid == null) { eventQuery(BwEventObj.class, guid, rid, seqnum, true);
public BwEvent getEvent(int id) throws CalFacadeException { Criteria cr = sess.createCriteria(BwEventObj.class); cr.add(Expression.eq("id", new Integer(id))); BwEvent ev = (BwEvent)sess.getUnique(); if (!access.accessible(ev, privRead, noAccessReturnsNull)) { return null; } return ev; }
BwEvent ev = (BwEvent)sess.getUnique();
public BwEvent getEvent(int id) throws CalFacadeException { Criteria cr = sess.createCriteria(BwEventObj.class); cr.add(Expression.eq("id", new Integer(id))); BwEvent ev = (BwEvent)sess.getUnique(); if (!access.accessible(ev, privRead, noAccessReturnsNull)) { return null; } return ev; }
if (!access.accessible(ev, privRead, noAccessReturnsNull)) { return null;
ev = postGetEvent((BwEvent)sess.getUnique(), privRead, noAccessReturnsNull); if (ev == null) { return ts; } master = ev; if (!user.equals(ev.getOwner())) { eventQuery(BwEventAnnotation.class, guid, rid, seqnum, true); BwEventAnnotation ann = (BwEventAnnotation)postGetEvent((BwEvent)sess.getUnique(), privRead, noAccessReturnsNull); if (ann != null) { ev = new BwEventProxy(ann); } } ts.add(ev); if ((recurRetrieval == CalFacadeDefs.retrieveRecurMaster) || (!ev.getRecurring())) { return ts; } if (recurRetrieval == CalFacadeDefs.retrieveRecurOverrides) { eventQuery(BwEventAnnotation.class, guid, rid, seqnum, false); Collection ovs = sess.getList(); Collection overrides = new TreeSet(); Iterator it = ovs.iterator(); while (it.hasNext()) { BwEventAnnotation override = (BwEventAnnotation)it.next(); BwEventProxy proxy = (BwEventProxy)postGetEvent( makeProxy(null, override, null, CalFacadeDefs.retrieveRecurExpanded), privRead, noAccessReturnsNull); if (proxy != null) { overrides.add(proxy); } } ts.addAll(overrides); return ts; } StringBuffer sb = new StringBuffer(); sb.append("from "); sb.append(BwRecurrenceInstance.class.getName()); sb.append(" rec "); sb.append(" where rec.master=:master "); if (seqnum != null) { sb.append(" and rec.master.sequence=:seq "); } sess.createQuery(sb.toString()); sess.setEntity("master", master); if (seqnum != null) { sess.setInt("seq", seqnum.intValue()); } Collection instances = sess.getList(); Iterator it = instances.iterator(); while (it.hasNext()) { BwRecurrenceInstance instance = (BwRecurrenceInstance)it.next(); BwEventProxy proxy = makeProxy(instance, null, null, CalFacadeDefs.retrieveRecurExpanded); ts.add(proxy); } return ts;
public BwEvent getEvent(int id) throws CalFacadeException { Criteria cr = sess.createCriteria(BwEventObj.class); cr.add(Expression.eq("id", new Integer(id))); BwEvent ev = (BwEvent)sess.getUnique(); if (!access.accessible(ev, privRead, noAccessReturnsNull)) { return null; } return ev; }
return ev;
eventQuery(BwEventAnnotation.class, guid, rid, seqnum, false); BwEventAnnotation override = (BwEventAnnotation)sess.getUnique(); BwEventProxy proxy; if (override != null) { proxy = makeProxy(null, override, null, CalFacadeDefs.retrieveRecurExpanded); } else { StringBuffer sb = new StringBuffer(); sb.append("from "); sb.append(BwRecurrenceInstance.class.getName()); sb.append(" rec "); sb.append(" where rec.master.guid=:guid "); if (seqnum != null) { sb.append(" and rec.master.sequence=:seq "); } sb.append(" and rec.recurrenceId=:rid "); sess.createQuery(sb.toString()); sess.setString("guid", guid); if (seqnum != null) { sess.setInt("seq", seqnum.intValue()); } sess.setString("rid", rid); BwRecurrenceInstance inst = (BwRecurrenceInstance)sess.getUnique(); if (inst == null) { return ts; } proxy = makeProxy(inst, null, null, CalFacadeDefs.retrieveRecurExpanded); } if ((proxy != null) && (access.accessible(proxy, privRead, noAccessReturnsNull))) { ts.add(proxy); } return ts;
public BwEvent getEvent(int id) throws CalFacadeException { Criteria cr = sess.createCriteria(BwEventObj.class); cr.add(Expression.eq("id", new Integer(id))); BwEvent ev = (BwEvent)sess.getUnique(); if (!access.accessible(ev, privRead, noAccessReturnsNull)) { return null; } return ev; }
HibSession sess = getSess();
public Collection getEvents(BwCalendar calendar, BwFilter filter, BwDateTime startDate, BwDateTime endDate, int recurRetrieval, int currentMode, boolean ignoreCreator) throws CalFacadeException { StringBuffer sb = new StringBuffer(); //if (debug) { // log.debug("getEvents for " + objTimestamp + " start=" + // startDate + " end=" + endDate); //} /* Name of the event in the query */ final String qevName = "ev"; Filters flt = new Filters(filter, sb, qevName, debug); /* SEG: from Events ev where */ sb.append("from "); sb.append(BwEvent.class.getName()); sb.append(" "); sb.append(qevName); sb.append(" where "); /* SEG: (<date-ranges>) and */ if (appendDateTerms(sb, qevName + ".dtstart.date", qevName + ".dtend.date", startDate, endDate)) { sb.append(" and "); } /* Don't retrieve any master records - I guess we might have a choice to retrieve any with the dates in the given range */ sb.append(qevName); sb.append(".recurring = false and "); /* SEG ( */ sb.append(" ("); boolean setUser = doCalendarClause(sb, qevName, calendar, currentMode, ignoreCreator); sb.append(") "); flt.addWhereFilters(); sb.append(" order by "); sb.append(qevName); sb.append(".dtstart.dtval"); //if (debug) { // trace(sb.toString()); //} sess.createQuery(sb.toString()); if (startDate != null) { sess.setString("fromDate", startDate.getDate()); } if (endDate != null) { sess.setString("toDate", endDate.getDate()); } doCalendarEntities(setUser, calendar); flt.parPass(sess); Collection es = sess.getList(); es = postGetEvents(es, privRead, noAccessReturnsNull); /** Run the events we got through the filters */ es = flt.postExec(es); Collection rs = getLimitedRecurrences(calendar, filter, startDate, endDate, currentMode, ignoreCreator, recurRetrieval); if (rs != null) { es.addAll(rs); } return es; }
HibSession sess = getSess();
public Collection getEventsByName(BwCalendar cal, String val) throws CalFacadeException { sess.namedQuery("eventsByName"); sess.setString("name", val); sess.setEntity("cal", cal); Collection evs = sess.getList(); return postGetEvents(evs, privRead, noAccessReturnsNull); }
HibSession sess = getSess();
private Collection getLimitedRecurrences(BwCalendar calendar, BwFilter filter, BwDateTime startDate, BwDateTime endDate, int currentMode, boolean ignoreCreator, int recurRetrieval) throws CalFacadeException { StringBuffer sb = new StringBuffer(); /* Name of the event in the query */ final String qevName = "evr"; Filters flt = new Filters(filter, sb, qevName + ".master", debug); /* SEG: from recurrences evr where */ sb.append("from "); sb.append(BwRecurrenceInstance.class.getName()); sb.append(" "); sb.append(qevName); sb.append(" where "); /* SEG: (<date-ranges>) and Note that we store the string version of the date only so this looks different than for regular events. */ if (appendDateTerms(sb, qevName + ".dtstart.date", qevName + ".dtend.date", startDate, endDate)) { sb.append(" and "); } /* SEG ( */ sb.append(" ("); boolean setUser = doCalendarClause(sb, qevName + ".master", calendar, currentMode, ignoreCreator); sb.append(") "); flt.addWhereFilters(); sb.append(" order by "); sb.append(qevName); sb.append(".dtstart.dtval"); //if (debug) { // debugMsg("recurrences query is " + sb); //} sess.createQuery(sb.toString()); if (startDate != null) { sess.setString("fromDate", startDate.getDate()); } if (endDate != null) { sess.setString("toDate", endDate.getDate()); } doCalendarEntities(setUser, calendar); flt.parPass(sess); Collection rs = sess.getList(); //if (debug) { // debugMsg("recurrences query found " + rs.size()); //} /* We have a collection of recurrence instances, each of which has a * master event attached. For each unique master we should check it's * validity. We will maintain a table of ids we have checked and the result * so we only check once. * * We also handle the processing of the recurRetrieval parameter here. */ CheckMap checked = new CheckMap(); TreeSet evs = new TreeSet(); Iterator it = rs.iterator(); while (it.hasNext()) { BwRecurrenceInstance inst = (BwRecurrenceInstance)it.next(); /* XXX should have a list of overrides that cover */ BwEventProxy proxy = makeProxy(inst, null, checked, recurRetrieval); if (proxy != null) { //if (debug) { // debugMsg("Ev: " + proxy); //} evs.add(proxy); } } //if (debug) { // debugMsg("recurrences after postexec " + evs.size()); //} /** Run the events we got through the filters */ return flt.postExec(evs); }
if (!access.accessible(ev, desiredAccess, noAccessReturnsNull)) {
if (!access.accessible(ev, desiredAccess, nullForNoAccess)) {
private BwEvent postGetEvent(BwEvent ev, int desiredAccess, boolean nullForNoAccess) throws CalFacadeException { if (ev == null) { return null; } if (!access.accessible(ev, desiredAccess, noAccessReturnsNull)) { return null; } /* XXX-ALARM if (currentMode == userMode) { ev.setAlarms(getAlarms(ev, user)); } */ return ev; }
if (access.accessible(ev, desiredAccess, noAccessReturnsNull)) {
if (access.accessible(ev, desiredAccess, nullForNoAccess)) {
private Collection postGetEvents(Collection evs, int desiredAccess, boolean nullForNoAccess) throws CalFacadeException { TreeSet outevs = new TreeSet(); Iterator it = evs.iterator(); while (it.hasNext()) { BwEvent ev = (BwEvent)it.next(); if (access.accessible(ev, desiredAccess, noAccessReturnsNull)) { outevs.add(ev); } } return outevs; }
sess.setEntity("calendar" + calTerm.i, calendar);
getSess().setEntity("calendar" + calTerm.i, calendar);
private void setCalendarEntities(BwCalendar calendar, CalTerm calTerm) throws CalFacadeException { if (calendar.getCalendarCollection()) { // leaf calendar sess.setEntity("calendar" + calTerm.i, calendar); calTerm.i++; } else { Iterator it = calendar.getChildren().iterator(); while (it.hasNext()) { setCalendarEntities((BwCalendar)it.next(), calTerm); } } }
HibSession sess = getSess();
public void updateEvent(BwEvent val) throws CalFacadeException { if (!(val instanceof BwEventProxy)) { sess.saveOrUpdate(val); if (val.getRecurring()) { /* Check the instances and see if any changes need to be made. */ updateRecurrences(val); } return; } /* Save the annotation. */ BwEventProxy proxy = (BwEventProxy)val; if (!proxy.getRefChanged()) { return; } /* if this is a proxy for a recurrence instance of our own event then the recurrence instance should point at this override. Otherwise we just update the event annotation. */ BwEventAnnotation override = proxy.getRef(); if (debug) { debugMsg("Update override event " + override); } BwEvent mstr = override.getTarget(); while (mstr instanceof BwEventAnnotation) { /* XXX The master may itself be an annotated event. We should really stop when we get to that point */ /* BwEventProxy tempProxy = new BwEventProxy(mstr); if (some-condition-holds) { break; } */ mstr = ((BwEventAnnotation)mstr).getTarget(); } if (mstr.getOwner().equals(user) && mstr.getRecurring()) { // Our own and a recurring event - retrieve the instance // from the recurrences table StringBuffer sb = new StringBuffer(); sb.append("from "); sb.append(BwRecurrenceInstance.class.getName()); sb.append(" rec "); sb.append(" where rec.master=:mstr "); sb.append(" and rec.recurrenceId=:rid "); sess.createQuery(sb.toString()); sess.setEntity("mstr", mstr); sess.setString("rid", override.getRecurrence().getRecurrenceId()); BwRecurrenceInstance inst = (BwRecurrenceInstance)sess.getUnique(); if (inst == null) { throw new CalFacadeException("Cannot locate instance for " + mstr + "with recurrence id " + override.getRecurrence().getRecurrenceId()); } sess.saveOrUpdate(override);// sess.flush(); if (inst.getOverride() == null) { inst.setOverride(override); sess.saveOrUpdate(inst); } } else { sess.saveOrUpdate(override); } proxy.setRefChanged(false); }
HibSession sess = getSess();
private void updateRecurrences(BwEvent val) throws CalFacadeException { VEvent vev = VEventUtil.toIcalEvent(val, null); /* Determine the absolute latest date. */ Date latest = VEventUtil.getLatestRecurrenceDate(vev, debug); if (latest == null) { /* Unlimited recurrences. No more to do here * We could optionally choose to limit these to say 3 years */ return; } CalTimezones tzs = cal.getTimezones(); DtStart vstart = vev.getStartDate(); String stzid = CalFacadeUtil.getTzid(vstart); TimeZone stz = null; if (stzid != null) { stz = tzs.getTimeZone(stzid); } val.getRecurrence().setLatestDate(tzs.getUtc(latest.toString(), stzid, stz)); /* Get all the times for this event. - this could be a problem. Need to limit the number. Should we do this in chunks, stepping through the whole period? */ Date start = vev.getStartDate().getDate(); PeriodList pl = vev.getConsumedTime(start, latest); Iterator it = pl.iterator(); boolean dateOnly = val.getDtstart().getDateType(); Collection updated = new TreeSet(); while (it.hasNext()) { Period p = (Period)it.next(); BwDateTime rstart = new BwDateTime(); rstart.init(dateOnly, p.getStart().toString(), stzid, tzs); BwDateTime rend = new BwDateTime(); rend.init(dateOnly, p.getEnd().toString(), stzid, tzs); BwRecurrenceInstance ri = new BwRecurrenceInstance(); ri.setDtstart(rstart); ri.setDtend(rend); ri.setRecurrenceId(ri.getDtstart().getDate()); ri.setMaster(val); updated.add(ri); } StringBuffer sb = new StringBuffer(); sb.append("from "); sb.append(BwRecurrenceInstance.class.getName()); sb.append(" where master=:master"); sess.createQuery(sb.toString()); sess.setEntity("master", val); Collection current = sess.getList(); it = updated.iterator(); while (it.hasNext()) { BwRecurrenceInstance ri = (BwRecurrenceInstance)it.next(); if (!current.contains(ri)) { sess.save(ri); } } it = current.iterator(); while (it.hasNext()) { BwRecurrenceInstance ri = (BwRecurrenceInstance)it.next(); if (!updated.contains(ri)) { sess.delete(ri); } } }
public CalFacadeException(String s) { super(s);
public CalFacadeException() { super();
public CalFacadeException(String s) { super(s); }
public TimeZone getTimeZone(final String id) throws CalFacadeException;
public abstract TimeZone getTimeZone(final String id) throws CalFacadeException;
public TimeZone getTimeZone(final String id) throws CalFacadeException;
public String getUtc(String time, String tzid, TimeZone tz) throws CalFacadeException;
public synchronized String getUtc(String time, String tzid, TimeZone tz) throws CalFacadeException { if (CalFacadeUtil.isISODateTimeUTC(time)) { return time; } if (CalFacadeUtil.isISODate(time)) { time += "T000000"; } else if (!CalFacadeUtil.isISODateTime(time)) { throw new CalFacadeBadDateException(); } try { boolean tzchanged = false; if (tz == null) { if (tzid == null) { if ((lasttzid != null) || (lasttz == null)) { lasttz = TimeZone.getDefault(); tzchanged = true; } } else { if ((lasttzid == null) || (!lasttzid.equals(tzid))) { lasttz = getTimeZone(tzid); if (lasttz == null) { lasttzid = null; throw new CalFacadeBadDateException(); } tzchanged = true; } } } else { if (tz != lasttz) { tzchanged = true; tzid = tz.getID(); lasttz = tz; } } if (tzchanged) { if (debug) { trace("**********tzchanged for tzid " + tzid); } formatTd.setTimeZone(lasttz); lasttzid = tzid; } cal.setTime(formatTd.parse(time)); StringBuffer sb = new StringBuffer(); digit4(sb, cal.get(Calendar.YEAR)); digit2(sb, cal.get(Calendar.MONTH) + 1); digit2(sb, cal.get(Calendar.DAY_OF_MONTH)); sb.append('T'); digit2(sb, cal.get(Calendar.HOUR_OF_DAY)); digit2(sb, cal.get(Calendar.MINUTE)); digit2(sb, cal.get(Calendar.SECOND)); sb.append('Z'); return sb.toString(); } catch (Throwable t) { t.printStackTrace(); throw new CalFacadeBadDateException(); } }
public String getUtc(String time, String tzid, TimeZone tz) throws CalFacadeException;
boolean all = (currentMode == guestMode) || ignoreCreator;
boolean all = publicEvents || ignoreCreator;
static boolean appendPublicOrCreatorTerm(StringBuffer sb, String entName, int currentMode, boolean ignoreCreator) throws CalFacadeException { boolean publicEvents = (currentMode == guestMode) || (currentMode == publicAdminMode); boolean all = (currentMode == guestMode) || ignoreCreator; boolean setUser = false; sb.append("("); if (!all) { sb.append("("); } sb.append(entName); sb.append(".publick="); sb.append(String.valueOf(publicEvents)); if (!all) { sb.append(") and ("); sb.append(entName); sb.append(".creator=:user"); sb.append(")"); setUser = true; } sb.append(")"); return setUser; }
public MemoryDataSetSeismogram(LocalSeismogramImpl seis) { this(makeSeisArray(seis), null); }
public MemoryDataSetSeismogram(RequestFilter requestFilter, String name) { super(null, name, requestFilter); seisCache = new LocalSeismogramImpl[0]; }
public MemoryDataSetSeismogram(LocalSeismogramImpl seis) { this(makeSeisArray(seis), null); }
System.out.println(seismo + " amp range: " + min + ", " + max + " Points: " + seisIndex[0] + ", " + seisIndex[1]);
private boolean setAmpRange(DataSetSeismogram seismo){ AmpConfigData data = (AmpConfigData)ampData.get(seismo); LocalSeismogramImpl seis = (LocalSeismogramImpl)seismo.getSeismogram(); int[] seisIndex = DisplayUtils.getSeisPoints(seis, data.getTime()); if(seisIndex[1] < 0 || seisIndex[0] >= seis.getNumPoints()) { //no data points in window, set range to 0 data.setCalcIndex(seisIndex); return data.setCleanRange(DisplayUtils.ZERO_RANGE); } if(seisIndex[0] < 0){ seisIndex[0] = 0; } if(seisIndex[1] >= seis.getNumPoints()){ seisIndex[1] = seis.getNumPoints() -1; } double[] minMaxMean = ((Statistics)DisplayUtils.statCache.get(seismo)).minMaxMean(seisIndex[0], seisIndex[1]); double meanDiff; double maxToMeanDiff = Math.abs(minMaxMean[2] - minMaxMean[1]); double minToMeanDiff = Math.abs(minMaxMean[2] - minMaxMean[0]); if(maxToMeanDiff > minToMeanDiff){ meanDiff = maxToMeanDiff; }else{ meanDiff = minToMeanDiff; } data.setCalcIndex(seisIndex); double min = minMaxMean[2] - meanDiff; double max = minMaxMean[2] + meanDiff; System.out.println(seismo + " amp range: " + min + ", " + max + " Points: " + seisIndex[0] + ", " + seisIndex[1]); return data.setCleanRange(new UnitRangeImpl(min, max, UnitImpl.COUNT)); }
public double[] minMaxMean(int beginIndex, int endIndex){ if (beginIndex < 0 ) { throw new IllegalArgumentException("begin Index < 0 "+beginIndex); } if (endIndex > getLength() ) { throw new IllegalArgumentException("end Index > data length "+endIndex); } if(minMaxMeanCalculated){ if(beginIndex == this.beginIndex && endIndex == this.endIndex){ return minMaxMean; } flushCache(); if(this.beginIndex > beginIndex && this.endIndex < endIndex || this.beginIndex < beginIndex && this.endIndex > endIndex){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } int removalStart, removalEnd, newDataStart, newDataEnd; if(this.beginIndex < beginIndex || this.endIndex < endIndex){ removalStart = this.beginIndex; removalEnd = beginIndex - 1; newDataStart = this.endIndex; newDataEnd = endIndex - 1; }else{ removalStart = endIndex; removalEnd = this.endIndex - 1; newDataStart = beginIndex; newDataEnd = this.beginIndex; } minMaxMean[2] *= this.endIndex - this.beginIndex; if(iSeries != null){ for(int j = removalStart; j <= removalEnd; j++) { if(iSeries[j] <= minMaxMean[0]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } if(iSeries[j] >= minMaxMean[1]){ minMaxMean= calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } minMaxMean[2] -= iSeries[j]; } for(int j = newDataStart; j <= newDataEnd; j++) { if(iSeries[j] < minMaxMean[0]){ minMaxMean[0] = iSeries[j]; } if(iSeries[j] > minMaxMean[1]){ minMaxMean[1] = iSeries[j]; } minMaxMean[2] += iSeries[j]; } }else if(sSeries != null){ for(int j = removalStart; j <= removalEnd; j++) { if(sSeries[j] <= minMaxMean[0]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } if(sSeries[j] >= minMaxMean[1]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } minMaxMean[2] -= sSeries[j]; } for(int j = newDataStart; j <= newDataEnd; j++) { if(sSeries[j] < minMaxMean[0]){ minMaxMean[0] = sSeries[j]; } if(sSeries[j] > minMaxMean[1]){ minMaxMean[1] = sSeries[j]; } minMaxMean[2] += sSeries[j]; } }else if(fSeries != null){ for(int j = removalStart; j <= removalEnd; j++) { if(fSeries[j] <= minMaxMean[0]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } if(fSeries[j] >= minMaxMean[1]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } minMaxMean[2] -= fSeries[j]; } for(int j = newDataStart; j <= newDataEnd; j++) { if(fSeries[j] < minMaxMean[0]){ minMaxMean[0] = fSeries[j]; } if(fSeries[j] > minMaxMean[1]){ minMaxMean[1] = fSeries[j]; } minMaxMean[2] += fSeries[j]; } }else if(dSeries != null){ for(int j = removalStart; j <= removalEnd; j++) { if(dSeries[j] <= minMaxMean[0]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } if(dSeries[j] >= minMaxMean[1]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } minMaxMean[2] -= dSeries[j]; } for(int j = newDataStart; j <= newDataEnd; j++) { if(dSeries[j] < minMaxMean[0]){ minMaxMean[0] = dSeries[j]; } if(dSeries[j] > minMaxMean[1]){ minMaxMean[1] = dSeries[j]; } minMaxMean[2] += dSeries[j]; } } this.beginIndex = beginIndex; this.endIndex = endIndex; minMaxMeanCalculated = true; return minMaxMean;
public double[] minMaxMean(){ return minMaxMean(0, getLength());
public double[] minMaxMean(int beginIndex, int endIndex){ if (beginIndex < 0 ) { throw new IllegalArgumentException("begin Index < 0 "+beginIndex); } // end of if (beginIndex < 0 ) if (endIndex > getLength() ) { throw new IllegalArgumentException("end Index > data length "+endIndex); } // end of if (beginIndex < 0 ) if(minMaxMeanCalculated){ if(beginIndex == this.beginIndex && endIndex == this.endIndex){ return minMaxMean; } // begin or end has changed, destory any cached values flushCache(); if(this.beginIndex > beginIndex && this.endIndex < endIndex || this.beginIndex < beginIndex && this.endIndex > endIndex){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } int removalStart, removalEnd, newDataStart, newDataEnd; if(this.beginIndex < beginIndex || this.endIndex < endIndex){ removalStart = this.beginIndex; removalEnd = beginIndex - 1; newDataStart = this.endIndex; newDataEnd = endIndex - 1; }else{ removalStart = endIndex; removalEnd = this.endIndex - 1; newDataStart = beginIndex; newDataEnd = this.beginIndex; } minMaxMean[2] *= this.endIndex - this.beginIndex; if(iSeries != null){ for(int j = removalStart; j <= removalEnd; j++) { if(iSeries[j] <= minMaxMean[0]){ // if min is found in remave section reaclulate minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } if(iSeries[j] >= minMaxMean[1]){ // if max is found in remove section reaclulate minMaxMean= calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } minMaxMean[2] -= iSeries[j]; } for(int j = newDataStart; j <= newDataEnd; j++) { if(iSeries[j] < minMaxMean[0]){ minMaxMean[0] = iSeries[j]; } if(iSeries[j] > minMaxMean[1]){ minMaxMean[1] = iSeries[j]; } minMaxMean[2] += iSeries[j]; } }else if(sSeries != null){ for(int j = removalStart; j <= removalEnd; j++) { if(sSeries[j] <= minMaxMean[0]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } if(sSeries[j] >= minMaxMean[1]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } minMaxMean[2] -= sSeries[j]; } for(int j = newDataStart; j <= newDataEnd; j++) { if(sSeries[j] < minMaxMean[0]){ minMaxMean[0] = sSeries[j]; } if(sSeries[j] > minMaxMean[1]){ minMaxMean[1] = sSeries[j]; } minMaxMean[2] += sSeries[j]; } }else if(fSeries != null){ for(int j = removalStart; j <= removalEnd; j++) { if(fSeries[j] <= minMaxMean[0]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } if(fSeries[j] >= minMaxMean[1]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } minMaxMean[2] -= fSeries[j]; } for(int j = newDataStart; j <= newDataEnd; j++) { if(fSeries[j] < minMaxMean[0]){ minMaxMean[0] = fSeries[j]; } if(fSeries[j] > minMaxMean[1]){ minMaxMean[1] = fSeries[j]; } minMaxMean[2] += fSeries[j]; } }else if(dSeries != null){ for(int j = removalStart; j <= removalEnd; j++) { if(dSeries[j] <= minMaxMean[0]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } if(dSeries[j] >= minMaxMean[1]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } minMaxMean[2] -= dSeries[j]; } for(int j = newDataStart; j <= newDataEnd; j++) { if(dSeries[j] < minMaxMean[0]){ minMaxMean[0] = dSeries[j]; } if(dSeries[j] > minMaxMean[1]){ minMaxMean[1] = dSeries[j]; } minMaxMean[2] += dSeries[j]; } } this.beginIndex = beginIndex; this.endIndex = endIndex; minMaxMeanCalculated = true; return minMaxMean; } minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; }
minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; }
public double[] minMaxMean(int beginIndex, int endIndex){ if (beginIndex < 0 ) { throw new IllegalArgumentException("begin Index < 0 "+beginIndex); } // end of if (beginIndex < 0 ) if (endIndex > getLength() ) { throw new IllegalArgumentException("end Index > data length "+endIndex); } // end of if (beginIndex < 0 ) if(minMaxMeanCalculated){ if(beginIndex == this.beginIndex && endIndex == this.endIndex){ return minMaxMean; } // begin or end has changed, destory any cached values flushCache(); if(this.beginIndex > beginIndex && this.endIndex < endIndex || this.beginIndex < beginIndex && this.endIndex > endIndex){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } int removalStart, removalEnd, newDataStart, newDataEnd; if(this.beginIndex < beginIndex || this.endIndex < endIndex){ removalStart = this.beginIndex; removalEnd = beginIndex - 1; newDataStart = this.endIndex; newDataEnd = endIndex - 1; }else{ removalStart = endIndex; removalEnd = this.endIndex - 1; newDataStart = beginIndex; newDataEnd = this.beginIndex; } minMaxMean[2] *= this.endIndex - this.beginIndex; if(iSeries != null){ for(int j = removalStart; j <= removalEnd; j++) { if(iSeries[j] <= minMaxMean[0]){ // if min is found in remave section reaclulate minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } if(iSeries[j] >= minMaxMean[1]){ // if max is found in remove section reaclulate minMaxMean= calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } minMaxMean[2] -= iSeries[j]; } for(int j = newDataStart; j <= newDataEnd; j++) { if(iSeries[j] < minMaxMean[0]){ minMaxMean[0] = iSeries[j]; } if(iSeries[j] > minMaxMean[1]){ minMaxMean[1] = iSeries[j]; } minMaxMean[2] += iSeries[j]; } }else if(sSeries != null){ for(int j = removalStart; j <= removalEnd; j++) { if(sSeries[j] <= minMaxMean[0]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } if(sSeries[j] >= minMaxMean[1]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } minMaxMean[2] -= sSeries[j]; } for(int j = newDataStart; j <= newDataEnd; j++) { if(sSeries[j] < minMaxMean[0]){ minMaxMean[0] = sSeries[j]; } if(sSeries[j] > minMaxMean[1]){ minMaxMean[1] = sSeries[j]; } minMaxMean[2] += sSeries[j]; } }else if(fSeries != null){ for(int j = removalStart; j <= removalEnd; j++) { if(fSeries[j] <= minMaxMean[0]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } if(fSeries[j] >= minMaxMean[1]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } minMaxMean[2] -= fSeries[j]; } for(int j = newDataStart; j <= newDataEnd; j++) { if(fSeries[j] < minMaxMean[0]){ minMaxMean[0] = fSeries[j]; } if(fSeries[j] > minMaxMean[1]){ minMaxMean[1] = fSeries[j]; } minMaxMean[2] += fSeries[j]; } }else if(dSeries != null){ for(int j = removalStart; j <= removalEnd; j++) { if(dSeries[j] <= minMaxMean[0]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } if(dSeries[j] >= minMaxMean[1]){ minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; } minMaxMean[2] -= dSeries[j]; } for(int j = newDataStart; j <= newDataEnd; j++) { if(dSeries[j] < minMaxMean[0]){ minMaxMean[0] = dSeries[j]; } if(dSeries[j] > minMaxMean[1]){ minMaxMean[1] = dSeries[j]; } minMaxMean[2] += dSeries[j]; } } this.beginIndex = beginIndex; this.endIndex = endIndex; minMaxMeanCalculated = true; return minMaxMean; } minMaxMean = calculateMinMaxMean(beginIndex, endIndex); return minMaxMean; }
String s = "*** "+ file.toString() + ((playing) ? Messages.getString("MainPanel.PLAYING") : "");
String s = file.toString(); if (playing) { s = "***"+ s + Messages.getString("MainPanel.PLAYING"); }
public void update(File file, boolean playing) { String s = "*** "+ file.toString() + ((playing) ? Messages.getString("MainPanel.PLAYING") : ""); //$NON-NLS-1$ //$NON-NLS-2$ setText(s); DefaultListModel listModel = playlist.getListModel(); int index = listModel.indexOf(file); ListDataListener[] listeners = listModel.getListDataListeners(); ListDataEvent e = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index, index); for (int i = 0; i < listeners.length; i++) { listeners[i].contentsChanged(e); } }
public void play(int index) { System.out.println("play("+index+")"); if (index > list.size()) { throw new RuntimeException("index = "+ index +" > list.size() = "+ list.size());
public void play() { if (playingIndex < 0) { playingIndex = 0;
public void play(int index) { System.out.println("play("+index+")"); if (index > list.size()) { throw new RuntimeException("index = "+ index +" > list.size() = "+ list.size()); } playingIndex = index; if (isPlaying()) { player.stop(); } try { final File file = (File)list.get(index); player = new MP3Player(file); player.addListener(passthroughPlayerListener); player.addListener(configPlayerListener); Thread thread = new Thread() { public void run() { try { player.play(); } catch (Exception exc) { exc.printStackTrace(); } } }; thread.setDaemon(true); thread.start(); } catch (Exception exc) { exc.printStackTrace(); } }
playingIndex = index; if (isPlaying()) { player.stop(); } try { final File file = (File)list.get(index); player = new MP3Player(file); player.addListener(passthroughPlayerListener); player.addListener(configPlayerListener); Thread thread = new Thread() { public void run() { try { player.play(); } catch (Exception exc) { exc.printStackTrace(); } } }; thread.setDaemon(true); thread.start(); } catch (Exception exc) { exc.printStackTrace(); }
play(playingIndex);
public void play(int index) { System.out.println("play("+index+")"); if (index > list.size()) { throw new RuntimeException("index = "+ index +" > list.size() = "+ list.size()); } playingIndex = index; if (isPlaying()) { player.stop(); } try { final File file = (File)list.get(index); player = new MP3Player(file); player.addListener(passthroughPlayerListener); player.addListener(configPlayerListener); Thread thread = new Thread() { public void run() { try { player.play(); } catch (Exception exc) { exc.printStackTrace(); } } }; thread.setDaemon(true); thread.start(); } catch (Exception exc) { exc.printStackTrace(); } }
public File getFile();
public abstract File getFile();
public File getFile();
public void add(File f) { list.addElement(f);
public void add(File[] f) { if (f != null) { for (int i = 0; i < f.length; i++) { add(f[i]); } }
public void add(File f) { list.addElement(f); }
return new EtoolsProxyCommand(modelCmd);
return new ICommandProxy(modelCmd);
protected Command getMSLWrapper(ICommand cmd) { TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) .getEditingDomain(); CompositeTransactionalCommand modelCmd = new CompositeTransactionalCommand( editingDomain, cmd.getLabel()); modelCmd.compose(cmd); return new EtoolsProxyCommand(modelCmd); }
semanticCommand = semanticCommand.chain(new EtoolsProxyCommand(
semanticCommand = semanticCommand.chain(new ICommandProxy(
protected Command getSemanticCommand(IEditCommandRequest request) { IEditCommandRequest completedRequest = completeRequest(request); Command semanticCommand = getSemanticCommandSwitch(completedRequest); if (semanticCommand == null) { return UnexecutableCommand.INSTANCE; } boolean shouldProceed = true; if (completedRequest instanceof DestroyRequest) { shouldProceed = shouldProceed((DestroyRequest) completedRequest); } if (shouldProceed) { if (completedRequest instanceof DestroyRequest) { ICommand deleteCommand = new DeleteCommand((View) getHost() .getModel()); semanticCommand = semanticCommand.chain(new EtoolsProxyCommand( deleteCommand)); } return semanticCommand; } return UnexecutableCommand.INSTANCE; }
QueryResult queryResult = sqlBridge.executeQueries(sqlQuery, numberOfRows, executedSQLStatements);
QueryResultSession sessionBean = (QueryResultSession) IBOLookup.getSessionInstance(iwc, QueryResultSession.class); QueryResult queryResult = null; if (iwc.isParameterSet(NUMBER_OF_ROWS_KEY)) { Map identifierValueMap = sqlQuery.getIdentifierValueMap(); queryResult = sessionBean.getQueryResult(identifierValueMap); if (queryResult != null) { queryResult.setDesiredNumberOfRows(numberOfRows); } } if (queryResult == null) { queryResult = sqlBridge.executeQueries(sqlQuery, numberOfRows, executedSQLStatements); }
private String executeQueries(SQLQuery sqlQuery, int numberOfRows, QueryToSQLBridge sqlBridge, List executedSQLStatements, IWResourceBundle resourceBundle, IWContext iwc) throws RemoteException { QueryResult queryResult = sqlBridge.executeQueries(sqlQuery, numberOfRows, executedSQLStatements); // check if everything is fine if (queryResult == null) { // serious error. // It's very likely that the server has chrashed before without removing all created views. // In that case a new view with the same name can't be created - the database will throw an error. return resourceBundle.getLocalizedString("ro_execution_of_query_failed", "Execution of query failed."); } if (queryResult.isEmpty()) { // nothing to do, result is empty, that is not an error return resourceBundle.getLocalizedString("ro_result_of_query_is_empty", "Result of query is empty"); } resultNumberOfRows = queryResult.getNumberOfRows(); // that means: if the user has set number of rows to 12 000 and the result contains 11 000 rows // nothing happens even if MAX_NUMBER_OF_ROWS_IN_RESULT is only set to 500 if (resultNumberOfRows > numberOfRows && resultNumberOfRows > QueryConstants.MAX_NUMBER_OF_ROWS_IN_RESULT) { String error = resourceBundle.getLocalizedString("ro_number_of_rows_in result _might_be_too_large", "Number of rows might be too large"); String rows = resourceBundle.getLocalizedString("ro_rows","rows"); StringBuffer buffer = new StringBuffer(error); buffer.append(": ").append(resultNumberOfRows).append(" ").append(rows); return buffer.toString(); } resultNumberOfRows = -1; // get design JasperReportBusiness reportBusiness = getReportBusiness(); DesignBox designBox = getDesignBox(sqlQuery, reportBusiness, resourceBundle, iwc); // check if the design is fine if (designBox == null) { return resourceBundle.getLocalizedString("ro_design_is_not available", "Problems with the chosen layout occurred."); } // synchronize design and result Map designParameters = new HashMap(); designParameters.put(REPORT_HEADLINE_KEY, sqlQuery.getName()); JasperPrint print = reportBusiness.printSynchronizedReport(queryResult, designParameters, designBox); if (print == null) { return resourceBundle.getLocalizedString("ro_could_not_use_layout", "Layout can't be used"); } // create html report String uri; if (PDF_KEY.equals(outputFormat)) { uri = reportBusiness.getPdfReport(print, "report"); } else if (EXCEL_KEY.equals(outputFormat)) { uri = reportBusiness.getExcelReport(print, "report"); } else { uri = reportBusiness.getHtmlReport(print, "report"); } Page parentPage = getParentPage(); if("true".equals(getBundle(iwc).getProperty(ADD_QUERY_SQL_FOR_DEBUG,"false"))){ addExecutedSQLQueries(executedSQLStatements); add(new Text("ADD_QUERY_SQL_FOR_DEBUG is true, result is shown in pop up window!")); parentPage.setOnLoad(" openwindow('" + uri + "','IdegaWeb Generated Report','0','0','0','0','0','1','1','1','800','600') "); } else { parentPage.setToRedirect(uri); } // open an extra window with scrollbars //getParentPage().setOnLoad("window.open('" + uri + "' , 'newWin', 'width=600,height=400,scrollbars=yes')"); //openwindow(Address,Name,ToolBar,Location,Directories,Status,Menubar,Titlebar,Scrollbars,Resizable,Width,Height) //getParentPage().setOnLoad(" openwindow('" + uri + "','IdegaWeb Generated Report','0','0','0','0','0','1','1','1','800','600') "); return null; }
sessionBean.deleteQueryResult();
private String executeQueries(SQLQuery sqlQuery, int numberOfRows, QueryToSQLBridge sqlBridge, List executedSQLStatements, IWResourceBundle resourceBundle, IWContext iwc) throws RemoteException { QueryResult queryResult = sqlBridge.executeQueries(sqlQuery, numberOfRows, executedSQLStatements); // check if everything is fine if (queryResult == null) { // serious error. // It's very likely that the server has chrashed before without removing all created views. // In that case a new view with the same name can't be created - the database will throw an error. return resourceBundle.getLocalizedString("ro_execution_of_query_failed", "Execution of query failed."); } if (queryResult.isEmpty()) { // nothing to do, result is empty, that is not an error return resourceBundle.getLocalizedString("ro_result_of_query_is_empty", "Result of query is empty"); } resultNumberOfRows = queryResult.getNumberOfRows(); // that means: if the user has set number of rows to 12 000 and the result contains 11 000 rows // nothing happens even if MAX_NUMBER_OF_ROWS_IN_RESULT is only set to 500 if (resultNumberOfRows > numberOfRows && resultNumberOfRows > QueryConstants.MAX_NUMBER_OF_ROWS_IN_RESULT) { String error = resourceBundle.getLocalizedString("ro_number_of_rows_in result _might_be_too_large", "Number of rows might be too large"); String rows = resourceBundle.getLocalizedString("ro_rows","rows"); StringBuffer buffer = new StringBuffer(error); buffer.append(": ").append(resultNumberOfRows).append(" ").append(rows); return buffer.toString(); } resultNumberOfRows = -1; // get design JasperReportBusiness reportBusiness = getReportBusiness(); DesignBox designBox = getDesignBox(sqlQuery, reportBusiness, resourceBundle, iwc); // check if the design is fine if (designBox == null) { return resourceBundle.getLocalizedString("ro_design_is_not available", "Problems with the chosen layout occurred."); } // synchronize design and result Map designParameters = new HashMap(); designParameters.put(REPORT_HEADLINE_KEY, sqlQuery.getName()); JasperPrint print = reportBusiness.printSynchronizedReport(queryResult, designParameters, designBox); if (print == null) { return resourceBundle.getLocalizedString("ro_could_not_use_layout", "Layout can't be used"); } // create html report String uri; if (PDF_KEY.equals(outputFormat)) { uri = reportBusiness.getPdfReport(print, "report"); } else if (EXCEL_KEY.equals(outputFormat)) { uri = reportBusiness.getExcelReport(print, "report"); } else { uri = reportBusiness.getHtmlReport(print, "report"); } Page parentPage = getParentPage(); if("true".equals(getBundle(iwc).getProperty(ADD_QUERY_SQL_FOR_DEBUG,"false"))){ addExecutedSQLQueries(executedSQLStatements); add(new Text("ADD_QUERY_SQL_FOR_DEBUG is true, result is shown in pop up window!")); parentPage.setOnLoad(" openwindow('" + uri + "','IdegaWeb Generated Report','0','0','0','0','0','1','1','1','800','600') "); } else { parentPage.setToRedirect(uri); } // open an extra window with scrollbars //getParentPage().setOnLoad("window.open('" + uri + "' , 'newWin', 'width=600,height=400,scrollbars=yes')"); //openwindow(Address,Name,ToolBar,Location,Directories,Status,Menubar,Titlebar,Scrollbars,Resizable,Width,Height) //getParentPage().setOnLoad(" openwindow('" + uri + "','IdegaWeb Generated Report','0','0','0','0','0','1','1','1','800','600') "); return null; }
Iterator iterator = identifierValueMap.entrySet().iterator();
Set keySet = identifierValueMap.keySet(); String[] keys = (String[]) keySet.toArray(new String[keySet.size()]); Arrays.sort(keys,new StringNumberComparator());
private PresentationObject getInputFields(String queryName, String queryDescription, Map identifierValueMap, Map identifierInputDescriptionMap, IWResourceBundle resourceBundle, IWContext iwc) { // create a nice headline for the confused user String currentQuery = StringHandler.concat(resourceBundle.getLocalizedString("ro_current_query", "Current Query"),":"); Text currentQueryHeader = new Text(currentQuery); currentQueryHeader.setBold(); add(currentQueryHeader); add(Text.getBreak()); Text text = new Text(queryName); text.setBold(); add(text); if (queryDescription != null) { add(Text.getBreak()); String descriptionHeader = StringHandler.concat(resourceBundle.getLocalizedString("ro_query_description", "Query description"),":"); Text descriptionHeaderText = new Text(descriptionHeader); descriptionHeaderText.setBold(); add(descriptionHeaderText); add(Text.getBreak()); Text queryDescriptionText = new Text(queryDescription); queryDescriptionText.setBold(); add(queryDescriptionText); } Table table = null; int i = 1; // special case: ask for the desired number of rows if (resultNumberOfRows != -1) { table = new Table (2, identifierValueMap.size() + 2); Text desiredNumberOfRowsText = new Text(resourceBundle.getLocalizedString("ro_set_number_of_max_rows", "Set number of max rows")); table.add(desiredNumberOfRowsText, 1, i ); TextInput numberOfRowsInput = new TextInput(NUMBER_OF_ROWS_KEY, Integer.toString(resultNumberOfRows)); table.add(numberOfRowsInput, 2, i ); i++; } else { table = new Table (2, identifierValueMap.size() + 1); } Iterator iterator = identifierValueMap.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); String key = (String) entry.getKey(); if (! DirectSQLStatement.USER_ACCESS_VARIABLE.equals(key) && ! DirectSQLStatement.GROUP_ACCESS_VARIABLE.equals(key) && ! DirectSQLStatement.USER_GROUP_ACCESS_VARIABLE.endsWith(key)) { InputDescription inputDescription = (InputDescription) identifierInputDescriptionMap.get(key); Object object = identifierValueMap.get(key); String inputHandlerClass = inputDescription.getInputHandler(); String description = inputDescription.getDescription(); InputHandler inputHandler = getInputHandler(inputHandlerClass); PresentationObject input = null; if (inputHandler == null) { String value = (object instanceof List) ? ((String) ((List) object).get(0)) : object.toString(); input = new TextInput(key, value); } else if (object instanceof Collection) { Collection value = (Collection) object; input = inputHandler.getHandlerObject(key, value, iwc); } else { String value = object.toString(); input = inputHandler.getHandlerObject(key, value, iwc); } table.add(description, 1, i); table.add(input, 2, i++); } } String okayText = resourceBundle.getLocalizedString("ro_okay", "ok"); SubmitButton okayButton = new SubmitButton(okayText, EXECUTE_QUERY_KEY, "default_value"); okayButton.setAsImageButton(true); PresentationObject goBack = getGoBackButton(resourceBundle); table.add(goBack, 1, i); table.add(okayButton, 1, i); return table; }
while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); String key = (String) entry.getKey();
for (int j = 0; j < keys.length; j++) { String key = keys[j];
private PresentationObject getInputFields(String queryName, String queryDescription, Map identifierValueMap, Map identifierInputDescriptionMap, IWResourceBundle resourceBundle, IWContext iwc) { // create a nice headline for the confused user String currentQuery = StringHandler.concat(resourceBundle.getLocalizedString("ro_current_query", "Current Query"),":"); Text currentQueryHeader = new Text(currentQuery); currentQueryHeader.setBold(); add(currentQueryHeader); add(Text.getBreak()); Text text = new Text(queryName); text.setBold(); add(text); if (queryDescription != null) { add(Text.getBreak()); String descriptionHeader = StringHandler.concat(resourceBundle.getLocalizedString("ro_query_description", "Query description"),":"); Text descriptionHeaderText = new Text(descriptionHeader); descriptionHeaderText.setBold(); add(descriptionHeaderText); add(Text.getBreak()); Text queryDescriptionText = new Text(queryDescription); queryDescriptionText.setBold(); add(queryDescriptionText); } Table table = null; int i = 1; // special case: ask for the desired number of rows if (resultNumberOfRows != -1) { table = new Table (2, identifierValueMap.size() + 2); Text desiredNumberOfRowsText = new Text(resourceBundle.getLocalizedString("ro_set_number_of_max_rows", "Set number of max rows")); table.add(desiredNumberOfRowsText, 1, i ); TextInput numberOfRowsInput = new TextInput(NUMBER_OF_ROWS_KEY, Integer.toString(resultNumberOfRows)); table.add(numberOfRowsInput, 2, i ); i++; } else { table = new Table (2, identifierValueMap.size() + 1); } Iterator iterator = identifierValueMap.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); String key = (String) entry.getKey(); if (! DirectSQLStatement.USER_ACCESS_VARIABLE.equals(key) && ! DirectSQLStatement.GROUP_ACCESS_VARIABLE.equals(key) && ! DirectSQLStatement.USER_GROUP_ACCESS_VARIABLE.endsWith(key)) { InputDescription inputDescription = (InputDescription) identifierInputDescriptionMap.get(key); Object object = identifierValueMap.get(key); String inputHandlerClass = inputDescription.getInputHandler(); String description = inputDescription.getDescription(); InputHandler inputHandler = getInputHandler(inputHandlerClass); PresentationObject input = null; if (inputHandler == null) { String value = (object instanceof List) ? ((String) ((List) object).get(0)) : object.toString(); input = new TextInput(key, value); } else if (object instanceof Collection) { Collection value = (Collection) object; input = inputHandler.getHandlerObject(key, value, iwc); } else { String value = object.toString(); input = inputHandler.getHandlerObject(key, value, iwc); } table.add(description, 1, i); table.add(input, 2, i++); } } String okayText = resourceBundle.getLocalizedString("ro_okay", "ok"); SubmitButton okayButton = new SubmitButton(okayText, EXECUTE_QUERY_KEY, "default_value"); okayButton.setAsImageButton(true); PresentationObject goBack = getGoBackButton(resourceBundle); table.add(goBack, 1, i); table.add(okayButton, 1, i); return table; }
List groupIds = new ArrayList(); User user = iwc.getCurrentUser(); UserBusiness userBusiness = getUserBusiness(); GroupBusiness groupBusiness = getGroupBusiness(); Collection topGroupNodes = userBusiness.getUsersTopGroupNodesByViewAndOwnerPermissions(user,iwc); Iterator iterator = topGroupNodes.iterator(); while ( iterator.hasNext()) { Group topGroup = (Group) iterator.next(); Collection childGroups = groupBusiness.getChildGroupsRecursive(topGroup); if (childGroups != null) { Iterator childGroupsIterator = childGroups.iterator(); while (childGroupsIterator.hasNext()) { Group group = (Group) childGroupsIterator.next(); groupIds.add(group.getPrimaryKey());
QueryResultSession sessionBean = (QueryResultSession) IBOLookup.getSessionInstance(iwc, QueryResultSession.class); String userAccess = (String) sessionBean.getValue(DirectSQLStatement.USER_ACCESS_VARIABLE); String userGroupAccess = (String) sessionBean.getValue(DirectSQLStatement.USER_GROUP_ACCESS_VARIABLE); String groupAccess = (String) sessionBean.getValue(DirectSQLStatement.GROUP_ACCESS_VARIABLE); if (userAccess == null || userGroupAccess == null || groupAccess == null) { List groupIds = new ArrayList(); User user = iwc.getCurrentUser(); UserBusiness userBusiness = getUserBusiness(); GroupBusiness groupBusiness = getGroupBusiness(); Collection topGroupNodes = userBusiness.getUsersTopGroupNodesByViewAndOwnerPermissions(user,iwc); Iterator iterator = topGroupNodes.iterator(); while ( iterator.hasNext()) { Group topGroup = (Group) iterator.next(); Collection childGroups = groupBusiness.getChildGroupsRecursive(topGroup); if (childGroups != null) { Iterator childGroupsIterator = childGroups.iterator(); while (childGroupsIterator.hasNext()) { Group group = (Group) childGroupsIterator.next(); groupIds.add(group.getPrimaryKey()); }
private void setAccessCondition(Map identifierValueMap, IWContext iwc) throws RemoteException { List groupIds = new ArrayList(); User user = iwc.getCurrentUser(); UserBusiness userBusiness = getUserBusiness(); GroupBusiness groupBusiness = getGroupBusiness(); Collection topGroupNodes = userBusiness.getUsersTopGroupNodesByViewAndOwnerPermissions(user,iwc); Iterator iterator = topGroupNodes.iterator(); while ( iterator.hasNext()) { Group topGroup = (Group) iterator.next(); Collection childGroups = groupBusiness.getChildGroupsRecursive(topGroup); if (childGroups != null) { Iterator childGroupsIterator = childGroups.iterator(); while (childGroupsIterator.hasNext()) { Group group = (Group) childGroupsIterator.next(); groupIds.add(group.getPrimaryKey()); } } } // create the where condition for user view StringBuffer userBuffer = new StringBuffer("(select related_ic_group_id from ic_group_relation where ic_group_id in "); Iterator groupIdsIterator = groupIds.iterator(); StringBuffer buffer = new StringBuffer("( "); String separator = ""; while (groupIdsIterator.hasNext()) { buffer.append(separator); Object groupId = groupIdsIterator.next(); buffer.append(groupId.toString()); separator = " , "; } buffer.append(" )"); userBuffer.append(buffer).append(" and group_relation_status = 'ST_ACTIVE')"); identifierValueMap.put(DirectSQLStatement.USER_ACCESS_VARIABLE, userBuffer.toString()); identifierValueMap.put(DirectSQLStatement.USER_GROUP_ACCESS_VARIABLE, buffer.toString()); // create the where condition for group view identifierValueMap.put(DirectSQLStatement.GROUP_ACCESS_VARIABLE, buffer.toString()); }
StringBuffer userBuffer = new StringBuffer("(select related_ic_group_id from ic_group_relation where ic_group_id in "); Iterator groupIdsIterator = groupIds.iterator(); StringBuffer buffer = new StringBuffer("( "); String separator = ""; while (groupIdsIterator.hasNext()) { buffer.append(separator); Object groupId = groupIdsIterator.next(); buffer.append(groupId.toString()); separator = " , "; } buffer.append(" )"); userBuffer.append(buffer).append(" and group_relation_status = 'ST_ACTIVE')"); identifierValueMap.put(DirectSQLStatement.USER_ACCESS_VARIABLE, userBuffer.toString()); identifierValueMap.put(DirectSQLStatement.USER_GROUP_ACCESS_VARIABLE, buffer.toString());
identifierValueMap.put(DirectSQLStatement.USER_ACCESS_VARIABLE, userAccess); identifierValueMap.put(DirectSQLStatement.USER_GROUP_ACCESS_VARIABLE, userGroupAccess);
private void setAccessCondition(Map identifierValueMap, IWContext iwc) throws RemoteException { List groupIds = new ArrayList(); User user = iwc.getCurrentUser(); UserBusiness userBusiness = getUserBusiness(); GroupBusiness groupBusiness = getGroupBusiness(); Collection topGroupNodes = userBusiness.getUsersTopGroupNodesByViewAndOwnerPermissions(user,iwc); Iterator iterator = topGroupNodes.iterator(); while ( iterator.hasNext()) { Group topGroup = (Group) iterator.next(); Collection childGroups = groupBusiness.getChildGroupsRecursive(topGroup); if (childGroups != null) { Iterator childGroupsIterator = childGroups.iterator(); while (childGroupsIterator.hasNext()) { Group group = (Group) childGroupsIterator.next(); groupIds.add(group.getPrimaryKey()); } } } // create the where condition for user view StringBuffer userBuffer = new StringBuffer("(select related_ic_group_id from ic_group_relation where ic_group_id in "); Iterator groupIdsIterator = groupIds.iterator(); StringBuffer buffer = new StringBuffer("( "); String separator = ""; while (groupIdsIterator.hasNext()) { buffer.append(separator); Object groupId = groupIdsIterator.next(); buffer.append(groupId.toString()); separator = " , "; } buffer.append(" )"); userBuffer.append(buffer).append(" and group_relation_status = 'ST_ACTIVE')"); identifierValueMap.put(DirectSQLStatement.USER_ACCESS_VARIABLE, userBuffer.toString()); identifierValueMap.put(DirectSQLStatement.USER_GROUP_ACCESS_VARIABLE, buffer.toString()); // create the where condition for group view identifierValueMap.put(DirectSQLStatement.GROUP_ACCESS_VARIABLE, buffer.toString()); }
identifierValueMap.put(DirectSQLStatement.GROUP_ACCESS_VARIABLE, buffer.toString());
identifierValueMap.put(DirectSQLStatement.GROUP_ACCESS_VARIABLE, groupAccess);
private void setAccessCondition(Map identifierValueMap, IWContext iwc) throws RemoteException { List groupIds = new ArrayList(); User user = iwc.getCurrentUser(); UserBusiness userBusiness = getUserBusiness(); GroupBusiness groupBusiness = getGroupBusiness(); Collection topGroupNodes = userBusiness.getUsersTopGroupNodesByViewAndOwnerPermissions(user,iwc); Iterator iterator = topGroupNodes.iterator(); while ( iterator.hasNext()) { Group topGroup = (Group) iterator.next(); Collection childGroups = groupBusiness.getChildGroupsRecursive(topGroup); if (childGroups != null) { Iterator childGroupsIterator = childGroups.iterator(); while (childGroupsIterator.hasNext()) { Group group = (Group) childGroupsIterator.next(); groupIds.add(group.getPrimaryKey()); } } } // create the where condition for user view StringBuffer userBuffer = new StringBuffer("(select related_ic_group_id from ic_group_relation where ic_group_id in "); Iterator groupIdsIterator = groupIds.iterator(); StringBuffer buffer = new StringBuffer("( "); String separator = ""; while (groupIdsIterator.hasNext()) { buffer.append(separator); Object groupId = groupIdsIterator.next(); buffer.append(groupId.toString()); separator = " , "; } buffer.append(" )"); userBuffer.append(buffer).append(" and group_relation_status = 'ST_ACTIVE')"); identifierValueMap.put(DirectSQLStatement.USER_ACCESS_VARIABLE, userBuffer.toString()); identifierValueMap.put(DirectSQLStatement.USER_GROUP_ACCESS_VARIABLE, buffer.toString()); // create the where condition for group view identifierValueMap.put(DirectSQLStatement.GROUP_ACCESS_VARIABLE, buffer.toString()); }
public JasperPrint printSynchronizedReport(com.idega.block.dataquery.data.QueryResult p0,java.util.Map p1,com.idega.block.datareport.data.DesignBox p2) throws java.rmi.RemoteException;
public JasperPrint printSynchronizedReport(com.idega.block.dataquery.data.QueryResult p0,com.idega.block.datareport.data.DesignBox p2) throws java.rmi.RemoteException;
public JasperPrint printSynchronizedReport(com.idega.block.dataquery.data.QueryResult p0,java.util.Map p1,com.idega.block.datareport.data.DesignBox p2) throws java.rmi.RemoteException;
public void addParameter(Element param);
public void addParameter(String name, Object param);
public void addParameter(Element param);
int seconds = (int)Math.ceil(traceLength.convertTo(UnitImpl.SECOND) .getValue()); int[] dataBits = new int[SPIKE_SAMPLES_PER_SECOND * seconds];
double traceSecs = traceLength.convertTo(UnitImpl.SECOND).getValue(); int[] dataBits = new int[(int)(SPIKE_SAMPLES_PER_SECOND * traceSecs)];
public static LocalSeismogramImpl createRaggedSpike(MicroSecondDate time, TimeInterval traceLength, int samplesPerSpike, int missingSamples, ChannelId id) { double secondShift = missingSamples / (double)SPIKE_SAMPLES_PER_SECOND; TimeInterval shiftInt = new TimeInterval(secondShift, UnitImpl.SECOND); time = time.add(shiftInt); traceLength = traceLength.subtract(shiftInt); String name = "spike at " + time.toString(); int seconds = (int)Math.ceil(traceLength.convertTo(UnitImpl.SECOND) .getValue()); int[] dataBits = new int[SPIKE_SAMPLES_PER_SECOND * seconds]; for(int i = 0; i < dataBits.length; i++) { if(i % samplesPerSpike == 0 && i >= missingSamples) { dataBits[i] = 100; } } return createTestData(name, dataBits, time.getFissuresTime(), id); }
if(i % samplesPerSpike == 0 && i >= missingSamples) {
if((i + missingSamples) % samplesPerSpike == 0) {
public static LocalSeismogramImpl createRaggedSpike(MicroSecondDate time, TimeInterval traceLength, int samplesPerSpike, int missingSamples, ChannelId id) { double secondShift = missingSamples / (double)SPIKE_SAMPLES_PER_SECOND; TimeInterval shiftInt = new TimeInterval(secondShift, UnitImpl.SECOND); time = time.add(shiftInt); traceLength = traceLength.subtract(shiftInt); String name = "spike at " + time.toString(); int seconds = (int)Math.ceil(traceLength.convertTo(UnitImpl.SECOND) .getValue()); int[] dataBits = new int[SPIKE_SAMPLES_PER_SECOND * seconds]; for(int i = 0; i < dataBits.length; i++) { if(i % samplesPerSpike == 0 && i >= missingSamples) { dataBits[i] = 100; } } return createTestData(name, dataBits, time.getFissuresTime(), id); }
public static int[][] makePlottable(LocalSeismogramImpl seis, MicroSecondTimeRange tr, int samplesPerDay)
public static Plottable makePlottable(LocalSeismogramImpl seis, MicroSecondTimeRange tr, int samplesPerDay)
public static int[][] makePlottable(LocalSeismogramImpl seis, MicroSecondTimeRange tr, int samplesPerDay) throws CodecException { MicroSecondDate startTime = tr.getBeginTime(); if(seis.getBeginTime().after(startTime)) { startTime = seis.getBeginTime(); } MicroSecondDate stopTime = tr.getEndTime(); if(seis.getEndTime().before(stopTime)) { stopTime = seis.getEndTime(); } int startSample = PlottableChunk.getPixel(startTime, samplesPerDay); startTime = getTime(startTime, startSample, samplesPerDay); int stopSample = PlottableChunk.getPixel(stopTime, samplesPerDay); stopTime = getTime(stopTime, stopSample, samplesPerDay); double lengthInDays = stopTime.difference(startTime) .getValue(UnitImpl.DAY); int numSamples = (int)Math.ceil(lengthInDays * samplesPerDay); if(numSamples % 2 == 1) { numSamples++; } int[][] out = new int[2][numSamples]; TimeInterval startShift = startTime.subtract(tr.getBeginTime()); double daysShifted = startShift.getValue(UnitImpl.DAY); int xOffset = (int)Math.floor(daysShifted * samplesPerDay / 2); TimeInterval plottableSampleLength = (TimeInterval)new TimeInterval(1, UnitImpl.DAY).divideBy(samplesPerDay) .convertTo(UnitImpl.SECOND); double seisSamplesPerSample = plottableSampleLength.divideBy(seis.getSampling() .getPeriod() .convertTo(UnitImpl.SECOND)) .getValue(); for(int i = 0; i < numSamples; i += 2) { out[0][i] = xOffset + i / 2; out[0][i + 1] = xOffset + i / 2; int startSeisSample = (int)Math.floor(i * seisSamplesPerSample); if(startSeisSample < 0) { startSeisSample = 0; } int stopSeisSample = (int)Math.ceil((i + 1) * seisSamplesPerSample); if(stopSeisSample > seis.getNumPoints()) { stopSeisSample = seis.getNumPoints(); } int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for(int j = startSeisSample; j < stopSeisSample; j++) { int val = (int)seis.getValueAt(j).getValue(); if(val < min) { min = val; } if(val > max) { max = val; } } out[1][i] = min; out[1][i + 1] = max; } return out; }
MicroSecondDate startTime = tr.getBeginTime(); if(seis.getBeginTime().after(startTime)) { startTime = seis.getBeginTime();
double pixelPeriod = 1 / (double)samplesPerDay * 2.0d; TimeInterval trInt = (TimeInterval)tr.getInterval() .convertTo(UnitImpl.DAY); double exactNumPixels = trInt.divideBy(pixelPeriod).getValue(); int numPixels = (int)Math.ceil(exactNumPixels); TimeInterval pointPeriod = (TimeInterval)seis.getSampling() .getPeriod() .convertTo(UnitImpl.DAY); double pointsPerPixel = pixelPeriod / pointPeriod.getValue(); int startPoint = getPoint(seis, tr.getBeginTime()); int endPoint = startPoint + (int)(pointsPerPixel * numPixels); int startPixel = 0; if(startPoint < 0) { startPixel = (int)Math.floor((startPoint * -1) / pointsPerPixel); numPixels -= startPixel;
public static int[][] makePlottable(LocalSeismogramImpl seis, MicroSecondTimeRange tr, int samplesPerDay) throws CodecException { MicroSecondDate startTime = tr.getBeginTime(); if(seis.getBeginTime().after(startTime)) { startTime = seis.getBeginTime(); } MicroSecondDate stopTime = tr.getEndTime(); if(seis.getEndTime().before(stopTime)) { stopTime = seis.getEndTime(); } int startSample = PlottableChunk.getPixel(startTime, samplesPerDay); startTime = getTime(startTime, startSample, samplesPerDay); int stopSample = PlottableChunk.getPixel(stopTime, samplesPerDay); stopTime = getTime(stopTime, stopSample, samplesPerDay); double lengthInDays = stopTime.difference(startTime) .getValue(UnitImpl.DAY); int numSamples = (int)Math.ceil(lengthInDays * samplesPerDay); if(numSamples % 2 == 1) { numSamples++; } int[][] out = new int[2][numSamples]; TimeInterval startShift = startTime.subtract(tr.getBeginTime()); double daysShifted = startShift.getValue(UnitImpl.DAY); int xOffset = (int)Math.floor(daysShifted * samplesPerDay / 2); TimeInterval plottableSampleLength = (TimeInterval)new TimeInterval(1, UnitImpl.DAY).divideBy(samplesPerDay) .convertTo(UnitImpl.SECOND); double seisSamplesPerSample = plottableSampleLength.divideBy(seis.getSampling() .getPeriod() .convertTo(UnitImpl.SECOND)) .getValue(); for(int i = 0; i < numSamples; i += 2) { out[0][i] = xOffset + i / 2; out[0][i + 1] = xOffset + i / 2; int startSeisSample = (int)Math.floor(i * seisSamplesPerSample); if(startSeisSample < 0) { startSeisSample = 0; } int stopSeisSample = (int)Math.ceil((i + 1) * seisSamplesPerSample); if(stopSeisSample > seis.getNumPoints()) { stopSeisSample = seis.getNumPoints(); } int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for(int j = startSeisSample; j < stopSeisSample; j++) { int val = (int)seis.getValueAt(j).getValue(); if(val < min) { min = val; } if(val > max) { max = val; } } out[1][i] = min; out[1][i + 1] = max; } return out; }
MicroSecondDate stopTime = tr.getEndTime(); if(seis.getEndTime().before(stopTime)) { stopTime = seis.getEndTime();
if(endPoint > seis.getNumPoints()) { int pointShift = endPoint - seis.getNumPoints(); numPixels -= (int)Math.floor(pointShift / pointsPerPixel); endPoint = seis.getNumPoints();
public static int[][] makePlottable(LocalSeismogramImpl seis, MicroSecondTimeRange tr, int samplesPerDay) throws CodecException { MicroSecondDate startTime = tr.getBeginTime(); if(seis.getBeginTime().after(startTime)) { startTime = seis.getBeginTime(); } MicroSecondDate stopTime = tr.getEndTime(); if(seis.getEndTime().before(stopTime)) { stopTime = seis.getEndTime(); } int startSample = PlottableChunk.getPixel(startTime, samplesPerDay); startTime = getTime(startTime, startSample, samplesPerDay); int stopSample = PlottableChunk.getPixel(stopTime, samplesPerDay); stopTime = getTime(stopTime, stopSample, samplesPerDay); double lengthInDays = stopTime.difference(startTime) .getValue(UnitImpl.DAY); int numSamples = (int)Math.ceil(lengthInDays * samplesPerDay); if(numSamples % 2 == 1) { numSamples++; } int[][] out = new int[2][numSamples]; TimeInterval startShift = startTime.subtract(tr.getBeginTime()); double daysShifted = startShift.getValue(UnitImpl.DAY); int xOffset = (int)Math.floor(daysShifted * samplesPerDay / 2); TimeInterval plottableSampleLength = (TimeInterval)new TimeInterval(1, UnitImpl.DAY).divideBy(samplesPerDay) .convertTo(UnitImpl.SECOND); double seisSamplesPerSample = plottableSampleLength.divideBy(seis.getSampling() .getPeriod() .convertTo(UnitImpl.SECOND)) .getValue(); for(int i = 0; i < numSamples; i += 2) { out[0][i] = xOffset + i / 2; out[0][i + 1] = xOffset + i / 2; int startSeisSample = (int)Math.floor(i * seisSamplesPerSample); if(startSeisSample < 0) { startSeisSample = 0; } int stopSeisSample = (int)Math.ceil((i + 1) * seisSamplesPerSample); if(stopSeisSample > seis.getNumPoints()) { stopSeisSample = seis.getNumPoints(); } int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for(int j = startSeisSample; j < stopSeisSample; j++) { int val = (int)seis.getValueAt(j).getValue(); if(val < min) { min = val; } if(val > max) { max = val; } } out[1][i] = min; out[1][i + 1] = max; } return out; }
int startSample = PlottableChunk.getPixel(startTime, samplesPerDay); startTime = getTime(startTime, startSample, samplesPerDay); int stopSample = PlottableChunk.getPixel(stopTime, samplesPerDay); stopTime = getTime(stopTime, stopSample, samplesPerDay); double lengthInDays = stopTime.difference(startTime) .getValue(UnitImpl.DAY); int numSamples = (int)Math.ceil(lengthInDays * samplesPerDay); if(numSamples % 2 == 1) { numSamples++;
int[][] pixels = new int[2][numPixels * 2]; int pixelPoint = startPoint < 0 ? 0 : startPoint; for(int i = 0; i < numPixels; i++) { int pos = 2 * i; int nextPos = pos + 1; pixels[0][pos] = startPixel + i; pixels[0][nextPos] = pixels[0][pos]; int nextPixelPoint = startPoint + (int)((pixels[0][pos] + 1) * pointsPerPixel); if(i == numPixels - 1) { nextPixelPoint = endPoint; } QuantityImpl min = seis.getMinValue(pixelPoint, nextPixelPoint); pixels[1][pos] = (int)min.getValue(); QuantityImpl max = seis.getMaxValue(pixelPoint, nextPixelPoint); pixels[1][nextPos] = (int)max.getValue(); pixelPoint = nextPixelPoint;
public static int[][] makePlottable(LocalSeismogramImpl seis, MicroSecondTimeRange tr, int samplesPerDay) throws CodecException { MicroSecondDate startTime = tr.getBeginTime(); if(seis.getBeginTime().after(startTime)) { startTime = seis.getBeginTime(); } MicroSecondDate stopTime = tr.getEndTime(); if(seis.getEndTime().before(stopTime)) { stopTime = seis.getEndTime(); } int startSample = PlottableChunk.getPixel(startTime, samplesPerDay); startTime = getTime(startTime, startSample, samplesPerDay); int stopSample = PlottableChunk.getPixel(stopTime, samplesPerDay); stopTime = getTime(stopTime, stopSample, samplesPerDay); double lengthInDays = stopTime.difference(startTime) .getValue(UnitImpl.DAY); int numSamples = (int)Math.ceil(lengthInDays * samplesPerDay); if(numSamples % 2 == 1) { numSamples++; } int[][] out = new int[2][numSamples]; TimeInterval startShift = startTime.subtract(tr.getBeginTime()); double daysShifted = startShift.getValue(UnitImpl.DAY); int xOffset = (int)Math.floor(daysShifted * samplesPerDay / 2); TimeInterval plottableSampleLength = (TimeInterval)new TimeInterval(1, UnitImpl.DAY).divideBy(samplesPerDay) .convertTo(UnitImpl.SECOND); double seisSamplesPerSample = plottableSampleLength.divideBy(seis.getSampling() .getPeriod() .convertTo(UnitImpl.SECOND)) .getValue(); for(int i = 0; i < numSamples; i += 2) { out[0][i] = xOffset + i / 2; out[0][i + 1] = xOffset + i / 2; int startSeisSample = (int)Math.floor(i * seisSamplesPerSample); if(startSeisSample < 0) { startSeisSample = 0; } int stopSeisSample = (int)Math.ceil((i + 1) * seisSamplesPerSample); if(stopSeisSample > seis.getNumPoints()) { stopSeisSample = seis.getNumPoints(); } int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for(int j = startSeisSample; j < stopSeisSample; j++) { int val = (int)seis.getValueAt(j).getValue(); if(val < min) { min = val; } if(val > max) { max = val; } } out[1][i] = min; out[1][i + 1] = max; } return out; }
int[][] out = new int[2][numSamples]; TimeInterval startShift = startTime.subtract(tr.getBeginTime()); double daysShifted = startShift.getValue(UnitImpl.DAY); int xOffset = (int)Math.floor(daysShifted * samplesPerDay / 2); TimeInterval plottableSampleLength = (TimeInterval)new TimeInterval(1, UnitImpl.DAY).divideBy(samplesPerDay) .convertTo(UnitImpl.SECOND); double seisSamplesPerSample = plottableSampleLength.divideBy(seis.getSampling() .getPeriod() .convertTo(UnitImpl.SECOND)) .getValue(); for(int i = 0; i < numSamples; i += 2) { out[0][i] = xOffset + i / 2; out[0][i + 1] = xOffset + i / 2; int startSeisSample = (int)Math.floor(i * seisSamplesPerSample); if(startSeisSample < 0) { startSeisSample = 0; } int stopSeisSample = (int)Math.ceil((i + 1) * seisSamplesPerSample); if(stopSeisSample > seis.getNumPoints()) { stopSeisSample = seis.getNumPoints(); } int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for(int j = startSeisSample; j < stopSeisSample; j++) { int val = (int)seis.getValueAt(j).getValue(); if(val < min) { min = val; } if(val > max) { max = val; } } out[1][i] = min; out[1][i + 1] = max; } return out;
return new Plottable(pixels[0], pixels[1]);
public static int[][] makePlottable(LocalSeismogramImpl seis, MicroSecondTimeRange tr, int samplesPerDay) throws CodecException { MicroSecondDate startTime = tr.getBeginTime(); if(seis.getBeginTime().after(startTime)) { startTime = seis.getBeginTime(); } MicroSecondDate stopTime = tr.getEndTime(); if(seis.getEndTime().before(stopTime)) { stopTime = seis.getEndTime(); } int startSample = PlottableChunk.getPixel(startTime, samplesPerDay); startTime = getTime(startTime, startSample, samplesPerDay); int stopSample = PlottableChunk.getPixel(stopTime, samplesPerDay); stopTime = getTime(stopTime, stopSample, samplesPerDay); double lengthInDays = stopTime.difference(startTime) .getValue(UnitImpl.DAY); int numSamples = (int)Math.ceil(lengthInDays * samplesPerDay); if(numSamples % 2 == 1) { numSamples++; } int[][] out = new int[2][numSamples]; TimeInterval startShift = startTime.subtract(tr.getBeginTime()); double daysShifted = startShift.getValue(UnitImpl.DAY); int xOffset = (int)Math.floor(daysShifted * samplesPerDay / 2); TimeInterval plottableSampleLength = (TimeInterval)new TimeInterval(1, UnitImpl.DAY).divideBy(samplesPerDay) .convertTo(UnitImpl.SECOND); double seisSamplesPerSample = plottableSampleLength.divideBy(seis.getSampling() .getPeriod() .convertTo(UnitImpl.SECOND)) .getValue(); for(int i = 0; i < numSamples; i += 2) { out[0][i] = xOffset + i / 2; out[0][i + 1] = xOffset + i / 2; int startSeisSample = (int)Math.floor(i * seisSamplesPerSample); if(startSeisSample < 0) { startSeisSample = 0; } int stopSeisSample = (int)Math.ceil((i + 1) * seisSamplesPerSample); if(stopSeisSample > seis.getNumPoints()) { stopSeisSample = seis.getNumPoints(); } int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for(int j = startSeisSample; j < stopSeisSample; j++) { int val = (int)seis.getValueAt(j).getValue(); if(val < min) { min = val; } if(val > max) { max = val; } } out[1][i] = min; out[1][i + 1] = max; } return out; }
Property[] props = seis.getProperties(); Property[] newProps = new Property[1+props.length+nList.getLength()]; 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()); } newProps[newProps.length-1] = new Property(seisNameKey, name); seis.setProperties(newProps); }
numDSProps = nList.getLength(); } else { numDSProps = 0; } 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()); } newProps[newProps.length-1] = new Property(seisNameKey, name); seis.setProperties(newProps);
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, "SacSeismogram[name="+dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { try { Node n = nList.item(0); if (n instanceof Element) { Element e = (Element)n; 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); NodeList propList = evalNodeList(e, "property"); if (propList != null && propList.getLength() != 0) { Property[] props = seis.getProperties(); Property[] newProps = new Property[1+props.length+nList.getLength()]; 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; }
SimpleXLink(DocumentBuilder docBuilder, Element element, URL base) { this.docBuilder = docBuilder; this.element = element; this.base = base;
SimpleXLink(DocumentBuilder docBuilder, Element element) { this(docBuilder, element, null);
SimpleXLink(DocumentBuilder docBuilder, Element element, URL base) { this.docBuilder = docBuilder; this.element = element; this.base = base; }
public void read(DataInputStream dis) throws IOException { readHeader(dis); readData(dis);
public void read(String filename) throws FileNotFoundException, IOException { File sacFile = new File(filename); read(sacFile);
public void read(DataInputStream dis) throws IOException { readHeader(dis); readData(dis); }
datasetNames.add(dataset.getName());
public void addDataSet(DataSet dataset, AuditInfo[] audit) { datasets.put(dataset.getName(), dataset); }
dss.setDataSet(this);
public void addDataSetSeismogram(DataSetSeismogram dss, AuditInfo[] audit) { datasetSeismograms.put(dss.getName(), dss); datasetSeismogramNames.add(dss.getName()); }
logger.debug("Waiting for saver to finish");
public static URLDataSetSeismogram localize(DataSetSeismogram dss, File directory) throws MalformedURLException { URLDataSetSeismogram urlDSS; URL fileURL = directory.toURL(); if (dss instanceof URLDataSetSeismogram) { // check for seismograms already in directory urlDSS = (URLDataSetSeismogram)dss; URL[] url = urlDSS.getURLs(); boolean isLocal = true; for (int i = 0; i < url.length; i++) { if (url[i].getProtocol().equals("file") || url[i].getProtocol().equals("")) { // file onlocal system, but may be in different directory if ( ! url[i].getPath().startsWith(fileURL.getPath())) { // paths don't match isLocal = false; } } else { // not local isLocal = false; } } if (isLocal) { // all ok with this URLDataSetSeismogram return urlDSS; } } // either isLocal is false, or not a URLDataSetSeismogram, so must localize URLDataSetSeismogramSaver saver = new URLDataSetSeismogramSaver(dss, directory); URLDataSetSeismogram out = saver.getURLDataSetSeismogram(); while ( ! saver.isFinished()) { try { Thread.sleep(500); } catch(InterruptedException e) { } } if (saver.isError()) { // uh oh // probably should throw something instead of this, but the error may be ok? String dssName = "dss is null"; if (dss != null) dssName = dss.getName(); GlobalExceptionHandler.handleStatic("A problem occured trying to localize the "+ dssName+" dataset seismogram.", saver.getError()); } return out; }
public XMLDataSet(DocumentBuilder docBuilder, URL base, Element config) { this(docBuilder, base); this.config = config;
public XMLDataSet(DocumentBuilder docBuilder, URL datasetURL) { this.base = datasetURL; this.docBuilder = docBuilder; Document doc = docBuilder.newDocument(); config = doc.createElement("dataset"); config.setAttribute("xmlns:xlink", "http: prefixResolver = new org.apache.xml.utils.PrefixResolverDefault(config);
public XMLDataSet(DocumentBuilder docBuilder, URL base, Element config) { this(docBuilder, base); this.config = config; }
fOut.println('>');
fOut.print('>');
public void write(Node node) { // is there anything to do? if (node == null) { return; } short type = node.getNodeType(); switch (type) { case Node.DOCUMENT_NODE: { Document document = (Document)node; if (!fCanonical) { fOut.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); fOut.flush(); write(document.getDoctype()); } write(document.getDocumentElement()); break; } case Node.DOCUMENT_TYPE_NODE: { DocumentType doctype = (DocumentType)node; fOut.print("<!DOCTYPE "); fOut.print(doctype.getName()); String publicId = doctype.getPublicId(); String systemId = doctype.getSystemId(); if (publicId != null) { fOut.print(" PUBLIC '"); fOut.print(publicId); fOut.print("' '"); fOut.print(systemId); fOut.print('\''); } else { fOut.print(" SYSTEM '"); fOut.print(systemId); fOut.print('\''); } String internalSubset = doctype.getInternalSubset(); if (internalSubset != null) { fOut.println(" ["); fOut.print(internalSubset); fOut.print(']'); } fOut.println('>'); break; } case Node.ELEMENT_NODE: { fOut.print('<'); fOut.print(node.getNodeName()); Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; fOut.print(' '); fOut.print(attr.getNodeName()); fOut.print("=\""); normalizeAndPrint(attr.getNodeValue()); fOut.print('"'); } fOut.println('>'); fOut.flush(); Node child = node.getFirstChild(); while (child != null) { write(child); child = child.getNextSibling(); } break; } case Node.ENTITY_REFERENCE_NODE: { if (fCanonical) { Node child = node.getFirstChild(); while (child != null) { write(child); child = child.getNextSibling(); } } else { fOut.print('&'); fOut.print(node.getNodeName()); fOut.print(';'); fOut.flush(); } break; } case Node.CDATA_SECTION_NODE: { if (fCanonical) { normalizeAndPrint(node.getNodeValue()); } else { fOut.print("<![CDATA["); fOut.print(node.getNodeValue()); fOut.print("]]>"); } fOut.flush(); break; } case Node.TEXT_NODE: { normalizeAndPrint(node.getNodeValue()); fOut.flush(); break; } case Node.PROCESSING_INSTRUCTION_NODE: { fOut.print("<?"); fOut.print(node.getNodeName()); String data = node.getNodeValue(); if (data != null && data.length() > 0) { fOut.print(' '); fOut.print(data); } fOut.println("?>"); fOut.flush(); break; } } if (type == Node.ELEMENT_NODE) { fOut.print("</"); fOut.print(node.getNodeName()); fOut.print('>'); fOut.flush(); } } // write(Node)
fOut.print('>');
fOut.println('>');
public void write(Node node) { // is there anything to do? if (node == null) { return; } short type = node.getNodeType(); switch (type) { case Node.DOCUMENT_NODE: { Document document = (Document)node; if (!fCanonical) { fOut.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); fOut.flush(); write(document.getDoctype()); } write(document.getDocumentElement()); break; } case Node.DOCUMENT_TYPE_NODE: { DocumentType doctype = (DocumentType)node; fOut.print("<!DOCTYPE "); fOut.print(doctype.getName()); String publicId = doctype.getPublicId(); String systemId = doctype.getSystemId(); if (publicId != null) { fOut.print(" PUBLIC '"); fOut.print(publicId); fOut.print("' '"); fOut.print(systemId); fOut.print('\''); } else { fOut.print(" SYSTEM '"); fOut.print(systemId); fOut.print('\''); } String internalSubset = doctype.getInternalSubset(); if (internalSubset != null) { fOut.println(" ["); fOut.print(internalSubset); fOut.print(']'); } fOut.println('>'); break; } case Node.ELEMENT_NODE: { fOut.print('<'); fOut.print(node.getNodeName()); Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; fOut.print(' '); fOut.print(attr.getNodeName()); fOut.print("=\""); normalizeAndPrint(attr.getNodeValue()); fOut.print('"'); } fOut.println('>'); fOut.flush(); Node child = node.getFirstChild(); while (child != null) { write(child); child = child.getNextSibling(); } break; } case Node.ENTITY_REFERENCE_NODE: { if (fCanonical) { Node child = node.getFirstChild(); while (child != null) { write(child); child = child.getNextSibling(); } } else { fOut.print('&'); fOut.print(node.getNodeName()); fOut.print(';'); fOut.flush(); } break; } case Node.CDATA_SECTION_NODE: { if (fCanonical) { normalizeAndPrint(node.getNodeValue()); } else { fOut.print("<![CDATA["); fOut.print(node.getNodeValue()); fOut.print("]]>"); } fOut.flush(); break; } case Node.TEXT_NODE: { normalizeAndPrint(node.getNodeValue()); fOut.flush(); break; } case Node.PROCESSING_INSTRUCTION_NODE: { fOut.print("<?"); fOut.print(node.getNodeName()); String data = node.getNodeValue(); if (data != null && data.length() > 0) { fOut.print(' '); fOut.print(data); } fOut.println("?>"); fOut.flush(); break; } } if (type == Node.ELEMENT_NODE) { fOut.print("</"); fOut.print(node.getNodeName()); fOut.print('>'); fOut.flush(); } } // write(Node)
Vector v = new Vector();
ArrayList al = new ArrayList();
public Collection getDaysEvents(MyCalendarVO date) throws Throwable { Vector v = new Vector(); CalTimezones tzcache = cal.getTimezones();// Dur oneDay = new Dur(1, 0, 0, 0); long millis = System.currentTimeMillis(); //tzcache.setSysTimezones(cal.getTimezones()); BwDateTime startDt = CalFacadeUtil.getDateTime(date.getDateDigits(), tzcache); BwDateTime endDt = startDt.getNextDay(tzcache); String start = startDt.getDate(); String end = endDt.getDate(); if (debug) { debugMsg("Did UTC stuff in " + (System.currentTimeMillis() - millis)); } //if (debug) { // debugMsg("Get days events in range " + start + " to " + end); //} if (events == null) { events = cal.getEvents(null, null, CalFacadeUtil.getDateTime(firstDay.getDateDigits(), tzcache), CalFacadeUtil.getDateTime(lastDay.getTomorrow().getDateDigits(), tzcache), CalFacadeDefs.retrieveRecurExpanded); } Iterator it = events.iterator(); while (it.hasNext()) { EventInfo ei = (EventInfo)it.next(); BwEvent ev = ei.getEvent(); String evStart = ev.getDtstart().getDate(); String evEnd = ev.getDtend().getDate(); /* Event is within range if: 1. (((evStart <= :start) and (evEnd > :start)) or 2. ((evStart >= :start) and (evStart < :end)) or 3. ((evEnd > :start) and (evEnd <= :end))) XXX followed caldav which might be wrong. Try 3. ((evEnd > :start) and (evEnd < :end))) */ int evstSt = evStart.compareTo(start); int evendSt = evEnd.compareTo(start); //debugMsg(" event " + evStart + " to " + evEnd); if (((evstSt <= 0) && (evendSt > 0)) || ((evstSt >= 0) && (evStart.compareTo(end) < 0)) || //((evendSt > 0) && (evEnd.compareTo(end) <= 0))) { ((evendSt > 0) && (evEnd.compareTo(end) < 0))) { // Passed the tests. if (debug) { debugMsg("Event passed range " + start + "-" + end + " with dates " + evStart + "-" + evEnd + ": " + ev.getSummary()); } v.add(ei); } } return v; }
v.add(ei);
al.add(ei);
public Collection getDaysEvents(MyCalendarVO date) throws Throwable { Vector v = new Vector(); CalTimezones tzcache = cal.getTimezones();// Dur oneDay = new Dur(1, 0, 0, 0); long millis = System.currentTimeMillis(); //tzcache.setSysTimezones(cal.getTimezones()); BwDateTime startDt = CalFacadeUtil.getDateTime(date.getDateDigits(), tzcache); BwDateTime endDt = startDt.getNextDay(tzcache); String start = startDt.getDate(); String end = endDt.getDate(); if (debug) { debugMsg("Did UTC stuff in " + (System.currentTimeMillis() - millis)); } //if (debug) { // debugMsg("Get days events in range " + start + " to " + end); //} if (events == null) { events = cal.getEvents(null, null, CalFacadeUtil.getDateTime(firstDay.getDateDigits(), tzcache), CalFacadeUtil.getDateTime(lastDay.getTomorrow().getDateDigits(), tzcache), CalFacadeDefs.retrieveRecurExpanded); } Iterator it = events.iterator(); while (it.hasNext()) { EventInfo ei = (EventInfo)it.next(); BwEvent ev = ei.getEvent(); String evStart = ev.getDtstart().getDate(); String evEnd = ev.getDtend().getDate(); /* Event is within range if: 1. (((evStart <= :start) and (evEnd > :start)) or 2. ((evStart >= :start) and (evStart < :end)) or 3. ((evEnd > :start) and (evEnd <= :end))) XXX followed caldav which might be wrong. Try 3. ((evEnd > :start) and (evEnd < :end))) */ int evstSt = evStart.compareTo(start); int evendSt = evEnd.compareTo(start); //debugMsg(" event " + evStart + " to " + evEnd); if (((evstSt <= 0) && (evendSt > 0)) || ((evstSt >= 0) && (evStart.compareTo(end) < 0)) || //((evendSt > 0) && (evEnd.compareTo(end) <= 0))) { ((evendSt > 0) && (evEnd.compareTo(end) < 0))) { // Passed the tests. if (debug) { debugMsg("Event passed range " + start + "-" + end + " with dates " + evStart + "-" + evEnd + ": " + ev.getSummary()); } v.add(ei); } } return v; }
return v;
return al;
public Collection getDaysEvents(MyCalendarVO date) throws Throwable { Vector v = new Vector(); CalTimezones tzcache = cal.getTimezones();// Dur oneDay = new Dur(1, 0, 0, 0); long millis = System.currentTimeMillis(); //tzcache.setSysTimezones(cal.getTimezones()); BwDateTime startDt = CalFacadeUtil.getDateTime(date.getDateDigits(), tzcache); BwDateTime endDt = startDt.getNextDay(tzcache); String start = startDt.getDate(); String end = endDt.getDate(); if (debug) { debugMsg("Did UTC stuff in " + (System.currentTimeMillis() - millis)); } //if (debug) { // debugMsg("Get days events in range " + start + " to " + end); //} if (events == null) { events = cal.getEvents(null, null, CalFacadeUtil.getDateTime(firstDay.getDateDigits(), tzcache), CalFacadeUtil.getDateTime(lastDay.getTomorrow().getDateDigits(), tzcache), CalFacadeDefs.retrieveRecurExpanded); } Iterator it = events.iterator(); while (it.hasNext()) { EventInfo ei = (EventInfo)it.next(); BwEvent ev = ei.getEvent(); String evStart = ev.getDtstart().getDate(); String evEnd = ev.getDtend().getDate(); /* Event is within range if: 1. (((evStart <= :start) and (evEnd > :start)) or 2. ((evStart >= :start) and (evStart < :end)) or 3. ((evEnd > :start) and (evEnd <= :end))) XXX followed caldav which might be wrong. Try 3. ((evEnd > :start) and (evEnd < :end))) */ int evstSt = evStart.compareTo(start); int evendSt = evEnd.compareTo(start); //debugMsg(" event " + evStart + " to " + evEnd); if (((evstSt <= 0) && (evendSt > 0)) || ((evstSt >= 0) && (evStart.compareTo(end) < 0)) || //((evendSt > 0) && (evEnd.compareTo(end) <= 0))) { ((evendSt > 0) && (evEnd.compareTo(end) < 0))) { // Passed the tests. if (debug) { debugMsg("Event passed range " + start + "-" + end + " with dates " + evStart + "-" + evEnd + ": " + ev.getSummary()); } v.add(ei); } } return v; }
Vector days = new Vector();
ArrayList days = new ArrayList();
private TimeViewDailyInfo[] getOneWeekTvdi(GtpiData gtpi) throws Throwable { Vector days = new Vector(); TimeViewDailyInfo tvdi; /** First see if we need to insert leading fillers */ int dayOfWeek = gtpi.currentDay.getDayOfWeek(); int dayNum = getFirstDayOfWeek(); if (debug) { debugMsg("dayOfWeek=" + dayOfWeek + " dayNum = " + dayNum); } while (dayNum != dayOfWeek) { tvdi = new TimeViewDailyInfo(calInfo); tvdi.setFiller(true); days.addElement(tvdi); dayNum++; if (debug) { debugMsg("dayNum = " + dayNum); } if (dayNum > 7) { dayNum = 1; } // Check we got this right if (days.size() > 7) { throw new Exception("Programming error in getOneWeekTvdi"); } } for (;;) { dayOfWeek = gtpi.currentDay.getDayOfWeek(); if (gtpi.currentDay.getMonth() != gtpi.curMonth) { gtpi.newMonth = true; break; } gtpi.isLast = gtpi.last.isSameDate(gtpi.currentDay); /* Create a day entry */ tvdi = new TimeViewDailyInfo(calInfo); initTvdi(tvdi, gtpi); tvdi.setDayEntry(true); tvdi.setFirstDay(gtpi.isFirst); tvdi.setLastDay(gtpi.isLast); tvdi.setDayOfMonth(gtpi.currentDay.getDay()); tvdi.setDayOfWeek(dayOfWeek); /** Is this correct? The days of the week are rotated to adjust for * first day differences. */ tvdi.setDayName(calInfo.getDayName(dayOfWeek)); tvdi.setFirstDayOfMonth(gtpi.newMonth); gtpi.newMonth = false; tvdi.setFirstDayOfWeek(getFirstDayOfWeek() == dayOfWeek); tvdi.setLastDayOfWeek(calInfo.getLastDayOfWeek() == dayOfWeek); days.addElement(tvdi); gtpi.isFirst = false; gtpi.prevTvdi = tvdi; gtpi.currentDay = gtpi.currentDay.getTomorrow(); if (gtpi.isLast || tvdi.isLastDayOfWeek()) { // Watch for it also being the last day of the month if (gtpi.currentDay.getMonth() != gtpi.curMonth) { gtpi.newMonth = true; } break; } } /** Pad it out to seven days */ while (days.size() < 7) { tvdi = new TimeViewDailyInfo(calInfo); tvdi.setFiller(true); days.addElement(tvdi); } return (TimeViewDailyInfo[])days.toArray(new TimeViewDailyInfo[ days.size()]); }
days.addElement(tvdi);
days.add(tvdi);
private TimeViewDailyInfo[] getOneWeekTvdi(GtpiData gtpi) throws Throwable { Vector days = new Vector(); TimeViewDailyInfo tvdi; /** First see if we need to insert leading fillers */ int dayOfWeek = gtpi.currentDay.getDayOfWeek(); int dayNum = getFirstDayOfWeek(); if (debug) { debugMsg("dayOfWeek=" + dayOfWeek + " dayNum = " + dayNum); } while (dayNum != dayOfWeek) { tvdi = new TimeViewDailyInfo(calInfo); tvdi.setFiller(true); days.addElement(tvdi); dayNum++; if (debug) { debugMsg("dayNum = " + dayNum); } if (dayNum > 7) { dayNum = 1; } // Check we got this right if (days.size() > 7) { throw new Exception("Programming error in getOneWeekTvdi"); } } for (;;) { dayOfWeek = gtpi.currentDay.getDayOfWeek(); if (gtpi.currentDay.getMonth() != gtpi.curMonth) { gtpi.newMonth = true; break; } gtpi.isLast = gtpi.last.isSameDate(gtpi.currentDay); /* Create a day entry */ tvdi = new TimeViewDailyInfo(calInfo); initTvdi(tvdi, gtpi); tvdi.setDayEntry(true); tvdi.setFirstDay(gtpi.isFirst); tvdi.setLastDay(gtpi.isLast); tvdi.setDayOfMonth(gtpi.currentDay.getDay()); tvdi.setDayOfWeek(dayOfWeek); /** Is this correct? The days of the week are rotated to adjust for * first day differences. */ tvdi.setDayName(calInfo.getDayName(dayOfWeek)); tvdi.setFirstDayOfMonth(gtpi.newMonth); gtpi.newMonth = false; tvdi.setFirstDayOfWeek(getFirstDayOfWeek() == dayOfWeek); tvdi.setLastDayOfWeek(calInfo.getLastDayOfWeek() == dayOfWeek); days.addElement(tvdi); gtpi.isFirst = false; gtpi.prevTvdi = tvdi; gtpi.currentDay = gtpi.currentDay.getTomorrow(); if (gtpi.isLast || tvdi.isLastDayOfWeek()) { // Watch for it also being the last day of the month if (gtpi.currentDay.getMonth() != gtpi.curMonth) { gtpi.newMonth = true; } break; } } /** Pad it out to seven days */ while (days.size() < 7) { tvdi = new TimeViewDailyInfo(calInfo); tvdi.setFiller(true); days.addElement(tvdi); } return (TimeViewDailyInfo[])days.toArray(new TimeViewDailyInfo[ days.size()]); }
Vector months = new Vector(); Vector weeks = new Vector();
ArrayList months = new ArrayList(); ArrayList weeks = new ArrayList();
public TimeViewDailyInfo[] getTimePeriodInfo() { /* In the following code we assume that we never cross year boundaries so that the year is always constant. */ if (tvdis != null) { return tvdis; } try { GtpiData gtpi = new GtpiData(); Vector months = new Vector(); Vector weeks = new Vector(); gtpi.first = getFirstDay(); gtpi.last = getLastDay(); gtpi.multi = !gtpi.last.isSameDate(gtpi.first); gtpi.currentDay = new MyCalendarVO(gtpi.first.getTime(), calInfo.getLocale()); gtpi.year = String.valueOf(gtpi.currentDay.getYear()); Locale loc = Locale.getDefault(); // XXX Locale gtpi.todaysMonth = new MyCalendarVO( // XXX Expensive?? new Date(System.currentTimeMillis()), loc).getTwoDigitMonth(); if (debug) { debugMsg("getFirstDayOfWeek() = " + getFirstDayOfWeek()); debugMsg("gtpi.first.getFirstDayOfWeek() = " + calInfo.getFirstDayOfWeek()); } initGtpiForMonth(gtpi); /* Our month entry */ TimeViewDailyInfo monthTvdi = new TimeViewDailyInfo(calInfo); initTvdi(monthTvdi, gtpi); /* Create a year entry */ TimeViewDailyInfo yearTvdi = new TimeViewDailyInfo(calInfo); yearTvdi.setCal(gtpi.currentDay); yearTvdi.setYear(gtpi.year); yearTvdi.setDate(gtpi.currentDay.getDateDigits()); yearTvdi.setDateShort(gtpi.currentDay.getDateString()); yearTvdi.setDateLong(gtpi.currentDay.getLongDateString()); for (;;) { TimeViewDailyInfo weekTvdi = new TimeViewDailyInfo(calInfo); initTvdi(weekTvdi, gtpi); weekTvdi.setEntries(getOneWeekTvdi(gtpi)); weeks.addElement(weekTvdi); if (getFirstDayOfWeek() == gtpi.currentDay.getDayOfWeek()) { gtpi.weekOfYear++; } if (gtpi.isLast || gtpi.newMonth) { /** First add all the weeks to this month */ if (gtpi.prevTvdi != null) { gtpi.prevTvdi.setLastDayOfMonth(true); } monthTvdi.setEntries( (TimeViewDailyInfo[])weeks.toArray(new TimeViewDailyInfo[ weeks.size()])); months.addElement(monthTvdi); if (gtpi.isLast) { break; } /** Set up for a new month. */ initGtpiForMonth(gtpi); monthTvdi = new TimeViewDailyInfo(calInfo); initTvdi(monthTvdi, gtpi); weeks = new Vector(); } } yearTvdi.setEntries( (TimeViewDailyInfo[])months.toArray(new TimeViewDailyInfo[months.size()])); tvdis = new TimeViewDailyInfo[1]; tvdis[0] = yearTvdi; return tvdis; } catch (Throwable t) { Logger.getLogger(this.getClass()).error("getTimePeriodInfo", t); //XXX We need an error object return null; } }
weeks.addElement(weekTvdi);
weeks.add(weekTvdi);
public TimeViewDailyInfo[] getTimePeriodInfo() { /* In the following code we assume that we never cross year boundaries so that the year is always constant. */ if (tvdis != null) { return tvdis; } try { GtpiData gtpi = new GtpiData(); Vector months = new Vector(); Vector weeks = new Vector(); gtpi.first = getFirstDay(); gtpi.last = getLastDay(); gtpi.multi = !gtpi.last.isSameDate(gtpi.first); gtpi.currentDay = new MyCalendarVO(gtpi.first.getTime(), calInfo.getLocale()); gtpi.year = String.valueOf(gtpi.currentDay.getYear()); Locale loc = Locale.getDefault(); // XXX Locale gtpi.todaysMonth = new MyCalendarVO( // XXX Expensive?? new Date(System.currentTimeMillis()), loc).getTwoDigitMonth(); if (debug) { debugMsg("getFirstDayOfWeek() = " + getFirstDayOfWeek()); debugMsg("gtpi.first.getFirstDayOfWeek() = " + calInfo.getFirstDayOfWeek()); } initGtpiForMonth(gtpi); /* Our month entry */ TimeViewDailyInfo monthTvdi = new TimeViewDailyInfo(calInfo); initTvdi(monthTvdi, gtpi); /* Create a year entry */ TimeViewDailyInfo yearTvdi = new TimeViewDailyInfo(calInfo); yearTvdi.setCal(gtpi.currentDay); yearTvdi.setYear(gtpi.year); yearTvdi.setDate(gtpi.currentDay.getDateDigits()); yearTvdi.setDateShort(gtpi.currentDay.getDateString()); yearTvdi.setDateLong(gtpi.currentDay.getLongDateString()); for (;;) { TimeViewDailyInfo weekTvdi = new TimeViewDailyInfo(calInfo); initTvdi(weekTvdi, gtpi); weekTvdi.setEntries(getOneWeekTvdi(gtpi)); weeks.addElement(weekTvdi); if (getFirstDayOfWeek() == gtpi.currentDay.getDayOfWeek()) { gtpi.weekOfYear++; } if (gtpi.isLast || gtpi.newMonth) { /** First add all the weeks to this month */ if (gtpi.prevTvdi != null) { gtpi.prevTvdi.setLastDayOfMonth(true); } monthTvdi.setEntries( (TimeViewDailyInfo[])weeks.toArray(new TimeViewDailyInfo[ weeks.size()])); months.addElement(monthTvdi); if (gtpi.isLast) { break; } /** Set up for a new month. */ initGtpiForMonth(gtpi); monthTvdi = new TimeViewDailyInfo(calInfo); initTvdi(monthTvdi, gtpi); weeks = new Vector(); } } yearTvdi.setEntries( (TimeViewDailyInfo[])months.toArray(new TimeViewDailyInfo[months.size()])); tvdis = new TimeViewDailyInfo[1]; tvdis[0] = yearTvdi; return tvdis; } catch (Throwable t) { Logger.getLogger(this.getClass()).error("getTimePeriodInfo", t); //XXX We need an error object return null; } }
months.addElement(monthTvdi);
months.add(monthTvdi);
public TimeViewDailyInfo[] getTimePeriodInfo() { /* In the following code we assume that we never cross year boundaries so that the year is always constant. */ if (tvdis != null) { return tvdis; } try { GtpiData gtpi = new GtpiData(); Vector months = new Vector(); Vector weeks = new Vector(); gtpi.first = getFirstDay(); gtpi.last = getLastDay(); gtpi.multi = !gtpi.last.isSameDate(gtpi.first); gtpi.currentDay = new MyCalendarVO(gtpi.first.getTime(), calInfo.getLocale()); gtpi.year = String.valueOf(gtpi.currentDay.getYear()); Locale loc = Locale.getDefault(); // XXX Locale gtpi.todaysMonth = new MyCalendarVO( // XXX Expensive?? new Date(System.currentTimeMillis()), loc).getTwoDigitMonth(); if (debug) { debugMsg("getFirstDayOfWeek() = " + getFirstDayOfWeek()); debugMsg("gtpi.first.getFirstDayOfWeek() = " + calInfo.getFirstDayOfWeek()); } initGtpiForMonth(gtpi); /* Our month entry */ TimeViewDailyInfo monthTvdi = new TimeViewDailyInfo(calInfo); initTvdi(monthTvdi, gtpi); /* Create a year entry */ TimeViewDailyInfo yearTvdi = new TimeViewDailyInfo(calInfo); yearTvdi.setCal(gtpi.currentDay); yearTvdi.setYear(gtpi.year); yearTvdi.setDate(gtpi.currentDay.getDateDigits()); yearTvdi.setDateShort(gtpi.currentDay.getDateString()); yearTvdi.setDateLong(gtpi.currentDay.getLongDateString()); for (;;) { TimeViewDailyInfo weekTvdi = new TimeViewDailyInfo(calInfo); initTvdi(weekTvdi, gtpi); weekTvdi.setEntries(getOneWeekTvdi(gtpi)); weeks.addElement(weekTvdi); if (getFirstDayOfWeek() == gtpi.currentDay.getDayOfWeek()) { gtpi.weekOfYear++; } if (gtpi.isLast || gtpi.newMonth) { /** First add all the weeks to this month */ if (gtpi.prevTvdi != null) { gtpi.prevTvdi.setLastDayOfMonth(true); } monthTvdi.setEntries( (TimeViewDailyInfo[])weeks.toArray(new TimeViewDailyInfo[ weeks.size()])); months.addElement(monthTvdi); if (gtpi.isLast) { break; } /** Set up for a new month. */ initGtpiForMonth(gtpi); monthTvdi = new TimeViewDailyInfo(calInfo); initTvdi(monthTvdi, gtpi); weeks = new Vector(); } } yearTvdi.setEntries( (TimeViewDailyInfo[])months.toArray(new TimeViewDailyInfo[months.size()])); tvdis = new TimeViewDailyInfo[1]; tvdis[0] = yearTvdi; return tvdis; } catch (Throwable t) { Logger.getLogger(this.getClass()).error("getTimePeriodInfo", t); //XXX We need an error object return null; } }
weeks = new Vector();
weeks = new ArrayList();
public TimeViewDailyInfo[] getTimePeriodInfo() { /* In the following code we assume that we never cross year boundaries so that the year is always constant. */ if (tvdis != null) { return tvdis; } try { GtpiData gtpi = new GtpiData(); Vector months = new Vector(); Vector weeks = new Vector(); gtpi.first = getFirstDay(); gtpi.last = getLastDay(); gtpi.multi = !gtpi.last.isSameDate(gtpi.first); gtpi.currentDay = new MyCalendarVO(gtpi.first.getTime(), calInfo.getLocale()); gtpi.year = String.valueOf(gtpi.currentDay.getYear()); Locale loc = Locale.getDefault(); // XXX Locale gtpi.todaysMonth = new MyCalendarVO( // XXX Expensive?? new Date(System.currentTimeMillis()), loc).getTwoDigitMonth(); if (debug) { debugMsg("getFirstDayOfWeek() = " + getFirstDayOfWeek()); debugMsg("gtpi.first.getFirstDayOfWeek() = " + calInfo.getFirstDayOfWeek()); } initGtpiForMonth(gtpi); /* Our month entry */ TimeViewDailyInfo monthTvdi = new TimeViewDailyInfo(calInfo); initTvdi(monthTvdi, gtpi); /* Create a year entry */ TimeViewDailyInfo yearTvdi = new TimeViewDailyInfo(calInfo); yearTvdi.setCal(gtpi.currentDay); yearTvdi.setYear(gtpi.year); yearTvdi.setDate(gtpi.currentDay.getDateDigits()); yearTvdi.setDateShort(gtpi.currentDay.getDateString()); yearTvdi.setDateLong(gtpi.currentDay.getLongDateString()); for (;;) { TimeViewDailyInfo weekTvdi = new TimeViewDailyInfo(calInfo); initTvdi(weekTvdi, gtpi); weekTvdi.setEntries(getOneWeekTvdi(gtpi)); weeks.addElement(weekTvdi); if (getFirstDayOfWeek() == gtpi.currentDay.getDayOfWeek()) { gtpi.weekOfYear++; } if (gtpi.isLast || gtpi.newMonth) { /** First add all the weeks to this month */ if (gtpi.prevTvdi != null) { gtpi.prevTvdi.setLastDayOfMonth(true); } monthTvdi.setEntries( (TimeViewDailyInfo[])weeks.toArray(new TimeViewDailyInfo[ weeks.size()])); months.addElement(monthTvdi); if (gtpi.isLast) { break; } /** Set up for a new month. */ initGtpiForMonth(gtpi); monthTvdi = new TimeViewDailyInfo(calInfo); initTvdi(monthTvdi, gtpi); weeks = new Vector(); } } yearTvdi.setEntries( (TimeViewDailyInfo[])months.toArray(new TimeViewDailyInfo[months.size()])); tvdis = new TimeViewDailyInfo[1]; tvdis[0] = yearTvdi; return tvdis; } catch (Throwable t) { Logger.getLogger(this.getClass()).error("getTimePeriodInfo", t); //XXX We need an error object return null; } }
public static BwDateTime getDateTime(String val, CalTimezones timezones) throws CalFacadeException { Date dt; boolean UTC = false; boolean dateOnly = false;
public static BwDateTime getDateTime(Date dt, boolean dateOnly, boolean UTC, CalTimezones timezones) throws CalFacadeException { BwDateTime dtm = new BwDateTime();
public static BwDateTime getDateTime(String val, CalTimezones timezones) throws CalFacadeException { Date dt; boolean UTC = false; boolean dateOnly = false; try { dt = fromISODateTimeUTC(val); UTC = true; } catch (CalFacadeBadDateException bde1) { try { dt = fromISODateTime(val); } catch (CalFacadeBadDateException bde2) { try { dt = fromISODate(val); dateOnly = true; } catch (CalFacadeException ce) { throw ce; } catch (Throwable t) { throw new CalFacadeException(t); } } } catch (Throwable t) { throw new CalFacadeException(t); } return getDateTime(dt, dateOnly, UTC, timezones); }
try { dt = fromISODateTimeUTC(val); UTC = true; } catch (CalFacadeBadDateException bde1) { try { dt = fromISODateTime(val); } catch (CalFacadeBadDateException bde2) { try { dt = fromISODate(val); dateOnly = true; } catch (CalFacadeException ce) { throw ce; } catch (Throwable t) { throw new CalFacadeException(t); } } } catch (Throwable t) { throw new CalFacadeException(t);
String date; if (dateOnly) { date = isoDate(dt); } else if (UTC) { date = isoDateTimeUTC(dt); } else { date = isoDateTime(dt);
public static BwDateTime getDateTime(String val, CalTimezones timezones) throws CalFacadeException { Date dt; boolean UTC = false; boolean dateOnly = false; try { dt = fromISODateTimeUTC(val); UTC = true; } catch (CalFacadeBadDateException bde1) { try { dt = fromISODateTime(val); } catch (CalFacadeBadDateException bde2) { try { dt = fromISODate(val); dateOnly = true; } catch (CalFacadeException ce) { throw ce; } catch (Throwable t) { throw new CalFacadeException(t); } } } catch (Throwable t) { throw new CalFacadeException(t); } return getDateTime(dt, dateOnly, UTC, timezones); }
return getDateTime(dt, dateOnly, UTC, timezones);
dtm.init(dateOnly, date, timezones.getDefaultTimeZoneId(), timezones); return dtm;
public static BwDateTime getDateTime(String val, CalTimezones timezones) throws CalFacadeException { Date dt; boolean UTC = false; boolean dateOnly = false; try { dt = fromISODateTimeUTC(val); UTC = true; } catch (CalFacadeBadDateException bde1) { try { dt = fromISODateTime(val); } catch (CalFacadeBadDateException bde2) { try { dt = fromISODate(val); dateOnly = true; } catch (CalFacadeException ce) { throw ce; } catch (Throwable t) { throw new CalFacadeException(t); } } } catch (Throwable t) { throw new CalFacadeException(t); } return getDateTime(dt, dateOnly, UTC, timezones); }
public abstract Collection getEvents(BwSubscription sub, BwFilter filter, BwDateTime startDate, BwDateTime endDate, int recurRetrieval) throws CalFacadeException;
public abstract Collection getEvents(BwSubscription sub, int recurRetrieval) throws CalFacadeException;
public abstract Collection getEvents(BwSubscription sub, BwFilter filter, BwDateTime startDate, BwDateTime endDate, int recurRetrieval) throws CalFacadeException;
CalSvcI svci = form.fetchSvci(); String name = getReqPar(request, "subname"); if (name != null) { BwSubscription sub = svci.findSubscription(name); if (sub == null) { form.getErr().emit("org.bedework.client.error.unknownsubscription"); return "notFound"; } Collection c = new Vector(); c.add(sub); svci.setCurrentSubscriptions(c); form.setSelectionType(BedeworkDefs.selectionTypeSubscription); return "success";
String forward = trySub(request, form); if (forward != null) { return forward;
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svci = form.fetchSvci(); String name = getReqPar(request, "subname"); if (name != null) { BwSubscription sub = svci.findSubscription(name); if (sub == null) { form.getErr().emit("org.bedework.client.error.unknownsubscription"); return "notFound"; } Collection c = new Vector(); c.add(sub); svci.setCurrentSubscriptions(c); form.setSelectionType(BedeworkDefs.selectionTypeSubscription); return "success"; } String url = getReqPar(request, "calUrl"); if (url != null) { BwCalendar cal = findCalendar(url, form); if (cal == null) { form.getErr().emit("org.bedework.client.error.unknowncalendar"); return "notFound"; } BwSubscription sub = BwSubscription.makeSubscription(cal); Collection c = new Vector(); c.add(sub); svci.setCurrentSubscriptions(c); form.setSelectionType(BedeworkDefs.selectionTypeCalendar); return "success"; } name = getReqPar(request, "viewName"); if (name == null) { name = svci.getUserPrefs().getPreferredView(); } if (name == null) { form.getErr().emit("org.bedework.client.error.nodefaultview"); return "noViewDef"; } if (!svci.setCurrentView(name)) { form.getErr().emit("org.bedework.client.error.unknownview"); return "noViewDef"; } form.refreshIsNeeded(); return "success"; }
String url = getReqPar(request, "calUrl"); if (url != null) { BwCalendar cal = findCalendar(url, form); if (cal == null) { form.getErr().emit("org.bedework.client.error.unknowncalendar"); return "notFound"; } BwSubscription sub = BwSubscription.makeSubscription(cal); Collection c = new Vector(); c.add(sub); svci.setCurrentSubscriptions(c); form.setSelectionType(BedeworkDefs.selectionTypeCalendar); return "success";
forward = tryCal(request, form); if (forward != null) { return forward;
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svci = form.fetchSvci(); String name = getReqPar(request, "subname"); if (name != null) { BwSubscription sub = svci.findSubscription(name); if (sub == null) { form.getErr().emit("org.bedework.client.error.unknownsubscription"); return "notFound"; } Collection c = new Vector(); c.add(sub); svci.setCurrentSubscriptions(c); form.setSelectionType(BedeworkDefs.selectionTypeSubscription); return "success"; } String url = getReqPar(request, "calUrl"); if (url != null) { BwCalendar cal = findCalendar(url, form); if (cal == null) { form.getErr().emit("org.bedework.client.error.unknowncalendar"); return "notFound"; } BwSubscription sub = BwSubscription.makeSubscription(cal); Collection c = new Vector(); c.add(sub); svci.setCurrentSubscriptions(c); form.setSelectionType(BedeworkDefs.selectionTypeCalendar); return "success"; } name = getReqPar(request, "viewName"); if (name == null) { name = svci.getUserPrefs().getPreferredView(); } if (name == null) { form.getErr().emit("org.bedework.client.error.nodefaultview"); return "noViewDef"; } if (!svci.setCurrentView(name)) { form.getErr().emit("org.bedework.client.error.unknownview"); return "noViewDef"; } form.refreshIsNeeded(); return "success"; }
name = getReqPar(request, "viewName"); if (name == null) { name = svci.getUserPrefs().getPreferredView(); } if (name == null) { form.getErr().emit("org.bedework.client.error.nodefaultview"); return "noViewDef"; } if (!svci.setCurrentView(name)) { form.getErr().emit("org.bedework.client.error.unknownview"); return "noViewDef"; } form.refreshIsNeeded(); return "success";
return doView(request, form);
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svci = form.fetchSvci(); String name = getReqPar(request, "subname"); if (name != null) { BwSubscription sub = svci.findSubscription(name); if (sub == null) { form.getErr().emit("org.bedework.client.error.unknownsubscription"); return "notFound"; } Collection c = new Vector(); c.add(sub); svci.setCurrentSubscriptions(c); form.setSelectionType(BedeworkDefs.selectionTypeSubscription); return "success"; } String url = getReqPar(request, "calUrl"); if (url != null) { BwCalendar cal = findCalendar(url, form); if (cal == null) { form.getErr().emit("org.bedework.client.error.unknowncalendar"); return "notFound"; } BwSubscription sub = BwSubscription.makeSubscription(cal); Collection c = new Vector(); c.add(sub); svci.setCurrentSubscriptions(c); form.setSelectionType(BedeworkDefs.selectionTypeCalendar); return "success"; } name = getReqPar(request, "viewName"); if (name == null) { name = svci.getUserPrefs().getPreferredView(); } if (name == null) { form.getErr().emit("org.bedework.client.error.nodefaultview"); return "noViewDef"; } if (!svci.setCurrentView(name)) { form.getErr().emit("org.bedework.client.error.unknownview"); return "noViewDef"; } form.refreshIsNeeded(); return "success"; }
return new NATObject(OBJLexicalRoot._INSTANCE_);
return new NATIsolate(OBJLexicalRoot._INSTANCE_);
private static NATObject createGlobalLexicalScope() { return new NATObject(OBJLexicalRoot._INSTANCE_); }
int currentMode, boolean ignoreCreator, boolean debug) { super(cal, access, currentMode, ignoreCreator, debug);
int currentMode, boolean debug) { super(cal, access, currentMode, debug);
public Events(Calintf cal, AccessUtil access, int currentMode, boolean ignoreCreator, boolean debug) { super(cal, access, currentMode, ignoreCreator, debug); }
currentMode, ignoreCreator);
currentMode, cal.getSuperUser());
public Collection getEvents(BwCalendar calendar, BwFilter filter, BwDateTime startDate, BwDateTime endDate, int recurRetrieval) throws CalFacadeException { HibSession sess = getSess(); StringBuffer sb = new StringBuffer(); if (debug) { trace("getEvents for start=" + startDate + " end=" + endDate); } /* Name of the event in the query */ final String qevName = "ev"; Filters flt = new Filters(filter, sb, qevName, debug); /* SEG: from Events ev where */ sb.append("from "); sb.append(BwEvent.class.getName()); sb.append(" "); sb.append(qevName); sb.append(" where "); /* SEG: (<date-ranges>) and */ if (appendDateTerms(sb, qevName + ".dtstart.date", qevName + ".dtend.date", startDate, endDate)) { sb.append(" and "); } /* Don't retrieve any master records - I guess we might have a choice to retrieve any with the dates in the given range */ sb.append(qevName); sb.append(".recurring = false and "); /* SEG ( */ sb.append(" ("); boolean setUser = doCalendarClause(sb, qevName, calendar, currentMode, ignoreCreator); sb.append(") "); flt.addWhereFilters(); sb.append(" order by "); sb.append(qevName); sb.append(".dtstart.dtval"); //if (debug) { // trace(sb.toString()); //} sess.createQuery(sb.toString()); /* XXX Limit result set size - pagination allows something like: query.setFirstResult(0); query.setMaxResults(10); */ if (startDate != null) { sess.setString("fromDate", startDate.getDate()); } if (endDate != null) { sess.setString("toDate", endDate.getDate()); } doCalendarEntities(setUser, calendar); flt.parPass(sess); if (debug) { trace(sess.getQueryString()); } Collection es = sess.getList(); if (debug) { trace("Found " + es.size() + " events"); } es = postGetEvents(es, privRead, noAccessReturnsNull); /** Run the events we got through the filters */ es = flt.postExec(es); Collection rs = getLimitedRecurrences(calendar, filter, startDate, endDate, currentMode, ignoreCreator, recurRetrieval); if (rs != null) { es.addAll(rs); } return es; }
currentMode, ignoreCreator,
currentMode, cal.getSuperUser(),
public Collection getEvents(BwCalendar calendar, BwFilter filter, BwDateTime startDate, BwDateTime endDate, int recurRetrieval) throws CalFacadeException { HibSession sess = getSess(); StringBuffer sb = new StringBuffer(); if (debug) { trace("getEvents for start=" + startDate + " end=" + endDate); } /* Name of the event in the query */ final String qevName = "ev"; Filters flt = new Filters(filter, sb, qevName, debug); /* SEG: from Events ev where */ sb.append("from "); sb.append(BwEvent.class.getName()); sb.append(" "); sb.append(qevName); sb.append(" where "); /* SEG: (<date-ranges>) and */ if (appendDateTerms(sb, qevName + ".dtstart.date", qevName + ".dtend.date", startDate, endDate)) { sb.append(" and "); } /* Don't retrieve any master records - I guess we might have a choice to retrieve any with the dates in the given range */ sb.append(qevName); sb.append(".recurring = false and "); /* SEG ( */ sb.append(" ("); boolean setUser = doCalendarClause(sb, qevName, calendar, currentMode, ignoreCreator); sb.append(") "); flt.addWhereFilters(); sb.append(" order by "); sb.append(qevName); sb.append(".dtstart.dtval"); //if (debug) { // trace(sb.toString()); //} sess.createQuery(sb.toString()); /* XXX Limit result set size - pagination allows something like: query.setFirstResult(0); query.setMaxResults(10); */ if (startDate != null) { sess.setString("fromDate", startDate.getDate()); } if (endDate != null) { sess.setString("toDate", endDate.getDate()); } doCalendarEntities(setUser, calendar); flt.parPass(sess); if (debug) { trace(sess.getQueryString()); } Collection es = sess.getList(); if (debug) { trace("Found " + es.size() + " events"); } es = postGetEvents(es, privRead, noAccessReturnsNull); /** Run the events we got through the filters */ es = flt.postExec(es); Collection rs = getLimitedRecurrences(calendar, filter, startDate, endDate, currentMode, ignoreCreator, recurRetrieval); if (rs != null) { es.addAll(rs); } return es; }
mapBean = new MapBean();
mapBean = getMapBean();
public OpenMap(EventTableModel etm, ListSelectionModel lsm){ try{ mapHandler = new MapHandler(); mapHandler.add(this); // Create a MapBean mapBean = new MapBean(); //get the projection and set its background color and center point Proj proj = new CADRG(new LatLonPoint(mapBean.DEFAULT_CENTER_LAT, mapBean.DEFAULT_CENTER_LON), 200000000f, mapBean.DEFAULT_WIDTH, mapBean.DEFAULT_HEIGHT); proj.setBackgroundColor(WATER); mapBean.setProjection(proj); mapBean.setCenter(20, 200); mapHandler.add(mapBean); // Create and add a LayerHandler to the MapHandler. The // LayerHandler manages Layers, whether they are part of the // map or not. layer.setVisible(true) will add it to the map. // The LayerHandler has methods to do this, too. The // LayerHandler will find the MapBean in the MapHandler. lh = new LayerHandler(); mapHandler.add(lh); if(etm != null){ EventLayer el = new EventLayer(etm, lsm, mapBean); mapHandler.add(el); lh.addLayer(el, 1); } // Create a ShapeLayer to show world political boundaries. ShapeLayer shapeLayer = new ShapeLayer(); //Create shape layer properties Properties shapeLayerProps = new Properties(); shapeLayerProps.put("prettyName", "Political Solid"); shapeLayerProps.put("lineColor", "000000"); shapeLayerProps.put("fillColor", "39DA87"); shapeLayerProps.put("shapeFile", "edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse.shp"); shapeLayerProps.put("spatialIndex", "edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse.ssx"); shapeLayer.setProperties(shapeLayerProps); shapeLayer.setVisible(true); mapHandler.add(shapeLayer); // Create the directional and zoom control tool OMToolSet omts = new OMToolSet(); // Create an OpenMap toolbar ToolPanel toolBar = new ToolPanel(); // Add the ToolPanel and the OMToolSet to the MapHandler. The // OpenMapFrame will find the ToolPanel and attach it to the // top part of its content pane, and the ToolPanel will find // the OMToolSet and add it to itself. mapHandler.add(omts); mapHandler.add(toolBar); mapHandler.add(new MouseDelegator()); mapHandler.add(new SelectMouseMode()); mapHandler.add(new InformationDelegator()); } catch (MultipleSoloMapComponentException msmce) { // The MapHandler is only allowed to have one of certain // items. These items implement the SoloMapComponent // interface. The MapHandler can have a policy that // determines what to do when duplicate instances of the // same type of object are added - replace or ignore. // In this class, this will never happen, since we are // controlling that one MapBean, LayerHandler, // MouseDelegator, etc is being added to the MapHandler. } }
200000000f,
DEFAULT_SCALE,
public OpenMap(EventTableModel etm, ListSelectionModel lsm){ try{ mapHandler = new MapHandler(); mapHandler.add(this); // Create a MapBean mapBean = new MapBean(); //get the projection and set its background color and center point Proj proj = new CADRG(new LatLonPoint(mapBean.DEFAULT_CENTER_LAT, mapBean.DEFAULT_CENTER_LON), 200000000f, mapBean.DEFAULT_WIDTH, mapBean.DEFAULT_HEIGHT); proj.setBackgroundColor(WATER); mapBean.setProjection(proj); mapBean.setCenter(20, 200); mapHandler.add(mapBean); // Create and add a LayerHandler to the MapHandler. The // LayerHandler manages Layers, whether they are part of the // map or not. layer.setVisible(true) will add it to the map. // The LayerHandler has methods to do this, too. The // LayerHandler will find the MapBean in the MapHandler. lh = new LayerHandler(); mapHandler.add(lh); if(etm != null){ EventLayer el = new EventLayer(etm, lsm, mapBean); mapHandler.add(el); lh.addLayer(el, 1); } // Create a ShapeLayer to show world political boundaries. ShapeLayer shapeLayer = new ShapeLayer(); //Create shape layer properties Properties shapeLayerProps = new Properties(); shapeLayerProps.put("prettyName", "Political Solid"); shapeLayerProps.put("lineColor", "000000"); shapeLayerProps.put("fillColor", "39DA87"); shapeLayerProps.put("shapeFile", "edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse.shp"); shapeLayerProps.put("spatialIndex", "edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse.ssx"); shapeLayer.setProperties(shapeLayerProps); shapeLayer.setVisible(true); mapHandler.add(shapeLayer); // Create the directional and zoom control tool OMToolSet omts = new OMToolSet(); // Create an OpenMap toolbar ToolPanel toolBar = new ToolPanel(); // Add the ToolPanel and the OMToolSet to the MapHandler. The // OpenMapFrame will find the ToolPanel and attach it to the // top part of its content pane, and the ToolPanel will find // the OMToolSet and add it to itself. mapHandler.add(omts); mapHandler.add(toolBar); mapHandler.add(new MouseDelegator()); mapHandler.add(new SelectMouseMode()); mapHandler.add(new InformationDelegator()); } catch (MultipleSoloMapComponentException msmce) { // The MapHandler is only allowed to have one of certain // items. These items implement the SoloMapComponent // interface. The MapHandler can have a policy that // determines what to do when duplicate instances of the // same type of object are added - replace or ignore. // In this class, this will never happen, since we are // controlling that one MapBean, LayerHandler, // MouseDelegator, etc is being added to the MapHandler. } }
shapeLayerProps.put("shapeFile", "edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse.shp"); shapeLayerProps.put("spatialIndex", "edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse.ssx");
shapeLayerProps.put("shapeFile", "edu/sc/seis/vsnexplorer/data/maps/dcwpo-browse.shp"); shapeLayerProps.put("spatialIndex", "edu/sc/seis/vsnexplorer/data/maps/dcwpo-browse.ssx");
public OpenMap(EventTableModel etm, ListSelectionModel lsm){ try{ mapHandler = new MapHandler(); mapHandler.add(this); // Create a MapBean mapBean = new MapBean(); //get the projection and set its background color and center point Proj proj = new CADRG(new LatLonPoint(mapBean.DEFAULT_CENTER_LAT, mapBean.DEFAULT_CENTER_LON), 200000000f, mapBean.DEFAULT_WIDTH, mapBean.DEFAULT_HEIGHT); proj.setBackgroundColor(WATER); mapBean.setProjection(proj); mapBean.setCenter(20, 200); mapHandler.add(mapBean); // Create and add a LayerHandler to the MapHandler. The // LayerHandler manages Layers, whether they are part of the // map or not. layer.setVisible(true) will add it to the map. // The LayerHandler has methods to do this, too. The // LayerHandler will find the MapBean in the MapHandler. lh = new LayerHandler(); mapHandler.add(lh); if(etm != null){ EventLayer el = new EventLayer(etm, lsm, mapBean); mapHandler.add(el); lh.addLayer(el, 1); } // Create a ShapeLayer to show world political boundaries. ShapeLayer shapeLayer = new ShapeLayer(); //Create shape layer properties Properties shapeLayerProps = new Properties(); shapeLayerProps.put("prettyName", "Political Solid"); shapeLayerProps.put("lineColor", "000000"); shapeLayerProps.put("fillColor", "39DA87"); shapeLayerProps.put("shapeFile", "edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse.shp"); shapeLayerProps.put("spatialIndex", "edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse.ssx"); shapeLayer.setProperties(shapeLayerProps); shapeLayer.setVisible(true); mapHandler.add(shapeLayer); // Create the directional and zoom control tool OMToolSet omts = new OMToolSet(); // Create an OpenMap toolbar ToolPanel toolBar = new ToolPanel(); // Add the ToolPanel and the OMToolSet to the MapHandler. The // OpenMapFrame will find the ToolPanel and attach it to the // top part of its content pane, and the ToolPanel will find // the OMToolSet and add it to itself. mapHandler.add(omts); mapHandler.add(toolBar); mapHandler.add(new MouseDelegator()); mapHandler.add(new SelectMouseMode()); mapHandler.add(new InformationDelegator()); } catch (MultipleSoloMapComponentException msmce) { // The MapHandler is only allowed to have one of certain // items. These items implement the SoloMapComponent // interface. The MapHandler can have a policy that // determines what to do when duplicate instances of the // same type of object are added - replace or ignore. // In this class, this will never happen, since we are // controlling that one MapBean, LayerHandler, // MouseDelegator, etc is being added to the MapHandler. } }
InformationDelegator infoDel = new InformationDelegator(); infoDel.setShowLights(false); mouseDelegator = new MouseDelegator();
public OpenMap(EventTableModel etm, ListSelectionModel lsm){ try{ mapHandler = new MapHandler(); mapHandler.add(this); // Create a MapBean mapBean = new MapBean(); //get the projection and set its background color and center point Proj proj = new CADRG(new LatLonPoint(mapBean.DEFAULT_CENTER_LAT, mapBean.DEFAULT_CENTER_LON), 200000000f, mapBean.DEFAULT_WIDTH, mapBean.DEFAULT_HEIGHT); proj.setBackgroundColor(WATER); mapBean.setProjection(proj); mapBean.setCenter(20, 200); mapHandler.add(mapBean); // Create and add a LayerHandler to the MapHandler. The // LayerHandler manages Layers, whether they are part of the // map or not. layer.setVisible(true) will add it to the map. // The LayerHandler has methods to do this, too. The // LayerHandler will find the MapBean in the MapHandler. lh = new LayerHandler(); mapHandler.add(lh); if(etm != null){ EventLayer el = new EventLayer(etm, lsm, mapBean); mapHandler.add(el); lh.addLayer(el, 1); } // Create a ShapeLayer to show world political boundaries. ShapeLayer shapeLayer = new ShapeLayer(); //Create shape layer properties Properties shapeLayerProps = new Properties(); shapeLayerProps.put("prettyName", "Political Solid"); shapeLayerProps.put("lineColor", "000000"); shapeLayerProps.put("fillColor", "39DA87"); shapeLayerProps.put("shapeFile", "edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse.shp"); shapeLayerProps.put("spatialIndex", "edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse.ssx"); shapeLayer.setProperties(shapeLayerProps); shapeLayer.setVisible(true); mapHandler.add(shapeLayer); // Create the directional and zoom control tool OMToolSet omts = new OMToolSet(); // Create an OpenMap toolbar ToolPanel toolBar = new ToolPanel(); // Add the ToolPanel and the OMToolSet to the MapHandler. The // OpenMapFrame will find the ToolPanel and attach it to the // top part of its content pane, and the ToolPanel will find // the OMToolSet and add it to itself. mapHandler.add(omts); mapHandler.add(toolBar); mapHandler.add(new MouseDelegator()); mapHandler.add(new SelectMouseMode()); mapHandler.add(new InformationDelegator()); } catch (MultipleSoloMapComponentException msmce) { // The MapHandler is only allowed to have one of certain // items. These items implement the SoloMapComponent // interface. The MapHandler can have a policy that // determines what to do when duplicate instances of the // same type of object are added - replace or ignore. // In this class, this will never happen, since we are // controlling that one MapBean, LayerHandler, // MouseDelegator, etc is being added to the MapHandler. } }
mapHandler.add(new MouseDelegator()); mapHandler.add(new SelectMouseMode()); mapHandler.add(new InformationDelegator());
mapHandler.add(mouseDelegator); mapHandler.add(infoDel);
public OpenMap(EventTableModel etm, ListSelectionModel lsm){ try{ mapHandler = new MapHandler(); mapHandler.add(this); // Create a MapBean mapBean = new MapBean(); //get the projection and set its background color and center point Proj proj = new CADRG(new LatLonPoint(mapBean.DEFAULT_CENTER_LAT, mapBean.DEFAULT_CENTER_LON), 200000000f, mapBean.DEFAULT_WIDTH, mapBean.DEFAULT_HEIGHT); proj.setBackgroundColor(WATER); mapBean.setProjection(proj); mapBean.setCenter(20, 200); mapHandler.add(mapBean); // Create and add a LayerHandler to the MapHandler. The // LayerHandler manages Layers, whether they are part of the // map or not. layer.setVisible(true) will add it to the map. // The LayerHandler has methods to do this, too. The // LayerHandler will find the MapBean in the MapHandler. lh = new LayerHandler(); mapHandler.add(lh); if(etm != null){ EventLayer el = new EventLayer(etm, lsm, mapBean); mapHandler.add(el); lh.addLayer(el, 1); } // Create a ShapeLayer to show world political boundaries. ShapeLayer shapeLayer = new ShapeLayer(); //Create shape layer properties Properties shapeLayerProps = new Properties(); shapeLayerProps.put("prettyName", "Political Solid"); shapeLayerProps.put("lineColor", "000000"); shapeLayerProps.put("fillColor", "39DA87"); shapeLayerProps.put("shapeFile", "edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse.shp"); shapeLayerProps.put("spatialIndex", "edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse.ssx"); shapeLayer.setProperties(shapeLayerProps); shapeLayer.setVisible(true); mapHandler.add(shapeLayer); // Create the directional and zoom control tool OMToolSet omts = new OMToolSet(); // Create an OpenMap toolbar ToolPanel toolBar = new ToolPanel(); // Add the ToolPanel and the OMToolSet to the MapHandler. The // OpenMapFrame will find the ToolPanel and attach it to the // top part of its content pane, and the ToolPanel will find // the OMToolSet and add it to itself. mapHandler.add(omts); mapHandler.add(toolBar); mapHandler.add(new MouseDelegator()); mapHandler.add(new SelectMouseMode()); mapHandler.add(new InformationDelegator()); } catch (MultipleSoloMapComponentException msmce) { // The MapHandler is only allowed to have one of certain // items. These items implement the SoloMapComponent // interface. The MapHandler can have a policy that // determines what to do when duplicate instances of the // same type of object are added - replace or ignore. // In this class, this will never happen, since we are // controlling that one MapBean, LayerHandler, // MouseDelegator, etc is being added to the MapHandler. } }
AGSymbol.alloc("Native anonymous implementation in " + creatorClass_.getName())}));
AGSymbol.jAlloc("Native anonymous implementation in " + creatorClass_.getName())}));
public ATBegin base_getBodyExpression() { return new AGBegin(new NATTable(new ATObject[] { AGSymbol.alloc("Native anonymous implementation in " + creatorClass_.getName())})); }
int[] getPartialValues(ReadablePartial fieldSource, Object object, Chronology chrono, DateTimeFormatter parser);
int[] getPartialValues(ReadablePartial fieldSource, Object object, Chronology chrono);
int[] getPartialValues(ReadablePartial fieldSource, Object object, Chronology chrono, DateTimeFormatter parser);
public DateMidnight(int year, int monthOfYear, int dayOfMonth, Chronology chronology) { super(year, monthOfYear, dayOfMonth, 0, 0, 0, 0, chronology);
public DateMidnight() { super();
public DateMidnight(int year, int monthOfYear, int dayOfMonth, Chronology chronology) { super(year, monthOfYear, dayOfMonth, 0, 0, 0, 0, chronology); }
debugOut("Error emitted: property=" + pname +
debugOut("Emitted: property=" + pname +
protected void debugMsg(String pname, String ptype, String pval) { debugOut("Error emitted: property=" + pname + " ptype=" + ptype + " val(s)=" + pval); }
textField.setPreferredSize( new Dimension(300, 25) );
textField.setPreferredSize( new Dimension(275, 25) );
FilterPanel( SortedSet tags, DataDictionary dataDictionary ) { setLayout( new FlowLayout() ); enablePanel( false ); checkBox.setPreferredSize( new Dimension(25, 25) ); add( checkBox ); comboBox.setPreferredSize( new Dimension(200, 25) ); add( comboBox ); operatorComboBox.setPreferredSize( new Dimension(50, 25) ); add( operatorComboBox ); textField.setPreferredSize( new Dimension(300, 25) ); add( textField ); add( new JLabel() ); TreeSet sortedTags = new TreeSet(tags); Iterator i = sortedTags.iterator(); while( i.hasNext() ) { comboBox.addItem( new ComboBoxItem((Integer)i.next(), dataDictionary )); } checkBox.addChangeListener( this ); }
TimeRange fileTimeWindow)
MicroSecondTimeRange fileTimeWindow)
public void testUnknownDasChannelCreation() { DASChannelCreator creator = new DASChannelCreator(NCReaderTest.net, new SamplingFinder() { public int find(String file, TimeRange fileTimeWindow) throws RT130FormatException, IOException { return 40; } }); MicroSecondDate now = new MicroSecondDate(); Channel[] chans = creator.create("1337", now, "1/00331133", new TimeRange()); assertEquals(3, chans.length); assertEquals("1337", chans[0].my_site.my_station.get_code()); // We assume that the channels are BH[ZNE] assertEquals("BHZ", chans[0].get_code()); Channel[] newChans = creator.create("1337", now.subtract(new TimeInterval(1, UnitImpl.MINUTE)), "1/00331133", new TimeRange()); // Dummy DAS channels just expand to fill whatever time is requsted of // that das for(int i = 0; i < newChans.length; i++) { assertEquals(chans[i], newChans[i]); } }