Package jexifviewer

Source Code of jexifviewer.JSettings

/*
*  JSettings.java
*
*  Created on 14. April 2006, 09:43
*
*  Copyright (C) 14. April 2006  <Reiner>

*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
*/

package jexifviewer;

import java.io.FileOutputStream;
import java.io.IOException;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.RenderingHints;


import java.util.Properties;
import shared.cvshelper.Cvs;

import shared.settings.JSettingsHelper;
import shared.table.JTableColSortData;

/**
*
* @author reiner
*/

@Cvs
(
    header = "$Header: /home/reiner/cvs/Java/JExifViewer/src/jexifviewer/JSettings.java,v 1.10 2010/04/03 07:59:53 reiner Exp $"
)
public final class JSettings extends JSettingsHelper
{
    public static final String SETTINGS_FILE = "jexifviewer.properties";

    private static final String COMMENT = "JExifViewer settings";
    private static final String COLS = "Cols";
    private static final String COLWIDTH = "ColWIDTH";
    private static final String SORTCOL = "SortCol";
    private static final String SORTUP = "SortUp";
    private static final String SORTDEEP = "SortDeep";
    private static final String IMGDISPLAYTIMER = "ImgDisplayTimer";
    private static final String FILLLISTTIMER = "FillListTimer";
    private static final String JPGEXTENSTIONS = "JpgFileExtensions";
    private static final String HOMEDIR = "HomeDir";
    private static final String SIZE_W = "SizeW";
    private static final String SIZE_H = "SizeH";
    private static final String EXTENDEDSTATE = "ExtendedState";
    private static final String LOCATION_X = "Location_x";
    private static final String LOCATION_Y = "Location_y";
    private static final String DISPLAYALLIMAGES = "DisplayAllImages";
    private static final String SAVEIMAGE = "SaveImage";
    private static final String IMGCACHESIZE = "ImgCacheSize";
    private static final String IMGUSEPRELOAD = "ImgUsePreload";
    private static final String VERTRESIZEWEIGHT = "VertResizeWeight";
    private static final String HORRESIZEWEIGHT = "HorResizeWeight";
    private static final String VERTDIVIDERLOCATION = "VertDividerLocationDouble";
    private static final String HORDIVIDERLOCATION = "HorDividerLocationDouble";
    private static final String INTERPOLATION = "Interpolation";
    private static final String ZOOMDELTA = "ZoomDelta";
    private static final String IMGSCROLLDELTA = "ImgScrollDelta";
    private static final String DELCONFIRM = "DelConfirm";
    private static final String OVERWRITECONFIRM = "OverwriteConfirm";
    private static final String COPYDIRECTORY = "CopyDirectory";
    private static final String MOVEDIRECTORY = "MoveDirectory";
    private static final String IMGVIEWBACKCOLOR = "ImgViewBackColor";
    private static final String CALLGCAFTERCACHEOP = "CallGcAfterCacheOp";
    private static final String CALLGCINSETJPG = "CallGcInSetJpg";
    private static final String SLIDESHOWTIMER = "SlideshowTimer";
    private static final String SLIDESHOWLOOP = "SlideshowLoop";
    private static final String SLIDESHOWDIRECTION = "SlideshowDirection";
    private static final String TOOLTIPTAGS = "ToolTipTags";
    private static final String TOOLTIPBOLD = "ToolTipBold";
    private static final String TOOLTIPTABLE = "ToolTipTable";
    private static final String TOOLTIPDISMISSDELAY = "ToolTipDismissDelay";
    private static final String EXPORTJPEGOPTIMIZEDHUFTABLE = "ExportJpegOptimizedHufTable";
    private static final String EXPORTQUALITY = "ExpertQuality";
    private static final String EXPORTSCALEFACTOR = "ExportScaleFactor";
    private static final String EXPORTDIRECTORY = "ExportDirectory";
    private static final String EXPORTMIMETYPE = "ExportMIMEType";
    private static final String USEFULLSCREENMODE = "UseFullScreenMode";
    private static final String FULLSCREENPAGESIZE = "FullScreenPageSize";
    private static final String BATCHCONVERTRECURSIVE = "BatchRecursive";
    private static final String BATCHCONVERTSRCFORMATS = "BatchSourceFormats";
    private static final String BATCHCONVERTTARGETFORMAT = "BatchTargetFormat";
    private static final String BATCHCONVERTJPGQUALITY = "BatchJpgQuality";
    private static final String BATCHCONVERTJPGOPTHUF = "BatchJpgOptimizedHuffman";
    private static final String BATCHCONVERTSCALE = "BatchScale";
   
