Examples of Comparator


Examples of java.util.Comparator

    type.setIdentifier(UIConstants.SEARCH_FILE_TYPE_COLUMN_ID);
    type.setModelIndex(SearchResultTableModel.TYPE);
    type.setVisible(_pref.isColumnVisible(UIConstants.SEARCH_FILE_TYPE_COLUMN_ID));
    type.setHeaderValue(_._("mainwindow.searchtab.column.filetype"));
    type.setCellRenderer(new TypeTableCellRenderer());
    type.setComparator(new Comparator() {
      public int compare(Object o1, Object o2) {
        String file_type1 = FileFormatter.formatMimeType(((SearchResultItem)o1).getMimeType());
        String file_type2 = FileFormatter.formatMimeType(((SearchResultItem)o2).getMimeType());
        return Misc.compareAllObjects(file_type1, file_type2, "toString", true);
      }     
View Full Code Here

Examples of java.util.Comparator

    upload_speed.setIdentifier(UIConstants.DOWNLOAD_LIST_UPLOAD_SPEED_COLUMN_ID);
    upload_speed.setModelIndex(DownloadTableModel.UPLOAD_SPEED);
    upload_speed.setVisible(_pref.isColumnVisible(UIConstants.DOWNLOAD_LIST_UPLOAD_SPEED_COLUMN_ID));
    upload_speed.setHeaderValue("Up speed");
    upload_speed.setCellRenderer(new UploadSpeedTableCellRenderer());
    upload_speed.setComparator(new Comparator() {
      public int compare(Object o1, Object o2) {
        Float u_speed1 = null;
        Float u_speed2 = null;
        try {
          DownloadSession d_session1 = (DownloadSession)o1;
View Full Code Here

Examples of java.util.Comparator

    file_type.setIdentifier(UIConstants.SHARED_LIST_FILE_TYPE_COLUMN_ID);
    file_type.setModelIndex(SharedFilesTableModel.TYPE);
    file_type.setVisible(_pref.isColumnVisible(UIConstants.SHARED_LIST_FILE_TYPE_COLUMN_ID));
    file_type.setHeaderValue("Type");
    file_type.setCellRenderer(new FileTypeTableCellRenderer());
    file_type.setComparator(new Comparator() {
      public int compare(Object o1, Object o2) {
        String file_type1 = FileFormatter.formatMimeType(((SharedFile)o1).getMimeType());
        String file_type2 = FileFormatter.formatMimeType(((SharedFile)o2).getMimeType());
        return Misc.compareAllObjects(file_type1, file_type2, "toString", true);
      }     
    });
   
    table_columns.add(file_type);
   
    JMTableColumn file_hash = new JMTableColumn();
    file_hash.setIdentifier(UIConstants.SHARED_LIST_FILE_ID_COLUMN_ID);
    file_hash.setModelIndex(SharedFilesTableModel.HASH);
    file_hash.setVisible(_pref.isColumnVisible(UIConstants.SHARED_LIST_FILE_ID_COLUMN_ID));
    file_hash.setHeaderValue("Hash");
    file_hash.setCellRenderer(new FileHashTableCellRenderer());
    file_hash.setComparator(new GeneralComparator("getFileHash"));
   
    table_columns.add(file_hash);
   
    JMTableColumn completed = new JMTableColumn();
    completed.setIdentifier(UIConstants.SHARED_LIST_COMPLETED_COLUMN_ID);
    completed.setModelIndex(SharedFilesTableModel.COMPLETED);
    completed.setVisible(_pref.isColumnVisible(UIConstants.SHARED_LIST_COMPLETED_COLUMN_ID));
    completed.setHeaderValue("Completed");
    completed.setCellRenderer(new CompletedTableCellRenderer());
    completed.setComparator(new GeneralComparator("getPercentCompleted"));
    completed.setComparator(new Comparator() {
      public int compare(Object o1, Object o2) {
        double completed1 = 100;
        double completed2 = 100;
        SharedFile shared_file1 = (SharedFile)o1;
        SharedFile shared_file2 = (SharedFile)o2;
View Full Code Here

Examples of java.util.Comparator

  private BucketDefinition createServiceBucket(JRCrosstabGroup group, byte evaluation) throws JRException
  {
    JRCrosstabBucket bucket = group.getBucket();

    Comparator comparator = null;
    JRExpression comparatorExpression = bucket.getComparatorExpression();
    if (comparatorExpression != null)
    {
      comparator = (Comparator) evaluateExpression(comparatorExpression, evaluation);
    }
View Full Code Here

Examples of java.util.Comparator

   private List sortDelegatesOnServerID(Collection delegates)
   {
      List localDels = new ArrayList(delegates);

      Collections.sort(localDels,
         new Comparator()
         {
            public int compare(Object obj1, Object obj2)
            {
               ClientConnectionFactoryDelegate del1 = (ClientConnectionFactoryDelegate)obj1;
               ClientConnectionFactoryDelegate del2 = (ClientConnectionFactoryDelegate)obj2;
View Full Code Here

Examples of java.util.Comparator

     
      List entries = new ArrayList(deliveries.entrySet());
     
      //Sort them in reverse delivery id order
      Collections.sort(entries,
                       new Comparator()
                       {
                           public int compare(Object obj1, Object obj2)
                           {
                              Map.Entry entry1 = (Map.Entry)obj1;
                              Map.Entry entry2 = (Map.Entry)obj2;
View Full Code Here

Examples of java.util.Comparator

         * @return true if this attribute name is equal to the
         *         specified attribute object
   */
  public boolean equals(Object o) {
      if (o instanceof Name) {
    Comparator c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER;
    return c.compare(name, ((Name)o).name) == 0;
      } else {
    return false;
      }
  }
View Full Code Here

Examples of java.util.Comparator

   public IntegerIndexedColumn(List<Object[]> rows, int colIx, ColumnDisplayDefinition colDef)
   {
      super(rows, colIx, colDef);

      Comparator comparator = new Comparator<Object>()
      {
         @Override
         public int compare(Object ix1, Object ix2)
         {
            if( ix1 instanceof NoIx && ix2 instanceof NoIx)
View Full Code Here

Examples of java.util.Comparator

   public StringIndexedColumn(List<Object[]> rows, int colIx, ColumnDisplayDefinition colDef)
   {
      super(rows, colIx, colDef);

      Comparator comparator = new Comparator<Object>()
      {
         @Override
         public int compare(Object ix1, Object ix2)
         {
            if( ix1 instanceof NoIx && ix2 instanceof NoIx)
View Full Code Here

Examples of java.util.Comparator

   public BooleanIndexedColumn(List<Object[]> rows, int colIx, ColumnDisplayDefinition colDef)
   {
      super(rows, colIx, colDef);

      Comparator comparator = new Comparator<Object>()
      {
         @Override
         public int compare(Object ix1, Object ix2)
         {
            if( ix1 instanceof NoIx && ix2 instanceof NoIx)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.