Package java.text

Examples of java.text.Collator$CollatorGetter


     */
    public void sortForeignKeys(final boolean caseSensitive)
    {
        if (!_foreignKeys.isEmpty())
        {
            final Collator collator = Collator.getInstance();
   
            Collections.sort(_foreignKeys, new Comparator() {
                public int compare(Object obj1, Object obj2)
                {
                    String fk1Name = ((ForeignKey)obj1).getName();
                    String fk2Name = ((ForeignKey)obj2).getName();

                    if (!caseSensitive)
                    {
                        fk1Name = (fk1Name != null ? fk1Name.toLowerCase() : null);
                        fk2Name = (fk2Name != null ? fk2Name.toLowerCase() : null);
                    }
                    return collator.compare(fk1Name, fk2Name);
                }
            });
        }
    }
View Full Code Here


                {
                    tables.add(table);
                }
            }

            final Collator collator = Collator.getInstance();
           
            Collections.sort(tables, new Comparator() {
                public int compare(Object obj1, Object obj2)
                {
                    return collator.compare(((Table)obj1).getName().toUpperCase(), ((Table)obj2).getName().toUpperCase());
                }
            });
            return tables;
        }
        finally
View Full Code Here

            m_sorter = new PageSorter( HumanComparator.DEFAULT_HUMAN_COMPARATOR );
        }
        else
            try
            {
                Collator collator = new RuleBasedCollator( order );
                collator.setStrength( Collator.PRIMARY );
                m_sorter = new PageSorter( new CollatorComparator( collator ) );
            }
            catch( ParseException pe )
            {
                log.info( "Failed to parse requested collator - using default ordering", pe );
View Full Code Here

    if (twoVal == null)
    {
      returnValue = 1;
    }

    Collator c = Collator.getInstance();

    returnValue = c.compare(oneVal.toString(), twoVal.toString());

    return returnValue;
  }
View Full Code Here

     * @return the result of the comparison
     * @see java.util.Comparator#compare(Object, Object)
     */
    public int compare( Principal o1, Principal o2 )
    {
        Collator collator = Collator.getInstance();
        return collator.compare( o1.getName(), o2.getName() );
    }
View Full Code Here

   
  }

    private Collator retrieveCollator() {
        Status status = (Status) getStatus();
        Collator collator;
        if (status.contentLanguage != null && status.contentLanguage != ResultSetTagStatus.MULTILANGUAGE_RESULT) {
            collator = Collator.getInstance(getCore().languageCodeToLocale(status.contentLanguage));
        }
        else {
            collator = Collator.getInstance(getTMLContext().getPreferredLanguageLocale());
View Full Code Here

     *         prevent them from being compared by this Comparator.
     */
    @SuppressWarnings("unchecked")
  public int compare(Object o1, Object o2) {
        int retval = 0;
        Collator collator = Collator.getInstance(this.locale);

        for (PropertyExpression expression : this.expressions) {
            PropertyExpressionEvaluation e1 = new PropertyExpressionEvaluation(expression, o1);
            PropertyExpressionEvaluation e2 = new PropertyExpressionEvaluation(expression, o2);

            Object prop1 = e1.getValue();
            Object prop2 = e2.getValue();

            if (prop1 == null && prop2 == null) {
                retval = 0;
            }
            else if (prop1 == null) {
                retval = 1;
            }
            else if (prop2 == null) {
                retval = -1;
            }
            else if ( !(prop1 instanceof String) && prop1 instanceof Comparable) {
                retval = ((Comparable) prop1).compareTo(prop2);
            }
            else {
                String string1 = prop1.toString();
                String string2 = prop2.toString();
                retval = collator.compare(string1, string2);
            }

            if (retval != 0) break;
        }

View Full Code Here

      {
        locale = _getLocale(reqCtx, facesContext);
      }
    }

    Collator collator = locale == null ? Collator.getInstance() : Collator.getInstance(locale);
    if (collatorDecomposition != null)
    {
      collator.setDecomposition(collatorDecomposition.getIntValue());
    }

    if (collatorStrength != null)
    {
      collator.setStrength(collatorStrength.getIntValue());
    }

    setComparator(propertyName, collator);
  }
View Full Code Here

        return null;
    }

    public int compare( String content, String facetValue ){
        Locale    loc       = Locale.getDefault();
        Collator  collator  = Collator.getInstance( loc );
        return collator.compare( content, facetValue );
    }
View Full Code Here

      }

   }
   public int compare( String content, String facetValue ){
      Locale    loc       = Locale.getDefault();
      Collator  collator  = Collator.getInstance( loc );
      return collator.compare( content, facetValue );
   }
View Full Code Here

TOP

Related Classes of java.text.Collator$CollatorGetter

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.