Package java.text

Examples of java.text.FieldPosition


        StringBuffer bb = new StringBuffer();
        SimpleDateFormat s =  new SimpleDateFormat(this.getQueuePattern());
       
        if (!path.endsWith("/") && !path.endsWith("\\") ) path += "/";
       
        FieldPosition fp = new FieldPosition(0);
        StringBuffer b =  s.format(d, bb, fp);
        String lastGeneratedFilename = path + this.getQueuePrefix() + b + ".email";

        File f = new File(lastGeneratedFilename);
        while (f.exists()){
View Full Code Here


    EmailMsg result = null;
    String updStr = null;

    try {
      StringBuffer dateStr = new StringBuffer();
      FieldPosition pos = new FieldPosition(0);
      this.dateFmt.format( new java.util.Date(), dateStr, pos );

      int emailId = this.getNextId( "email" );

      updStr =
View Full Code Here

  commit( EmailMsg msg )
    throws DBIException
    {
    try {
      StringBuffer dateStr = new StringBuffer();
      FieldPosition pos = new FieldPosition(0);
      this.dateFmt.format( new java.util.Date(), dateStr, pos );

      StringBuffer buf = new StringBuffer();

      if ( msg.isInDatabase() )
View Full Code Here

    cW.println( "</table>" );

    cW.println( "<p>" );

    StringBuffer openDateStr = new StringBuffer();
    FieldPosition openPos = new FieldPosition(0);
    this.dateFmt.format( bug.getOpenDate(), openDateStr, openPos );

    cW.println( "<strong>Date Opened:</strong>" );
    cW.println( openDateStr.toString() );
    cW.println( "<br>" );

    StringBuffer closeDateStr = new StringBuffer();
    if ( bug.getCloseDate() == null )
      {
      closeDateStr.append( "Not closed." );
      }
    else
      {
      FieldPosition closePos = new FieldPosition(0);
      this.dateFmt.format( bug.getCloseDate(), closeDateStr, closePos );
      }

    cW.println( "<strong>Date Closed:</strong>" );
    cW.println( closeDateStr.toString() );
View Full Code Here

    cW.println( "<strong>Submitter:</strong>" );
    cW.println( this.dbConfig.formatPerson( rep.getSubmitter() ) );
    cW.println( "<br>" );

    StringBuffer dateStr = new StringBuffer();
    FieldPosition pos = new FieldPosition(0);
    this.dateFmt.format( rep.getSubmitted(), dateStr, pos );

    cW.println( "<strong>Date Submitted:</strong>" );
    cW.println( dateStr.toString() );
    cW.println( "<br>" );
View Full Code Here

      }
    cW.print  ( ",&nbsp; &nbsp;" );

    StringBuffer dBuf = new StringBuffer();
    this.dateFmt.format
      ( action.getActionTime(), dBuf, new FieldPosition(0) );

    cW.println( dBuf );
    cW.println( "<br>" );

    cW.println( "<blockquote>" );
View Full Code Here

                    break;
                case JExifTag.EXIFTAG_TAG_CHANGEDATETIME:
                    if ((date = JIfdData.getDateFromString(data.getChangeDateTime())) != null)
                    {
                        strBuf = new StringBuffer();
                        Main.m_shortDayOfWeekFormat.format(date, strBuf, new FieldPosition(0));
                        obj = strBuf + ", " + DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(date);
                    }
                    else obj = "";
                    break;
                case JExifTag.EXIFTAG_TAG_ARTIST:
                    obj = data.getArtist();
                    break;
                case JExifTag.EXIFTAG_TAG_DESCRIPTION:
                    obj = data.getDescription();
                    break;
                case JExifTag.EXIFTAG_TAG_YCBCRPOSITION:
                    obj = Main.getString(String.format("data_ycbcrposition_0x%1$04X", data.getYCbCrPosition()));
                    break;
                case JExifTag.EXIFTAG_TAG_COPYRIGHT:
                    obj = data.getCopyright();
                    break;
                case JExifTag.EXIFTAG_TAG_EXPOSURETIME:
                    data.getExposureTime(str);
                    obj = str[0];
                    break;
                case JExifTag.EXIFTAG_TAG_FNUMBER:
                    data.getFNumber(str);
                    obj = str[0];
                    break;
                case JExifTag.EXIFTAG_TAG_EXPOSUREPROGRAM:
                    try
                    {
                        obj = Main.getString(String.format("data_exposureprogram_0x%1$04X", data.getExposureProgram()));
                    }
                    catch(MissingResourceException ex)
                    {
                        obj = Main.getString("data_exposureprogram_reserved");
                    }
                    break;
                case JExifTag.EXIFTAG_TAG_ISOSPEEDRATINGS:
                    obj = data.getISOSpeedRatings();
                    break;
                case JExifTag.EXIFTAG_TAG_EXIFVERSION:
                    obj = data.getExifVersion();
                    break;
                case JExifTag.EXIFTAG_TAG_ORIGINALDATETIME:
                    if ((date = JIfdData.getDateFromString(data.getOriginalDateTime())) != null)
                    {
                        strBuf = new StringBuffer();
                        Main.m_shortDayOfWeekFormat.format(date, strBuf, new FieldPosition(0));
                        obj = strBuf + ", " + DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(date);
                    }
                    else obj = "";
                    break;
                case JExifTag.EXIFTAG_TAG_DIGITIZEDDATETIME:
                    if ((date = JIfdData.getDateFromString(data.getDigitizedDateTime())) != null)
                    {
                        strBuf = new StringBuffer();
                        Main.m_shortDayOfWeekFormat.format(date, strBuf, new FieldPosition(0));
                        obj = strBuf + ", " + DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(date);
                    }
                    else obj = "";
                    break;
                case JExifTag.EXIFTAG_TAG_COMPONENTSCCONFIG:
                    obj = data.getComponentsConfig();
                    break;
                case JExifTag.EXIFTAG_TAG_COMPRESSEDPITSPERPIXEL:
                    obj = data.getCompressedBitsPerPixel();
                    break;
                case JExifTag.EXIFTAG_TAG_SHUTERSPEEDVALUE:
                    obj = data.getShuterSpeedValue();
                    break;
                case JExifTag.EXIFTAG_TAG_APERTUREVALUE:
                    obj = data.getApertureValue();
                    break;
                case JExifTag.EXIFTAG_TAG_BRIGHTNESSVALUE:
                    obj = data.getBrightnessValue();
                    break;
                case JExifTag.EXIFTAG_TAG_EXPOSUREBIASVALUE:
                    obj = data.getExposureBiasValue();
                    break;
                case JExifTag.EXIFTAG_TAG_MAXAPERTUREVALUE:
                    obj = data.getMaxApertureValue();
                    break;
                case JExifTag.EXIFTAG_TAG_METERINGMODE:
                    try
                    {
                        obj = Main.getString(String.format("data_meteringmode_0x%1$04X", data.getMeteringMode()));
                    }
                    catch(MissingResourceException ex)
                    {
                        obj = Main.getString("data_meteringmode_reserved");
                    }
                    break;
                case JExifTag.EXIFTAG_TAG_LIGHTSOURCE:
                    try
                    {
                        obj = Main.getString(String.format("data_lightsource_0x%1$04X", data.getLightSource()));
                    }
                    catch(MissingResourceException ex)
                    {
                        obj = Main.getString("data_lightsource_reserved");
                    }

                    break;
                case JExifTag.EXIFTAG_TAG_FLASH:
                    h = data.getFlash();
                    if ((h & 0x01) != 0)
                    {
                        str[0] = Main.getString(String.format("data_flash_yes"));
                        if (((h & 0x06) >> 1) == 0x02)
                            str[0] += ", " + Main.getString("data_flash_strobereturnnotdetected");
                        else if (((h & 0x06) >> 1) == 0x03)
                            str[0] += ", " + Main.getString("data_flash_strobereturndetected");

                        if (((h & 0x18) >> 3) == 0)
                            str[0] += ", " + Main.getString("data_flash_modeunknown");
                        else if (((h & 0x18) >> 3) == 0x01)
                            str[0] += ", " + Main.getString("data_flash_modecompulsory");
                        else if (((h & 0x18) >> 3) == 0x03)
                            str[0] += ", " + Main.getString("data_flash_modeauto");

                        if ((h & 0x40) != 0)
                            str[0] += ", " + Main.getString("data_flash_moderedeyereduction");
                    }
                    else
                    {
                        if ((h & 0x20) != 0)
                        {
                            str[0] = Main.getString(String.format("data_flash_notavailable"));
                        }
                        else
                        {
                            str[0] = Main.getString(String.format("data_flash_no"));
                            if (((h & 0x18) >> 3) == 0x01)
                            str[0] += ", " + Main.getString("data_flash_modecompulsorysuppression");
                        }
                    }
                    obj = str[0];
                    break;
                case JExifTag.EXIFTAG_TAG_FOCALLENGTH:
                    obj = data.getFocalLength();
                    break;
                case JExifTag.EXIFTAG_TAG_COLORSPACE:
                    obj = Main.getString(String.format("data_colorspace_0x%1$04X", data.getColorSpace()));
                    break;
                case JExifTag.EXIFTAG_TAG_SIZE:
                    obj = String.format("%1$dx%2$d", data.getPixelXDimension(), data.getPixelYDimension());
                    break;
                case JExifTag.EXIFTAG_TAG_FOCALPLANERESOLUTION:
                    obj = String.format("%1$.1f/%3$s x %2$.1f/%3$s", data.getFocalPlaneXResolution(), data.getFocalPlaneYResolution(), Main.getString(String.format("data_unit_0x%1$04X", data.getFocalPlaneResolutionUnit())));
                    break;
                case JExifTag.EXIFTAG_TAG_SENSINGMODE:
                    obj = Main.getString(String.format("data_sensingmode_0x%1$04X", data.getSensingMode()));
                    break;
                case JExifTag.EXIFTAG_TAG_CUSTOMRENDERED:
                    obj = Main.getString(String.format("data_customrendered_0x%1$04X", data.getCustomRendered()));
                    break;
                case JExifTag.EXIFTAG_TAG_EXPOSUREMODE:
                    obj = Main.getString(String.format("data_exposuremode_0x%1$04X", data.getExposureMode()));
                    break;
                case JExifTag.EXIFTAG_TAG_WHITEBALANCE:
                    obj = Main.getString(String.format("data_whitebalance_0x%1$04X", data.getWhiteBalance()));
                    break;
                case JExifTag.EXIFTAG_TAG_DIGITALZOOMRATIO:
                    obj = data.getDigitalZoomRatio();
                    break;
                case JExifTag.EXIFTAG_TAG_FOCALLENGTH35MM:
                    obj = data.getFocalLength35mm();
                    break;
                case JExifTag.EXIFTAG_TAG_SCENECAPTURETYPE:
                    obj = Main.getString(String.format("data_scenecapturetype_0x%1$04X", data.getSceneCaptureType()));
                    break;
                case JExifTag.EXIFTAG_TAG_SCENETYPE:
                    obj = Main.getString(String.format("data_scenetype_0x%1$04X", data.getSceneType()));
                    break;
                case JExifTag.EXIFTAG_TAG_GAINCONTROL:
                    obj = Main.getString(String.format("data_gaincontrol_0x%1$04X", data.getGainControl()));
                    break;
                case JExifTag.EXIFTAG_TAG_CONTRAST:
                    obj = Main.getString(String.format("data_contrast_0x%1$04X", data.getContrast()));
                    break;
                case JExifTag.EXIFTAG_TAG_SATURATION:
                    obj = Main.getString(String.format("data_saturation_0x%1$04X", data.getSaturation()));
                    break;
                case JExifTag.EXIFTAG_TAG_SHARPNESS:
                    obj = Main.getString(String.format("data_sharpness_0x%1$04X", data.getSharpness()));
                    break;
                case JExifTag.EXIFTAG_TAG_SUBJECTDISTANCERANGE:
                    obj = Main.getString(String.format("data_subjectdistancerange_0x%1$04X", data.getSubjectDistanceRange()));
                    break;
                case JExifTag.EXIFTAG_TAG_FILESIZE:
                    StringBuilder strBuilder = new StringBuilder();
                    if (data.getFileSize() < 1024)
                    strBuilder.append(Long.toString(data.getFileSize()));
                    else if (data.getFileSize() < 1024*1024)
                    {
                        strBuilder.append(String.format("%1$.1f ", (float)data.getFileSize()/1024.0f));
                        strBuilder.append(Main.getString("KByte"));
                    }
                    else if (data.getFileSize() < 1024*1024*1024)
                    {
                        strBuilder.append(String.format("%1$.2f ", (float)data.getFileSize()/(1024.0f*1024.0f)));
                        strBuilder.append(Main.getString("MByte"));
                    }
                    obj = strBuilder.toString();
                    break;
                case JExifTag.EXIFTAG_TAG_FILEDATETIME:
                    if ((date = data.getFileDate()) != null)
                    {
                        strBuf = new StringBuffer();
                        Main.m_shortDayOfWeekFormat.format(date, strBuf, new FieldPosition(0));
                        obj = strBuf + ", " + DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(date);
                    }
                    else obj = "";
                    break;
                case JExifTag.EXIFTAG_TAG_FILESOURCE:
                    obj = Main.getString(String.format("data_filesource_0x%1$04X", data.getFileSource()));
                    break;
                // GPS stuff
                case JExifTag.GPSTAG_TAG_VERSIONID:
                    obj = data.getGPSVersionID();
                    break;
                case JExifTag.GPSTAG_TAG_LATITUDE:
                    obj = String.format("%.6f° %s", data.getGPSLatitude(), Main.getString(String.format("data_gps_latituderef_%s", data.getGPSLatitudeRef())));
                    break;
                case JExifTag.GPSTAG_TAG_LONGITUDE:
                    obj = String.format("%.6f° %s", data.getGPSLongitude(), Main.getString(String.format("data_gps_longituderef_%s", data.getGPSLongitudeRef())));
                    break;
                case JExifTag.GPSTAG_TAG_ALTITUDE:
                    int ref = data.getGPSAltitudeRef();
                    if (ref>=0)
                        ref = ref != 0 ? -1 : 1;
                    else throw new MissingResourceException(null, null, null);
                    float f = data.getGPSAltitude();
                    if (Float.isNaN(f))
                        throw new MissingResourceException(null, null, null);
                    else
                        obj = String.format("%.1f m", ref*f, Main.getString("data_gps_altitude_unit"));
                    break;
                case JExifTag.GPSTAG_TAG_TIMESTAMP:
                    strBuf = new StringBuffer();
                    date = data.getGPSTimestamp();
                    if (date != null)
                    {
                        Main.m_shortDayOfWeekFormat.format(date, strBuf, new FieldPosition(0));
                        obj = strBuf + ", " + DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(date);
                    }
                    else obj = null;
                case JExifTag.GPSTAG_TAG_SATELLITES:
                    obj = data.getGPSSatellites();
View Full Code Here

                                    Date date = JIfdData.getDateFromString(data.getDigitizedDateTime());
                                    if (date == null)
                                        date = data.getFileDate();
                                    SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
                                    StringBuffer strBuf = new StringBuffer();
                                    sdf.format(date, strBuf, new FieldPosition(0));
                                    String strDate = strBuf + ", " + DateFormat.getDateInstance(DateFormat.LONG).format(date);
                                    String strTime = DateFormat.getTimeInstance(DateFormat.MEDIUM).format(date);
                                    String fileName = data.getFullFileName();
                                    title = String.format(Main.getString("data_gps_title"), fileName, strDate, strTime);
                                    String laStr = JExifDataModel.getTagValue(data, JExifTag.GPSTAG_TAG_LATITUDE).toString();
View Full Code Here

            Date date = JIfdData.getDateFromString(str);
            if (date == null)
                date = data.getFileDate();
            SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
            StringBuffer strBuf = new StringBuffer();
            sdf.format(date, strBuf, new FieldPosition(0));
            String strDate = strBuf + ", " + DateFormat.getDateInstance(DateFormat.LONG).format(date);
            String strTime = DateFormat.getTimeInstance(DateFormat.MEDIUM).format(date);
            String dirStr = "";
            if (m_slideshowTimer.isRunning())
            {
View Full Code Here

      if ((2 < formatting.length())
        && (formatting.charAt(1) == '.')
        && Character.isDigit(formatting.charAt(2))) {
        numberFormat.setMaximumFractionDigits(
          Integer.parseInt(formatting.charAt(2) + ""));
        numberFormat.format(number, outputTo, new FieldPosition(0));
        return 3;
      }
      numberFormat.format(number, outputTo, new FieldPosition(0));
      return 1;
    } else if (
      (0 < formatting.length()) && (formatting.charAt(0) == '.')) {
      if ((1 < formatting.length())
        && Character.isDigit(formatting.charAt(1))) {
        numberFormat.setMaximumFractionDigits(
          Integer.parseInt(formatting.charAt(1) + ""));
        numberFormat.format(number, outputTo, new FieldPosition(0));
        return 2;
      }
    }
    numberFormat.format(number, outputTo, new FieldPosition(0));
    return 1;
  }
View Full Code Here

TOP

Related Classes of java.text.FieldPosition

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.