Package java.util

Examples of java.util.TreeMap$ComparatorBoundedIterator


   * @param   recordType  Record Type
   * @return
   */
  public static TreeMap getCustomField(String recordType, String dataSource)
  {
    TreeMap hmap = null;
    try
    {
      CustomFieldHome cfh = (CustomFieldHome)
        CVUtility.getHomeObject("com.centraview.customfield.CustomFieldHome", "CustomField");
      CustomField remote = (CustomField) cfh.create();
View Full Code Here


   * @param   recordType  Record Type
   * @return
   */
  public static TreeMap getCustomField(String recordType, int recordID, String dataSource)
  {
    TreeMap hmap = null;
    try
    {
      CustomFieldHome cfh = (CustomFieldHome)
        CVUtility.getHomeObject("com.centraview.customfield.CustomFieldHome", "CustomField");
      CustomField remote = (CustomField) cfh.create();
View Full Code Here

      } else { // if(profileId != 0) if it does equal Zero we are trying to do a New.
        // So get a blank one with full rights.  Let the user take some away.
        mfrm = authEJB.getBlankFieldRightMatrix(ModuleFieldRightMatrix.DELETE_RIGHT);
        this.populateFormBean(mfrm, securityProfileBean);
      }
      TreeMap moduleRightsTreeMap = mfrm.getModuleRights();
      HashMap fieldRightMap = mfrm.getFieldRightsMap();
      String dynamicHTML = generatePageHTML(moduleRightsTreeMap, fieldRightMap);

      request.setAttribute("dynamicHTML", dynamicHTML);
      request.setAttribute("dyna", securityProfileBean);
View Full Code Here

          securityProfileBean.set(formBeanKey, String.valueOf(fieldRights));
        }
      }
    }
   
    TreeMap moduleRightsTreeMap = mfrm.getModuleRights();
    Set moduleIDs = moduleRightsTreeMap.keySet();
    Iterator moduleIterator = moduleIDs.iterator();
   
    Vector moduleRightsVector = new Vector();
    while (moduleIterator.hasNext()) {
      Number moduleID = (Number)moduleIterator.next();
      HashMap moduleRightsHashMap = (HashMap)moduleRightsTreeMap.get(moduleID);
      String moduleName = (String)moduleRightsHashMap.get("name");
      moduleRightsVector.add(moduleName);
    }
    String[] moduleRightsArray = new String[moduleRightsVector.size()];
    moduleRightsVector.toArray(moduleRightsArray);
