Package java.util

Examples of java.util.Calendar


    try {
      SOAPRequest soapRequest = new SOAPRequest(
              mProperties.getProperty("username", "").trim(),
              IOUtilities.xorDecode(mProperties.getProperty("password", ""), SchedulesDirectSettingsPanel.PASSWORDSEED).trim(),
              SCHEDULESDIRECT_SERVICE);
      Calendar start = Calendar.getInstance();
      Calendar end = Calendar.getInstance();
      end.add(Calendar.DAY_OF_MONTH, 1);

      Xtvd xtvd = new Xtvd();
      soapRequest.getData(start, end, xtvd);

      Map<Integer, Station> stations = xtvd.getStations();
View Full Code Here


    @Override
    public void endElement(String uri, String localName, String qName) throws SAXException {
        if (qName.equals("e2event")) {
            try {
                Calendar cal = Calendar.getInstance();
                cal.setTime(new java.util.Date(Long.parseLong(mCurrentEvent.get("e2eventstart")) * 1000));
                Date programDate = new Date(cal);
                MutableProgram prog = new MutableProgram(mChannel, programDate, cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), true);
                prog.setTitle(mCurrentEvent.get("e2eventtitle"));

                prog.setDescription(mCurrentEvent.get("e2eventdescriptionextended"));

                String shortDesc = mCurrentEvent.get("e2eventdescription");
View Full Code Here

          myEntry.setTitle(new PlainTextConstruct(title));

          String desc = parser.analyse(formatting.getContentValue(), program);
          myEntry.setContent(new PlainTextConstruct(desc));

          Calendar c = CalendarToolbox.getStartAsCalendar(program);

          DateTime startTime = new DateTime(c.getTime(), c.getTimeZone());

          c = CalendarToolbox.getEndAsCalendar(program);

          DateTime endTime = new DateTime(c.getTime(), c.getTimeZone());

          When eventTimes = new When();

          eventTimes.setStartTime(startTime);
          eventTimes.setEndTime(endTime);
View Full Code Here

    return false;
  }

  private CalendarEventEntry findEntryForProgram(GoogleService myService, URL postUrl, String title, Program program) throws IOException, ServiceException {
    Calendar c = CalendarToolbox.getStartAsCalendar(program);
    DateTime startTime = new DateTime(c.getTime(), c.getTimeZone());

    Query myQuery = new Query(postUrl);
    myQuery.setFullTextQuery(title);
    CalendarEventFeed myResultsFeed = myService.query(myQuery, CalendarEventFeed.class);
View Full Code Here

            Program p = list[i];

            out.println();
            out.println("BEGIN:VEVENT");

            Calendar c = Calendar.getInstance();

            printCreated(out, mDate.format(c.getTime()) + "T"
                + mTime.format(c.getTime()), i);

            if (settings.isClassificationPrivate()) {
              out.println("CLASS:PRIVATE");
            }
            else if (settings.isClassificationConfidential()) {
              out.println("CLASS:CONFIDENTIAL");
            }
            else if (settings.isClassificationPublic()) {
              out.println("CLASS:PUBLIC");
            }

            out.println("PRIORITY:3");

            String category = settings.getCategory().trim();
            if (category.length() > 0) {
              out.println("CATEGORIES:" + category);
            }

            c = CalendarToolbox.getStartAsCalendar(p);

            out.println("UID:" + mDate.format(c.getTime()) + "-" + p.getID());

            String summary = parser.analyse(formatting.getTitleValue(), p);

            out.println("SUMMARY:" + CalendarToolbox.noBreaks(summary));

            out.println("DTSTART:" + mDate.format(c.getTime()) + "T"
                + mTime.format(c.getTime()) + "Z");

            String desc = parser.analyse(formatting.getContentValue(), p);
            if (parser.showErrors()) {
              return;
            }
            out.println("DESCRIPTION:" + CalendarToolbox.noBreaks(desc));

            if (!nulltime) {
              c = CalendarToolbox.getEndAsCalendar(p);
            }

            if (settings.isShowBusy()) {
              out.println("TRANSP:" + opaque());
            }
            else if (settings.isShowFree()) {
              out.println("TRANSP:" + transparent());
            }

            out.println("DTEND:" + mDate.format(c.getTime()) + "T"
                + mTime.format(c.getTime()) + "Z");

            if (settings.getUseAlarm()) {
              printAlarm(settings.getAlarmMinutes(), out, c);
            }
View Full Code Here

      DreamboxChannel channel = config.getDreamboxChannelForRef(timer.get("e2servicereference"));

      if (channel != null) {
        Channel tvbchannel = config.getChannel(channel);
        if (tvbchannel != null) {
          Calendar begin = Calendar.getInstance();
          begin.setTimeInMillis(getLong(timer.get("e2timebegin")) * 1000);
          int beginMinutes = begin.get(Calendar.HOUR_OF_DAY) * 60 + begin.get(Calendar.MINUTE);

          Calendar end = Calendar.getInstance();
          end.setTimeInMillis(getLong(timer.get("e2timeend")) * 1000);

          int endMinutes = end.get(Calendar.HOUR_OF_DAY) * 60 + end.get(Calendar.MINUTE);
          if (endMinutes < beginMinutes) {
            endMinutes += 24 * 60;
          }

          Calendar runner = (Calendar) begin.clone();

          long days = end.get(Calendar.DAY_OF_YEAR) - begin.get(Calendar.DAY_OF_YEAR);
          if (end.get(Calendar.YEAR) != begin.get(Calendar.YEAR)) {
            days = 1;
          }

          for (int i = 0; i <= days; i++) {
            Iterator<Program> it = Plugin.getPluginManager().getChannelDayProgram(new Date(runner), tvbchannel);
            boolean found = false;

            while (it.hasNext() && !found) {
              Program prog = it.next();
              int progTime = prog.getHours() * 60 + prog.getMinutes() + (i * 24 * 60);

              if (progTime >= beginMinutes - 15 && progTime <= endMinutes + 15
                  && prog.getTitle().trim().equalsIgnoreCase(timer.get("e2name").trim())) {

                found = true;
                programs.add(new ProgramTime(prog, begin.getTime(), end.getTime()));
              }
            }

            runner.add(Calendar.HOUR_OF_DAY, 24);
          }

        }
      }
    }
View Full Code Here

  public boolean addRecording(DreamboxChannel dreamboxChannel, ProgramTime prgTime, int afterEvent, TimeZone timezone) {
    if (!mConfig.hasValidAddress()) {
      return false;
    }
    try {
      Calendar start = prgTime.getStartAsCalendar();
      start.setTimeZone(timezone);

      Calendar end = prgTime.getEndAsCalendar();
      end.setTimeZone(timezone);

      String shortInfo = prgTime.getProgram().getShortInfo();
      if (shortInfo == null) {
        shortInfo = "";
      }

      InputStream stream = openStreamForLocalUrl("/web/tvbrowser?&command=add&action=0" + "&syear="
          + start.get(Calendar.YEAR) + "&smonth=" + (start.get(Calendar.MONTH) + 1) + "&sday="
          + start.get(Calendar.DAY_OF_MONTH) + "&shour=" + start.get(Calendar.HOUR_OF_DAY) + "&smin="
          + start.get(Calendar.MINUTE) +

          "&eyear=" + end.get(Calendar.YEAR) + "&emonth=" + (end.get(Calendar.MONTH) + 1) + "&eday="
          + end.get(Calendar.DAY_OF_MONTH) + "&ehour=" + end.get(Calendar.HOUR_OF_DAY) + "&emin="
          + end.get(Calendar.MINUTE) +

          "&sRef=" + URLEncoder.encode(dreamboxChannel.getName() + "|" + dreamboxChannel.getReference(), "UTF8")
          + "&name=" + URLEncoder.encode(prgTime.getProgram().getTitle(), "UTF8") + "&description="
          + URLEncoder.encode(shortInfo, "UTF8") +
View Full Code Here

  public boolean removeRecording(DreamboxChannel dreamboxChannel, ProgramTime prgTime, TimeZone timezone) {
    if (!mConfig.hasValidAddress()) {
      return false;
    }
    try {
      Calendar start = prgTime.getStartAsCalendar();
      start.setTimeZone(timezone);

      Calendar end = prgTime.getEndAsCalendar();
      end.setTimeZone(timezone);

      String shortInfo = prgTime.getProgram().getShortInfo();
      if (shortInfo == null) {
        shortInfo = "";
      }

      InputStream stream = openStreamForLocalUrl("/web/tvbrowser?&command=del&action=0" + "&syear="
          + start.get(Calendar.YEAR) + "&smonth=" + (start.get(Calendar.MONTH) + 1) + "&sday="
          + start.get(Calendar.DAY_OF_MONTH) + "&shour=" + start.get(Calendar.HOUR_OF_DAY) + "&smin="
          + start.get(Calendar.MINUTE) +

          "&eyear=" + end.get(Calendar.YEAR) + "&emonth=" + (end.get(Calendar.MONTH) + 1) + "&eday="
          + end.get(Calendar.DAY_OF_MONTH) + "&ehour=" + end.get(Calendar.HOUR_OF_DAY) + "&emin="
          + end.get(Calendar.MINUTE) +

          "&sRef=" + URLEncoder.encode(dreamboxChannel.getName() + "|" + dreamboxChannel.getReference(), "UTF8")
          + "&name=" + URLEncoder.encode(prgTime.getProgram().getTitle(), "UTF8") + "&description="
          + URLEncoder.encode(shortInfo, "UTF8") +
View Full Code Here

   *
   * @param p Program
   * @return Start-Time
   */
  public static Calendar getStartAsCalendar(Program p) {
    Calendar cal = p.getDate().getCalendar();

    int min = p.getStartTime();

    int hour = min % 60;

    min -= hour * 60;

    cal.set(Calendar.HOUR_OF_DAY, hour);
    cal.set(Calendar.MINUTE, min);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);

    return cal;
  }
View Full Code Here

   *
   * @param p Program
   * @return End-Time
   */
  public static Calendar getEndAsCalendar(Program p) {
    Calendar cal = getStartAsCalendar(p);

    int leng = p.getLength();

    if (leng <= 0) {
      leng = 0;
    }

    cal.add(Calendar.MINUTE, leng);

    return cal;
  }
View Full Code Here

TOP

Related Classes of java.util.Calendar

Copyright © 2015 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.