    private static final String DEF_COLS = "0,16,12,27,11,4";
    private static final String DEF_COLWIDTH = "53,17,79,22,46,45";
    private static final String DEF_IMGDISPLAYTIMER = "250";
    private static final String DEF_FILLLISTTIMER = "500";
    private static final String DEF_JPGEXTENSIONS = "jpg|jpeg|png|bmp";
    private static final String DEF_SIZE_W = "750";
    private static final String DEF_SIZE_H = "600";
    private static final String DEF_EXTENDEDSTATE = "0";
    private static final String DEF_LOCATION_X = "10";
    private static final String DEF_LOCATION_Y = "10";
    private static final String DEF_DISPLAYALLIMAGES = "true";
    private static final String DEF_SAVEIMAGE = "2";
    private static final String DEF_IMGCACHESIZE = "6";
    private static final String DEF_IMGUSEPRELOAD = "true";
    private static final String DEF_VERTRESIZEWEIGHT = "0.3";
    private static final String DEF_HORRESIZEWEIGHT = "0.5";
    private static final String DEF_VERTDIVIDERLOCATION = "220";
    private static final String DEF_HORDIVIDERLOCATION = "350";
    private static final String DEF_INTERPOLATION = "1";
    private static final String DEF_ZOOMDELTA = "0.01";
    private static final String DEF_IMGSCROLLDELTA = "3";
    private static final String DEF_DELCONFIRM = "true";
    private static final String DEF_OVERWRITECONFIRM = "true";
    private static final String DEF_COPYDIRECTORY = "";
    private static final String DEF_MOVEDIRECTORY = "";
    private static final String DEF_IMGVIEWBACKCOLOR = "-13421773";
    private static final String DEF_CALLGCAFTERCACHEOP = "false";
    private static final String DEF_CALLGCINSETJPG = "false";
    private static final String DEF_SLIDESHOWTIMER = "20000";
    private static final String DEF_SLIDESHOWLOOP = "false";
    private static final String DEF_SLIDESHOWDIRECTION = "1";
    private static final String DEF_TOOLTIPTAGS = "0,1,4,-1,33434,33437,34855,41989,37385,41987,-1,41986,34850,37380,37383,-1,41994,41992,41993,41991,41985,-1,271,272";
    private static final String DEF_TOOLTIPBOLD = "true";
    private static final String DEF_TOOLTIPTABLE = "true";
    private static final String DEF_TOOLTIPDISMISSDELAY = "20000";
    private static final String DEF_EXPORTJPEGOPTIMIZEDHUFTABLE = "true";
    private static final String DEF_EXPORTQUALITY = "0.85";
    private static final String DEF_EXPORTSCALEFACTOR = "1.0";
    private static final String DEF_EXPORTDIRECTORY = "";
    private static final String DEF_EXPORTMIMETYPE = "image/jpeg";
    private static final String DEF_USEFULLSCREENMODE = "true";
    private static final String DEF_FULLSCREENPAGESIZE = "10";
    private static final String DEF_BATCHCONVERTRECURSIVE = "true";
    private static final String DEF_BATCHCONVERTSRCFORMATS = Integer.toString(JBatchData.BMP_FORMAT | JBatchData.PNG_FORMAT);
    private static final String DEF_BATCHCONVERTTARGETFORMAT = Integer.toString(JBatchData.JPG_FORMAT);
    private static final String DEF_BATCHCONVERTJPGQUALITY = "0.85";
    private static final String DEF_BATCHCONVERTJPGOPTHUF = "true";
    private static final String DEF_BATCHCONVERTSCALE = "1.0";

          
    public short[] m_cols;
    public int[] m_colWidth;
    public JTableColSortData[] m_sortData;
    public String[] m_jpgExtensions;
    public String[] m_homeDir;
    public int[] m_toolTipTags;