View Full Code Here

      int moduleID = permissionForm.getModuleID();
      String dbModuleName = new String("");

      if (moduleID != 0) {
        TreeMap mrights = rightsMatrix.getModuleRights();
        HashMap mything = (HashMap)mrights.get(new Integer(moduleID));
        dbModuleName = (String)mything.get("name");
      }

      if (((modulename == null) || modulename.equals("")) && (!dbModuleName.equals(""))) {
        modulename = dbModuleName;
View Full Code Here

   * ascending or descending.
   */
  public DisplayList Sort(DisplayList targetList, DisplayList sourceList)
  {
    char sortType = targetList.getSortType();
    TreeMap intermediate = null;
    if (sortType == 'D') {
      Comparator reverse = Collections.reverseOrder();
      intermediate = new TreeMap(reverse);
    } else {
      intermediate = new TreeMap();
    }
    String sortMember = (String)targetList.getSortMember();
    Set c = sourceList.keySet();
    Iterator it = c.iterator();
    while (it.hasNext()) {
      String key = (String)it.next();
      ListElement element = (ListElement)sourceList.get(key);
      int id = element.getElementID();
      ListElementMember elementMember = (ListElementMember)element.get(sortMember);
      String keyPart = (String)elementMember.getSortString();
      if (keyPart == null || keyPart.equals("null")) {
        keyPart = "";
      }
      String newkey = keyPart + id;
      intermediate.put(newkey, element);
    }
    targetList.clear();
    // if descending we need to recreate keys that match the targetList
    // comparator. Otherwise the Keys made above will work for ascending
    if (sortType == 'D') {
      Collection sortedElements = intermediate.values();
      Iterator iterator = sortedElements.iterator();
      long i = 0;
      while (iterator.hasNext()) {
        Object Element = iterator.next();
        String key = CVUtility.leftZeroPad(i++, 10);
View Full Code Here

    Vector calactivityVector = null;
    Vector unscheduledactivity = null;
    Vector scheduledactivitydaily = null;
    HashMap unsheduledMap = new HashMap();
    HashMap scheduledMap = new HashMap();
    TreeMap allDayMap = new TreeMap();
 
    try {
      CvCalendarHome cvCalendarHome = (CvCalendarHome)CVUtility.getHomeObject(
          "com.centraview.calendar.CvCalendarHome", "CvCalendar");
      CvCalendar cvCalendar = cvCalendarHome.create();
      cvCalendar.setDataSource(dataSource);
 
      HashMap cvCalendarMap = cvCalendar.getAllCalendar(userID, userID, starttimeuser, endTimeuser,
          search);
      calactivityVector = (Vector)cvCalendarMap.get("scheduleactivityvector");
      unscheduledactivity = (Vector)cvCalendarMap.get("unscheduleactivityvector");
      scheduledactivitydaily = (Vector)cvCalendarMap.get("scheduleactivityvectordaily");
    } catch (Exception e) {
      logger.error("[Exception][CalendarValueList.getCalendarList] Exception Thrown: ", e);
    }
 
    CalendarList calendarlist = new CalendarList();
    int totalnumberofrows = 0;
 
    long timeInMillisStart = starttimeuser.getTimeInMillis();
    long timeInMillisEnd = endTimeuser.getTimeInMillis();
 
    // We must have to do the ZoneOffSet and DayLight Saving to Offset.
    // off zone time values we must have to add to TimeInMillis
    double differenceTimeInMills = ((timeInMillisEnd + endTimeuser.get(Calendar.ZONE_OFFSET) + endTimeuser
        .get(Calendar.DST_OFFSET)) - (timeInMillisStart + starttimeuser.get(Calendar.ZONE_OFFSET) + starttimeuser
        .get(Calendar.DST_OFFSET)));
 
    // noOfDiff is the number of timespan (in minutes) length blocks
    // that make up the entire endtime-starttime.
    // daily view will be one of: 1440/60 = 24, 1440/30 = 48, 1440/15 = 96
    // weekly (columnar) will be: 10080/60 = 168 (24 rows * 7columns)
    // weekly (non-columnar) will be: 10080/1440 = 7 (7 days)
    // monthly will be between: 40320/1440 = 28 and 44640/1440 = 31
    // 1440 is the number of minutes in one day. (24*60 = 1440)
    // actually it appears that timespan is minutes per HTML block.
    // 60000 is used for getting the number of milliseconds per minute out of
    // there.
    // so you can simply divide minutes per block into the time difference.
    double noOfDiff = Math.ceil(differenceTimeInMills / (timespan * 60000));
    // The Math.ceil function is unecessary and probably just a holdover from
    // when the
    // original authors couldn't figure out how to use the Gregorian calendar
    // and thus
    // often found themselves with numbers that didn't come out even.
    totalnumberofrows = (int)noOfDiff;
    // The following loop goes through and for each row, inserts
    // a blank CalendarListElement
    // Not sure what this accomplishes.
    long start = 0, end = 0;
    // TDColumn simply is used to represent how many elements in a row
    // on the displayed table. It is really only useful in one of the daily
    // views.
    TreeMap TDColumn = calendarlist.getTDIndicesTreeMap();
    for (int i = 0; i < totalnumberofrows; i++) {
      // Fill it up with a bunch-a-blank'uns.
      start = timeInMillisStart + ((i) * timespan * 60000);
      end = timeInMillisStart + ((i + 1) * timespan * 60000);
      calendarlist.put(new Integer(i), new CalendarListElement(start, end));
      // pre-populate the row to contain zero items.
      TDColumn.put(new Integer(i), new Integer(0));
    }
 
    GregorianCalendar listRenderCalendar = new GregorianCalendar(tz);
    listRenderCalendar.setTime(starttimeuser.getTime());
 
    int counthour = 0;
    for (int i = 0; i < totalnumberofrows; i++) {
      // The Calendar fields will be used to track the current place in
      // the displayed calendar, we will increment through the blocks
      // and compare the activites returned from the list.
      int calendarDate = listRenderCalendar.get(Calendar.DATE);
      int calendarMonth = listRenderCalendar.get(Calendar.MONTH);
      int calendarYear = listRenderCalendar.get(Calendar.YEAR);
      Iterator activityIterator = calactivityVector.iterator();
      int uniqueId = 0;
      while (activityIterator.hasNext()) {
        uniqueId++;
        CalendarActivityObject activityobject = (CalendarActivityObject)activityIterator.next();
        GregorianCalendar starttime = activityobject.getStartTime();
        GregorianCalendar endtime = activityobject.getEndTime();
 
        // If somehow we squeezed an illegally formed activity in we should skip
        // it.
        if ((starttime.getTimeInMillis() > endTimeuser.getTimeInMillis())) {
          continue;
        }
        // calendarStartingBlock is the starting block for an activity on the
        // displayed table.
        int calendarStartingBlock = 0;
        // The critical info on the currently selected activity.
        int activityDate = starttime.get(Calendar.DATE);
        int activityMonth = starttime.get(Calendar.MONTH);
        int activityYear = starttime.get(Calendar.YEAR);
        int activityHour = starttime.get(Calendar.HOUR);
        int activityMinute = starttime.get(Calendar.MINUTE);
        int activityAMPM = starttime.get(Calendar.AM_PM);
        if (activityAMPM == 1) {
          activityHour = activityHour + 12;
        }
        boolean flag = false;
 
        // If the selected activity has the same month, date, and year
        // and we are looking at the Daily View.
        if (activityDate == calendarDate && activityMonth == calendarMonth
            && activityYear == calendarYear
            && (totalnumberofrows == 24 || totalnumberofrows == 48 || totalnumberofrows == 96)) {
          // if it is daily hourly blocks then the starting block is the
          // starting hour
          calendarStartingBlock = (activityHour);
          // otherwise we need calculate the starting block because the number
          // of blocks may
          // have doubled or quadrupled (30 or 15 minute intervals)
          // It needs to be the floor function of the division also.
          if (totalnumberofrows == 48) {
            int diffMinute = (int)Math.floor(activityMinute / 30.0);
            calendarStartingBlock = (calendarStartingBlock * 2) + diffMinute;
          } else if (totalnumberofrows == 96) {
            int diffMinute = (int)Math.floor(activityMinute / 15.0);
            calendarStartingBlock = (calendarStartingBlock * 4) + diffMinute;
          }
          flag = true;
        } else if (activityDate == calendarDate && activityMonth == calendarMonth
            && activityYear == calendarYear) {
          // it is still the same, but we are not one of the daily views.
          flag = true; // no setup required for numberof rows = 28 through 31
                        // ??
 
          calendarStartingBlock = (activityDate - 1);
          if (totalnumberofrows == 168) // if weekly columnar
          {
            calendarStartingBlock = starttime.get(Calendar.DAY_OF_WEEK);
            if (calendarStartingBlock == Calendar.SUNDAY) // if SUNDAY
            {
              calendarStartingBlock = 6; // then move to the end.
            } else {
              // else normalize monday to be zero (coupled to UI)                                                           // normalize
              calendarStartingBlock = calendarStartingBlock - Calendar.MONDAY;
            }
            calendarStartingBlock = (calendarStartingBlock * 24) + (activityHour);
 
            // Display as an allday activity on top
            if (activityobject.getAllDayEvent()) {
              activityobject.setAllDayTime();
              flag = false;
              allDayMap.put(activityobject.getActivityID(), activityobject);
            }
          }
 
          if (totalnumberofrows == 7) {
            // if weekly non-columnar
            calendarStartingBlock = starttime.get(GregorianCalendar.DAY_OF_WEEK);
            if (calendarStartingBlock == Calendar.SUNDAY) // if SUNDAY
            {
              calendarStartingBlock = 6; // then move to the end.
            } else {
              // else normalize monday to be zero (coupled to UI)                                                           // normalize
              calendarStartingBlock = calendarStartingBlock - Calendar.MONDAY;
            }
          }
        }
 
        if (flag) // It matches one of our calendar blocks, we need to display
                  // it
        {
          // Get the blank element we stuck in there before as a placeholder
          CalendarListElement element = (CalendarListElement)calendarlist.get(new Integer(
              calendarStartingBlock));
          // monthly will only use the element at 0 on calendarlist (I guess the
          // rest is designed for that)
          if (element != null) // if the element is null then our
                                // calendarStartingBlock is totally out of
                                // whack.
          {
            int numberOfRows = 1; // assume it only takes one row
            // We probably should take account if the activity spans to a
            // different day.
            // right now this doesn't seem to accomodate that.
            int activityEndHour = endtime.get(Calendar.HOUR);
            int activityEndAMPM = endtime.get(Calendar.AM_PM);
            if (activityEndAMPM == 1) {
              activityEndHour = activityEndHour + 12;
            }
 
            // calculate the number of rows the activity spans, if it is one of
            // the daily views
            // use ceiling function, so that any activity that impinges on the
            // above activity
            // will fill that row also.
            if (totalnumberofrows == 24 || totalnumberofrows == 48 || totalnumberofrows == 96) {
              // We must have to do the ZoneOffSet and DayLight Saving to
              // Offset.
              // off zone time values we must have to add to TimeInMillis
              long startTimeValue = starttime.getTimeInMillis()
                  + starttime.get(Calendar.ZONE_OFFSET) + starttime.get(Calendar.DST_OFFSET);
              long endTimeValue = endtime.getTimeInMillis() + endtime.get(Calendar.ZONE_OFFSET)
                  + endtime.get(Calendar.DST_OFFSET);
 
              double activityDuration = endTimeValue - startTimeValue;
              numberOfRows = (int)Math.ceil(activityDuration / (timespan * 60000));
 
              // When we have Scheduling and activity for two whole day event
              // then our numberOfRows Calculation will return us "48"
              // We can show only 24 hours in the Daily view. so reseting it
              // back to 24.
              if (totalnumberofrows == 24) {
                if (numberOfRows >= 24) {
                  numberOfRows = 24;
                }
              } // end if (totalnumberofrows == 24)
            } // end if (totalnumberofrows == 24 || totalnumberofrows == 48 ||
              // totalnumberofrows == 96)
 
            if (activityobject.getAllDayEvent()) {
              activityobject.setAllDayTime();
            }
 
            CalendarMember calendarItem = new CalendarMember(activityobject, 0, numberOfRows);
            // activity is the key to the element HashMap, it must be unique
            // between returned
            // activities, other wise activities with same start time and name
            // will only show
            // up once on a calendar. So we are using the activityId which must
            // be unique.
            Integer activity = new Integer(uniqueId);
            // at a minimum now this element which exists at the
            // starting row (calendarStartingBlock)
            // has two values, the blank one we prepopulated before.
            // And the one we are adding now
            element.put(activity, calendarItem);
            // we need to increment the rowItem counter for each row that this
            // activity inpinges
            // on. So if the nuOfrows at least 1, then we need to iterate
            // through
            // and increment the counter for it.
            if (numberOfRows >= 1) {
              for (int row = calendarStartingBlock; row < (calendarStartingBlock + numberOfRows); row++) {
                Integer rowInteger = new Integer(row);
                if (TDColumn.get(rowInteger) != null) {
                  int totalRowItems = ((Integer)TDColumn.get(rowInteger)).intValue();
                  totalRowItems++;
                  TDColumn.put(rowInteger, new Integer(totalRowItems));
                }
              }
            }
          } // end if (element != null)
          activityIterator.remove();
View Full Code Here

  private String powerstring;

  public CalendarList()
  {
    maxIndices = new HashMap();
    tdIndices = new TreeMap();
  }
View Full Code Here

      if (clazz.isAssignableFrom(Map.class))
        return new HashMap();
      else if (clazz.isAssignableFrom(ConcurrentMap.class))
        return new ConcurrentHashMap();
      else if (clazz.isAssignableFrom(SortedMap.class))
        return new TreeMap();
      else if (clazz.isAssignableFrom(NavigableMap.class))
        return new TreeMap();
      else if (clazz.isAssignableFrom(ConcurrentNavigableMap.class))
        return new ConcurrentSkipListMap();
      else
        return null;
    } else {
View Full Code Here

            }
        }
    }
   
    private CascadedStyle(CascadedStyle startingPoint, Iterator props) {
        cascadedProperties = new TreeMap(startingPoint.cascadedProperties);
       
        addProperties(props);
    }
View Full Code Here

TOP

Related Classes of java.util.TreeMap$ComparatorBoundedIterator

Copyright © 2018 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.