    private int m_imgDisplayTimer;
    private int m_fillListTimer;
    private Dimension m_size;
    private int m_extendedState;
    private Point m_location;
    private boolean m_bDisplayAllImages;
    private int m_saveImage;
    private int m_imgCacheSize;
    private boolean m_bImgUsePreload;
    private float m_vertResizeWeight;
    private float m_horResizeWeight;
    private double m_vertDividerLocation;
    private double m_horDividerLocation;
    private Object m_interpolation;
    private float m_zoomDelta;
    private int m_imgScrollDelta;
    private boolean m_bDelConfirm;
    private boolean m_bOverwriteConfirm;
    private String m_copyDirectory;
    private String m_moveDirectory;
    private Color m_imgViewBackColor;
    private boolean m_bCallGcAfterCacheOp;
    private boolean m_bCallGcInSetJpg;
    private int m_slideShowTimer;
    private boolean m_bSlideShowLoop;
    private int m_slideShowDirection;
    private boolean m_bToolTipBold;
    private boolean m_bToolTipTable;
    private int m_toolTipDismissDelay;
    private boolean m_bExportJpegOptimizedHufTable;
    private float m_exportQuality;
    private float m_exportScaleFactor;
    private String m_exportDirectory;
    private String m_exportMimeType;
    private boolean m_bUseFullScreenMode;
    private int m_fullScreenPageSize;
    private boolean m_bBatchRecursive;
    private int m_batchSrcFormats;
    private int m_batchTargetFormat;
    private boolean m_bBatchJpgOptHuf;
    private float m_batchJpgQuality;
    private float m_batchScale;
    /** Creates a new instance of JSettings */
    public JSettings(boolean bInitSwing)
    {
      super(bInitSwing);
    }
   
    protected String getComment()
    {
        return COMMENT;
    }
   
    public boolean isDisplayAllInages()
    {
      return m_bDisplayAllImages;
    }

    public void setDisplayAllInages(boolean bDisplayAllImages)
    {
      m_bDisplayAllImages = bDisplayAllImages;
    }
   
    public Point getLocation()
    {
        return m_location;
    }

    public void setLocation(Point location)
    {
        m_location = location;
    }

    public int getSaveImage()
    {
        return m_saveImage;
    }

    public void setSaveImage(int saveImage)
    {
        m_saveImage = saveImage;
    }

    public int getExtendedState()
    {
        return m_extendedState;
    }

    public void setExtendedState(int extendedState)
    {
        m_extendedState = extendedState;
    }

    public Dimension getSize()
    {
        if (m_size.getWidth() < 50)
            m_size = new Dimension(50, (int)m_size.getHeight());
        if (m_size.getHeight() < 50)
            m_size = new Dimension((int)m_size.getWidth(), 50);
        return m_size;
    }

    public void setSize(Dimension size)
    {
      m_size = size;
    }

    public int getImgDisplayTimer()
    {
        return m_imgDisplayTimer;
    }

    public void setImgDisplayTimer(int imgDisplayTimer)
    {
        m_imgDisplayTimer = imgDisplayTimer;
    }

    public int getFillListTimer()
    {
        return m_fillListTimer;
    }

    public void setFillListTimer(int fillListTimer)
    {
        m_fillListTimer = fillListTimer;
    }

    public int getSortDeep()
    {
      return m_sortData.length;
    }

    public void setSortDeep(int sortDeep)
    {
        int i, anzahl;
        JTableColSortData[] sortData = new JTableColSortData[sortDeep];
        if (sortDeep > m_sortData.length)
        {
            System.arraycopy(m_sortData, 0, sortData, 0, m_sortData.length);
            anzahl = sortDeep - m_sortData.length;
            for (i=0; i<anzahl; i++)
            sortData[i + m_sortData.length] = new JTableColSortData(0, true);
            m_sortData = sortData;
        }
        else if (sortDeep < m_sortData.length)
        {
            System.arraycopy(m_sortData, 0, sortData, 0, sortDeep);
            m_sortData = sortData;
        }
    }
   
    public int getImgCacheSize()
    {
      return m_imgCacheSize;
    }

    public void setImgCacheSize(int imgCacheSize)
    {
        m_imgCacheSize = imgCacheSize;
    }
   
    public boolean isImgUsePreload()
    {
      return m_bImgUsePreload;
    }
   
    public void setImgUsePreload(boolean bImgUsePreload)
    {
        m_bImgUsePreload = bImgUsePreload;
    }
   
    public float getVertResizeWeight()
    {
        return m_vertResizeWeight;
    }

    public float getHorResizeWeight()
    {
        return m_horResizeWeight;
    }

    public double getVertDividerLocation()
    {
      return m_vertDividerLocation;
    }

    public void setVertDividerLocation(double vertDividerLocation)
    {
      m_vertDividerLocation = vertDividerLocation;
    }

    public double getHorDividerLocation()
    {
        return m_horDividerLocation;
    }

    public void setHorDividerLocation(double horDividerLocation)
    {
      m_horDividerLocation = horDividerLocation;
    }
   
    public Object getInterpolation()
    {
        return m_interpolation;
    }

    public void setInterpolation(Object interpolation)
    {
      m_interpolation = interpolation;
    }

    public float getZoomDelta()
    {
        return m_zoomDelta;
    }

    public void setZoomDelta(float zoomDelta)
    {
        m_zoomDelta = zoomDelta;
    }
   
    public int getImgScrollDelta()
    {
      return m_imgScrollDelta;
    }

    public void setImgScrollDelta(int imgScrollDelta)
    {
        m_imgScrollDelta = imgScrollDelta;
    }

    public boolean isDelConfirm()
    {
      return m_bDelConfirm;
    }

    public void setDelConfirm(boolean bDelConfirm)
    {
        m_bDelConfirm = bDelConfirm;
    }

    public boolean isOverwriteConfirm()
    {
      return m_bOverwriteConfirm;
    }

    public void setOverwriteConfirm(boolean bOverwriteConfirm)
    {
        m_bOverwriteConfirm = bOverwriteConfirm;
    }

    public String getCopyDirectory()
    {
      return m_copyDirectory;
    }

    public void setCopyDirectory(String copyDirectory)
    {
        m_copyDirectory = copyDirectory;
    }

    public String getMoveDirectory()
    {
      return m_moveDirectory;
    }

    public void setMoveDirectory(String moveDirectory)
    {
        m_moveDirectory = moveDirectory;
    }

    public Color getImgViewBackColor()
    {
      return m_imgViewBackColor;
    }

    public void setImgViewBackColor(Color imgViewBackColor)
    {
        m_imgViewBackColor = imgViewBackColor;
    }
   
    public boolean getCallGcAfterCacheOp()
    {
      return m_bCallGcAfterCacheOp;
    }
   
    public boolean getCallGcInSetJpg()
    {
        return m_bCallGcInSetJpg;
    }

    public int getSlideShowTimer()
    {
      return m_slideShowTimer;
    }

    public void setSlideShowTimer(int slideShowTimer)
    {
        m_slideShowTimer = slideShowTimer;
    }

    public boolean getSlideShowLoop()
    {
      return m_bSlideShowLoop;
    }

    public void setSlideShowLoop(boolean bSlideShowLoop)
    {
        m_bSlideShowLoop = bSlideShowLoop;
    }

    public int getSlideShowDirection()
    {
      return m_slideShowDirection;
    }

    public void setSlideShowDirection(int slideShowDirection)
    {
        m_slideShowDirection = slideShowDirection;
    }

    public boolean isToolTipBold()
    {
      return m_bToolTipBold;
    }

    public void setToolTipBold(boolean bToolTipBold)
    {
        m_bToolTipBold = bToolTipBold;
    }

    public boolean isToolTipTable()
    {
      return m_bToolTipTable;
    }

    public void setToolTipTable(boolean bToolTipTable)
    {
        m_bToolTipTable = bToolTipTable;
    }

    public int getToolTipDismissDelay()
    {
        return m_toolTipDismissDelay;
    }

    public void setToolTipDismissDelay(int toolTipDismissDelay)
    {
      m_toolTipDismissDelay = toolTipDismissDelay;
    }

    public boolean isExportJpegOptimizedHufTable()
    {
        return m_bExportJpegOptimizedHufTable;
    }

    public void setExportJpegOptimizedHufTable(boolean bExportJpegOptimizedHufTable)
    {
        m_bExportJpegOptimizedHufTable = bExportJpegOptimizedHufTable;
    }

    public float getExportQuality()
    {
        return m_exportQuality;
    }

    public void setExportQuality(float exportQuality)
    {
        m_exportQuality = exportQuality;
    }

    public float getExportScaleFactor()
    {
        return m_exportScaleFactor;
    }

    public void setExportScalefactor(float exportScaleFactor)
    {
        m_exportScaleFactor = exportScaleFactor;
    }

    public String getExportDirectory()
    {
        return m_exportDirectory;
    }

    public void setExportDirectory(String exportDirectory)
    {
        m_exportDirectory = exportDirectory;
    }

    public String getExportMimeType()
    {
        return m_exportMimeType;
    }

    public void setExportMimeType(String exportMimetype)
    {
        m_exportMimeType = exportMimetype;
    }

    public boolean getUseFullScreenMode()
    {
        return m_bUseFullScreenMode;
    }

    public void setUseFullScreenMode(boolean bUseFullScreenMode)
    {
        m_bUseFullScreenMode = bUseFullScreenMode;
    }

    public int getFullScreenPageSize()
    {
        return m_fullScreenPageSize;
    }

    public void setFullScreenPageSize(int fullScreenPageSize)
    {
        m_fullScreenPageSize = fullScreenPageSize;
    }

    public boolean getBatchRecursive()
    {
        return m_bBatchRecursive;
    }

    public void setBatchRecursive(boolean bBatchRecursive)
    {
        m_bBatchRecursive = bBatchRecursive;
    }

    public int getBatchSrcFormats()
    {
        return m_batchSrcFormats;
    }

    public void setBatchSrcFormats(int batchSrcFormats)
    {
        m_batchSrcFormats = batchSrcFormats;
    }

    public int getBatchTargetFormat()
    {
        return m_batchTargetFormat;
    }

    public void setBatchTargetFormat(int batchTargetFormat)
    {
        m_batchTargetFormat = batchTargetFormat;
    }

    public boolean getBatchJpgOptHuf()
    {
        return m_bBatchJpgOptHuf;
    }

    public void setBatchJpgOptHuf(boolean bBatchJpgOptHuf)
    {
        m_bBatchJpgOptHuf = bBatchJpgOptHuf;
    }

    public float getBatchJpgQuality()
    {
        return m_batchJpgQuality;
    }

    public void setBatchJpgQuality(float batchJpgQuality)
    {
        m_batchJpgQuality = batchJpgQuality;
    }

    public float getBatchScale()
    {
        return m_batchScale;
    }

    public void setBatchScale(float batchScale)
    {
        m_batchScale = batchScale;
    }

    private void createDummy(String fileName)
    {
        Properties prop = new Properties();
        FileOutputStream out = null;
        try
        {
            out = new FileOutputStream(fileName);
            prop.store(out, COMMENT);
        }
        catch (IOException ex)
        {
        }
        finally
        {
            try
            {
            if (out != null) out.close();
            }
            catch (IOException ex)
            {}
        }
    }
   
    public void doSave(Properties prop)
    {
        StringBuilder strBuilder1 = new StringBuilder(), strBuilder2;
        for (short item : m_cols)
        {
            if (strBuilder1.length() != 0)
                strBuilder1.append(",");
            strBuilder1.append(Short.toString(item));
        }
        prop.setProperty(COLS, strBuilder1.toString());
        strBuilder1 = new StringBuilder();
        for (int item : m_colWidth)
        {
            if (strBuilder1.length() != 0)
                strBuilder1.append(",");
            strBuilder1.append(Integer.toString(item));
        }
        prop.setProperty(COLWIDTH, strBuilder1.toString());

        // sortCol
        strBuilder1 = new StringBuilder();
        strBuilder2 = new StringBuilder();
        for (JTableColSortData item : m_sortData)
        {
            if (strBuilder1.length() != 0)
                strBuilder1.append(",");
            strBuilder1.append(Integer.toString(item.getSortCol()));

            if (strBuilder2.length() != 0)
                strBuilder2.append(",");
            strBuilder2.append(Boolean.toString(item.getSortUp()));
        }
        prop.setProperty(SORTCOL, strBuilder1.toString());
        prop.setProperty(SORTUP, strBuilder2.toString());

        prop.setProperty(SORTDEEP, Integer.toString(m_sortData.length));

        prop.setProperty(IMGDISPLAYTIMER, Integer.toString(m_imgDisplayTimer));

        prop.setProperty(FILLLISTTIMER, Integer.toString(m_fillListTimer));

        // JPG extensions
        strBuilder1 = new StringBuilder();
        for (String item : m_jpgExtensions)
        {
            if (strBuilder1.length() != 0)
                strBuilder1.append("|");
            strBuilder1.append(item);
        }
        prop.setProperty(JPGEXTENSTIONS, strBuilder1.toString());

        strBuilder1 = new StringBuilder();
        for (String item : m_homeDir)
        {
            if (strBuilder1.length() != 0)
                strBuilder1.append("|");
            strBuilder1.append(item);
        }
        prop.setProperty(HOMEDIR, strBuilder1.toString());

        strBuilder1 = new StringBuilder();
        for (int item : m_toolTipTags)
        {
            if (strBuilder1.length() != 0)
                strBuilder1.append(",");
            strBuilder1.append(Integer.toString(item));
        }
        prop.setProperty(TOOLTIPTAGS, strBuilder1.toString());

        // Size
        prop.setProperty(SIZE_W, new Integer((int)m_size.getWidth()).toString());
        prop.setProperty(SIZE_H, new Integer((int)m_size.getHeight()).toString());
        prop.setProperty(EXTENDEDSTATE, new Integer(m_extendedState).toString());
        prop.setProperty(LOCATION_X, new Integer((int)m_location.getX()).toString());
        prop.setProperty(LOCATION_Y, new Integer((int)m_location.getY()).toString());

        prop.setProperty(DISPLAYALLIMAGES, Boolean.toString(m_bDisplayAllImages));

        prop.setProperty(SAVEIMAGE, Integer.toString(m_saveImage));

        prop.setProperty(IMGCACHESIZE, Integer.toString(m_imgCacheSize));

        prop.setProperty(IMGUSEPRELOAD, Boolean.toString(m_bImgUsePreload));

        prop.setProperty(VERTRESIZEWEIGHT, Float.toString(m_vertResizeWeight));

        prop.setProperty(HORRESIZEWEIGHT, Float.toString(m_horResizeWeight));

        prop.setProperty(VERTDIVIDERLOCATION, Double.toString(m_vertDividerLocation));

        prop.setProperty(HORDIVIDERLOCATION, Double.toString(m_horDividerLocation));

        int h;
        if (m_interpolation.equals(RenderingHints.VALUE_INTERPOLATION_BILINEAR))
            h = 1;
        else if (m_interpolation.equals(RenderingHints.VALUE_INTERPOLATION_BICUBIC))
            h = 2;
        else h=0;
        prop.setProperty(INTERPOLATION, Integer.toString(h));

        prop.setProperty(ZOOMDELTA, Float.toString(m_zoomDelta));

        prop.setProperty(IMGSCROLLDELTA, Integer.toString(m_imgScrollDelta));

        prop.setProperty(DELCONFIRM, Boolean.toString(m_bDelConfirm));

        prop.setProperty(OVERWRITECONFIRM, Boolean.toString(m_bOverwriteConfirm));

        prop.setProperty(COPYDIRECTORY, m_copyDirectory);

        prop.setProperty(MOVEDIRECTORY, m_moveDirectory);

        prop.setProperty(IMGVIEWBACKCOLOR, Integer.toString(m_imgViewBackColor.getRGB()));

        prop.setProperty(CALLGCAFTERCACHEOP, Boolean.toString(m_bCallGcAfterCacheOp));

        prop.setProperty(CALLGCINSETJPG, Boolean.toString(m_bCallGcInSetJpg));

        prop.setProperty(SLIDESHOWTIMER, Integer.toString(m_slideShowTimer));

        prop.setProperty(SLIDESHOWLOOP, Boolean.toString(m_bSlideShowLoop));

        prop.setProperty(SLIDESHOWDIRECTION, Integer.toString(m_slideShowDirection));

        prop.setProperty(TOOLTIPBOLD, Boolean.toString(m_bToolTipBold));

        prop.setProperty(TOOLTIPTABLE, Boolean.toString(m_bToolTipTable));

        prop.setProperty(TOOLTIPDISMISSDELAY, Integer.toString(m_toolTipDismissDelay));

        prop.setProperty(EXPORTJPEGOPTIMIZEDHUFTABLE, Boolean.toString(m_bExportJpegOptimizedHufTable));

        prop.setProperty(EXPORTQUALITY, Float.toString(m_exportQuality));

        prop.setProperty(EXPORTSCALEFACTOR, Float.toString(m_exportScaleFactor));

        prop.setProperty(EXPORTDIRECTORY, m_exportDirectory);

        prop.setProperty(EXPORTMIMETYPE, m_exportMimeType);

        prop.setProperty(USEFULLSCREENMODE, Boolean.toString(m_bUseFullScreenMode));

        prop.setProperty(FULLSCREENPAGESIZE, Integer.toString(m_fullScreenPageSize));

        prop.setProperty(BATCHCONVERTRECURSIVE, Boolean.toString(m_bBatchRecursive));

        prop.setProperty(BATCHCONVERTSRCFORMATS, Integer.toString(m_batchSrcFormats));

        prop.setProperty(BATCHCONVERTTARGETFORMAT, Integer.toString(m_batchTargetFormat));

        prop.setProperty(BATCHCONVERTJPGQUALITY, Float.toString(m_batchJpgQuality));

        prop.setProperty(BATCHCONVERTJPGOPTHUF, Boolean.toString(m_bBatchJpgOptHuf));

        prop.setProperty(BATCHCONVERTSCALE, Float.toString(m_batchScale));
    }

    public void doLoad(Properties prop)
    {
        String str  = prop.getProperty(COLS, DEF_COLS);
        String[] strArray1, strArray2;
        strArray1 = str.split(",");
        m_cols = new short[strArray1.length];
        int index = 0, i;
        for (String item : strArray1)
            m_cols[index++] = new Short(item);

        str  = prop.getProperty(COLWIDTH, DEF_COLWIDTH);
        strArray1 = str.split(",");
        m_colWidth = new int[strArray1.length];
        index = 0;
        for (String item : strArray1)
            m_colWidth[index++] = new Integer(item);

        m_sortData = new JTableColSortData[new Integer(prop.getProperty(SORTDEEP, "5"))];
        str  = prop.getProperty(SORTCOL, "0");
        strArray1 = str.split(",");
        str  = prop.getProperty(SORTUP, "true");
        strArray2 = str.split(",");
        for (i=0; i<m_sortData.length; i++)
        {
            if (i < strArray1.length)
                m_sortData[i] = new JTableColSortData(new Integer(strArray1[i]), new Boolean(strArray2[i]));
            else m_sortData[i] = new JTableColSortData(0, true);
        }

        m_imgDisplayTimer = new Integer(prop.getProperty(IMGDISPLAYTIMER, DEF_IMGDISPLAYTIMER));

        m_fillListTimer = new Integer(prop.getProperty(FILLLISTTIMER, DEF_FILLLISTTIMER));

        // JPG extensions
        str  = prop.getProperty(JPGEXTENSTIONS, DEF_JPGEXTENSIONS);
        strArray1 = str.split("\\|");
        m_jpgExtensions = new String[strArray1.length];
        i = 0;
        for (String item : strArray1)
            m_jpgExtensions[i++] = item.toLowerCase().trim();

        // Custom directories
        str = prop.getProperty(HOMEDIR, System.getProperty("user.home"));
        if (str.length() != 0)
        {
            strArray1 = str.split("\\|");
            m_homeDir = new String[strArray1.length];
            i = 0;
            for (String item : strArray1)
                m_homeDir[i++] = item;
        }
        else m_homeDir = null;

        // Tooltiptags
        str  = prop.getProperty(TOOLTIPTAGS, DEF_TOOLTIPTAGS);
        strArray1 = str.split(",");
        m_toolTipTags = new int[strArray1.length];
        i = 0;
        try
        {
            for (String item : strArray1)
            m_toolTipTags[i++] = new Integer(item.trim());
        }
        catch(NumberFormatException ex)
        {
            assert false;
        }

        // Size
        m_size = new Dimension(new Integer(prop.getProperty(SIZE_W, DEF_SIZE_W)), new Integer(prop.getProperty(SIZE_H, DEF_SIZE_H)));
        m_extendedState = new Integer(prop.getProperty(EXTENDEDSTATE, DEF_EXTENDEDSTATE));
        m_location = new Point(new Integer(prop.getProperty(LOCATION_X, DEF_LOCATION_X)), new Integer(prop.getProperty(LOCATION_Y, DEF_LOCATION_Y)));

        m_bDisplayAllImages = new Boolean(prop.getProperty(DISPLAYALLIMAGES, DEF_DISPLAYALLIMAGES));

        m_saveImage = new Integer(prop.getProperty(SAVEIMAGE, DEF_SAVEIMAGE));

        m_imgCacheSize = new Integer(prop.getProperty(IMGCACHESIZE, DEF_IMGCACHESIZE));

        m_bImgUsePreload = new Boolean(prop.getProperty(IMGUSEPRELOAD, DEF_IMGUSEPRELOAD));

        m_vertResizeWeight = new Float(prop.getProperty(VERTRESIZEWEIGHT, DEF_VERTRESIZEWEIGHT));

        m_horResizeWeight = new Float(prop.getProperty(HORRESIZEWEIGHT, DEF_HORRESIZEWEIGHT));

        m_vertDividerLocation = new Double(prop.getProperty(VERTDIVIDERLOCATION, DEF_VERTDIVIDERLOCATION));

        m_horDividerLocation = new Double(prop.getProperty(HORDIVIDERLOCATION, DEF_HORDIVIDERLOCATION));

        int h = new Integer(prop.getProperty(INTERPOLATION, DEF_INTERPOLATION));
        if (h==1) m_interpolation = RenderingHints.VALUE_INTERPOLATION_BILINEAR;
        else if (h==2) m_interpolation = RenderingHints.VALUE_INTERPOLATION_BICUBIC;
        else m_interpolation = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;

        m_zoomDelta = new Float(prop.getProperty(ZOOMDELTA, DEF_ZOOMDELTA));

        m_imgScrollDelta = new Integer(prop.getProperty(IMGSCROLLDELTA, DEF_IMGSCROLLDELTA));

        m_bDelConfirm = new Boolean(prop.getProperty(DELCONFIRM, DEF_DELCONFIRM));

        m_bOverwriteConfirm = new Boolean(prop.getProperty(OVERWRITECONFIRM, DEF_OVERWRITECONFIRM));

        m_copyDirectory = prop.getProperty(COPYDIRECTORY, DEF_COPYDIRECTORY);

        m_moveDirectory = prop.getProperty(MOVEDIRECTORY, DEF_MOVEDIRECTORY);

        m_imgViewBackColor = new Color(Integer.parseInt(prop.getProperty(IMGVIEWBACKCOLOR, DEF_IMGVIEWBACKCOLOR)));

        m_bCallGcAfterCacheOp = new Boolean(prop.getProperty(CALLGCAFTERCACHEOP, DEF_CALLGCAFTERCACHEOP));

        m_bCallGcInSetJpg = new Boolean(prop.getProperty(CALLGCINSETJPG, DEF_CALLGCINSETJPG));

        m_slideShowTimer = new Integer(prop.getProperty(SLIDESHOWTIMER, DEF_SLIDESHOWTIMER));

        m_bSlideShowLoop = new Boolean(prop.getProperty(SLIDESHOWLOOP, DEF_SLIDESHOWLOOP));

        m_slideShowDirection = new Integer(prop.getProperty(SLIDESHOWDIRECTION, DEF_SLIDESHOWDIRECTION));

        m_bToolTipBold = new Boolean(prop.getProperty(TOOLTIPBOLD, DEF_TOOLTIPBOLD));

        m_bToolTipTable = new Boolean(prop.getProperty(TOOLTIPTABLE, DEF_TOOLTIPTABLE));

        m_toolTipDismissDelay = new Integer(prop.getProperty(TOOLTIPDISMISSDELAY, DEF_TOOLTIPDISMISSDELAY));

        m_bExportJpegOptimizedHufTable = new Boolean(prop.getProperty(EXPORTJPEGOPTIMIZEDHUFTABLE, DEF_EXPORTJPEGOPTIMIZEDHUFTABLE));

        m_exportQuality = new Float(prop.getProperty(EXPORTQUALITY, DEF_EXPORTQUALITY));

        m_exportScaleFactor = new Float(prop.getProperty(EXPORTSCALEFACTOR, DEF_EXPORTSCALEFACTOR));

        m_exportDirectory = prop.getProperty(EXPORTDIRECTORY, DEF_EXPORTDIRECTORY);

        m_exportMimeType = prop.getProperty(EXPORTMIMETYPE, DEF_EXPORTMIMETYPE);
       
        m_bUseFullScreenMode = new Boolean(prop.getProperty(USEFULLSCREENMODE, DEF_USEFULLSCREENMODE));

        m_fullScreenPageSize = new Integer(prop.getProperty(FULLSCREENPAGESIZE, DEF_FULLSCREENPAGESIZE));

        m_batchSrcFormats = new Integer(prop.getProperty(BATCHCONVERTSRCFORMATS, DEF_BATCHCONVERTSRCFORMATS));

        m_bBatchRecursive = new Boolean(prop.getProperty(BATCHCONVERTRECURSIVE, DEF_BATCHCONVERTRECURSIVE));

        m_batchTargetFormat = new Integer(prop.getProperty(BATCHCONVERTTARGETFORMAT, DEF_BATCHCONVERTTARGETFORMAT));

        m_batchJpgQuality = new Float(prop.getProperty(BATCHCONVERTJPGQUALITY, DEF_BATCHCONVERTJPGQUALITY));

        m_bBatchJpgOptHuf = new Boolean(prop.getProperty(BATCHCONVERTJPGOPTHUF, DEF_BATCHCONVERTJPGOPTHUF));

        m_batchScale = new Float(prop.getProperty(BATCHCONVERTSCALE, DEF_BATCHCONVERTSCALE));
    }
}
TOP

Related Classes of jexifviewer.JSettings

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.