/** 
 * This script loads when ExhibitPlus is loaded and defines additional options 
 */
 
import se.datadosen.component.*;
import se.datadosen.util.*;
import se.datadosen.jalbum.event.*;

/* Check the version */
import javax.swing.*;
String currentVersion = generator.substring(generator.indexOf(' ')+1); if (currentVersion.compareTo("5.2") < 0) {
	JOptionPane.showMessageDialog(window,
	"This skin actually requires JAlbum 5.2. Please upgrade to the latest version at http://jalbum.net", 
	"Version warning", 
	JOptionPane.WARNING_MESSAGE);
}

// Read localized strings to use in user interface
File f = new File(skinDirectory, "texts");
SmartResourceBundle texts = SmartResourceBundle.getBundle(f, "texts");

// Controls that are to be imported into JAlbum as variables

ControlPanel ui = new ControlPanel() {

	JCheckBox allowEmptyFolderDescription = new JCheckBox(texts.getString("ui.allowEmptyFolderDescription"));
	JTextField dateFormat = new JTextField("dd.MM.yyyy");
	JComboBox displayEXIF = new JComboBox(new Object[] { "always", "userselect", "never" } );
	JCheckBox displayW3CLogosOnIndex = new JCheckBox(texts.getString("ui.displayW3CLogos"), true);
	JCheckBox displayW3CLogosOnSlide = new JCheckBox(texts.getString("ui.displayW3CLogos"), true);
	JCheckBox fixedFormatIndexPage = new JCheckBox(texts.getString("ui.fixedFormatIndexPage"));
	JTextField folderAgeNew = new JTextField("30");
	ButtonGroup slideLayout = new ButtonGroup();
	JRadioButton slideLayoutAutomatic = new JRadioButton(texts.getString("ui.slideOrientationAutomatic"), true);
	slideLayoutAutomatic.setActionCommand("Automatic");
	JRadioButton slideLayoutPortrait = new JRadioButton(texts.getString("ui.slideOrientationPortrait"), false);
	slideLayoutPortrait.setActionCommand("Portrait");
	JRadioButton slideLayoutLandscape = new JRadioButton(texts.getString("ui.slideOrientationLandscape"), false);
	slideLayoutLandscape.setActionCommand("Landscape");
	slideLayout.add(slideLayoutAutomatic);
	slideLayout.add(slideLayoutPortrait);
	slideLayout.add(slideLayoutLandscape);
	JCheckBox imageCommentUnderThumbnail = new JCheckBox(texts.getString("ui.imageCommentUnderThumbnail"));
	JCheckBox imageNameUnderThumbnail = new JCheckBox(texts.getString("ui.imageNameUnderThumbnail"));
	JTextField imagePaddingAdjust = new JTextField("100");
	JCheckBox keyboardShortcuts = new JCheckBox(texts.getString("ui.keyboardShortcuts"), true);
	JTextField numberOfMiniThumbs = new JTextField("10");
	JCheckBox polaroidMode = new JCheckBox(texts.getString("ui.polaroidMode"));
	JCheckBox protectIndexImages = new JCheckBox(texts.getString("ui.protectImages"));
	JCheckBox protectSlideImages = new JCheckBox(texts.getString("ui.protectImages"));
	JCheckBox sameSizeFilterIndex = new JCheckBox(texts.getString("ui.sameSizeFilterIndex"));
	JComboBox upButtonAtRootIndexPage = new JComboBox(new Object[] { "normal", "force", "never" } ); 
	JCheckBox useThumbForFolderIcon = new JCheckBox(texts.getString("ui.useThumbForFolderIcon"), true);
	JTextField watermark = new JTextField("");
	JTextField watermarkSize = new JTextField("20");
	JCheckBox shutterfly = new JCheckBox(texts.getString("ui.shutterfly"), true);
	JCheckBox fullScreenButtons = new JCheckBox(texts.getString("ui.fullScreenButtons"), true);
	JCheckBox navigationTop = new JCheckBox(texts.getString("ui.navigationTop"), true);
	JCheckBox navigationBottom = new JCheckBox(texts.getString("ui.navigationBottom"), true);
	JCheckBox jumpDirectFullscreen = new JCheckBox(texts.getString("ui.jumpDirectFullscreen"), false);
	JCheckBox commentAboveSlide = new JCheckBox(texts.getString("ui.commentAboveSlide"), false);
	JCheckBox slideShowContinuous = new JCheckBox(texts.getString("ui.slideShowContinuous"), false);
	JTextField slideShowDelay = new JTextField("4");
	JTextField miniThumbAdjust = new JTextField("25");
	JTextField numberIndexColumns = new JTextField("1");
	JComboBox language = new JComboBox();
	JComboBox iconSet = new JComboBox();
	JCheckBox displayFolderDateAdded = new JCheckBox(texts.getString("ui.displayFolderDateAdded"), true); 
	JCheckBox imageDateUnderThumbnail = new JCheckBox(texts.getString("ui.imageDateUnderThumbnail"), false);	
	JTextField folderThumbScale = new JTextField("100");
	JCheckBox showPhotoName = new JCheckBox(texts.getString("ui.showPhotoName"), true);
	JCheckBox promotionalLogos = new JCheckBox(texts.getString("ui.promotionalLogos"), true);
	JComboBox charityName = new JComboBox(new Object[] { "Firefox", "AVERT AIDS Charity", "Open Office" } );
	JTextField imagePadding = new JTextField("4");
	JCheckBox multiNavIndex = new JCheckBox(texts.getString("ui.multiNav"), true); 
	JCheckBox multiNavSlide = new JCheckBox(texts.getString("ui.multiNav"), true);
	JCheckBox globalHeader = new JCheckBox(texts.getString("ui.globalHeader"), true);
	JCheckBox globalFooter = new JCheckBox(texts.getString("ui.globalFooter"), true);
	JCheckBox guestBook = new JCheckBox(texts.getString("ui.guestBook"), false);
	JCheckBox allow35mmFocusFromCcdDimension = new JCheckBox(texts.getString("ui.allow35mmFocusFromCcdDimension"), true);

	// Image meta information
	JCheckBox showFileName = new JCheckBox(texts.getString("fileName"), true);
	JCheckBox showFileSize = new JCheckBox(texts.getString("fileSize"), false);
	// EXIF meta information
	JCheckBox showArtist = new JCheckBox(texts.getString("artist"), true);
	JCheckBox showUserComment = new JCheckBox(texts.getString("userComment"), false);
	JCheckBox showNativeFocus = new JCheckBox(texts.getString("nativeFocalLength"), true);
	JCheckBox show35mmFocus = new JCheckBox(texts.getString("35mmFocalLength"), true);
	JCheckBox showExposureTime = new JCheckBox(texts.getString("exposureTime"), true);
	JCheckBox showDateTaken = new JCheckBox(texts.getString("date"), true);
	JCheckBox showCamera = new JCheckBox(texts.getString("camera"), true);
	JCheckBox showResolution = new JCheckBox(texts.getString("resolution"), true);
	JCheckBox showFlash = new JCheckBox(texts.getString("flash"), true);
	JCheckBox showAperture = new JCheckBox(texts.getString("aperture"), true);
	JCheckBox showWhiteBalanceMode = new JCheckBox(texts.getString("whiteBalanceMode"), true);
	JCheckBox showIso = new JCheckBox(texts.getString("ISOSetting"), true);
	JCheckBox showMeteringMode = new JCheckBox(texts.getString("meteringMode"), true);
	JCheckBox showExposureMode = new JCheckBox(texts.getString("exposureMode"), true);
	// Iptc meta information
	JCheckBox showIptcHeadline = new JCheckBox(texts.getString("iptc.headline"), true);
	JCheckBox showIptcKeywords = new JCheckBox(texts.getString("iptc.keywords"), true);
	JCheckBox showIptcByLine = new JCheckBox(texts.getString("iptc.authorName"), true);
	JCheckBox showIptcByLineTitle = new JCheckBox(texts.getString("iptc.authorTitle"), true);
	JCheckBox showIptcObjectName = new JCheckBox(texts.getString("iptc.objectName"), true);
	JCheckBox showIptcSpecialInstructions = new JCheckBox(texts.getString("iptc.specialInstructions"), true);
	JCheckBox showIptcCategory = new JCheckBox(texts.getString("iptc.category"), true);
	JCheckBox showIptcUrgency = new JCheckBox(texts.getString("iptc.urgency"), true);
	JCheckBox showIptcSubCategories = new JCheckBox(texts.getString("iptc.subCategories"), true);
	JCheckBox showIptcCity = new JCheckBox(texts.getString("iptc.city"), true);
	JCheckBox showIptcProvince = new JCheckBox(texts.getString("iptc.province"), true);
	JCheckBox showIptcCountry = new JCheckBox(texts.getString("iptc.country"), true);
	JCheckBox showIptcReference = new JCheckBox(texts.getString("iptc.reference"), true);
	JCheckBox showIptcCredit = new JCheckBox(texts.getString("iptc.credit"), true);
	JCheckBox showIptcSource = new JCheckBox(texts.getString("iptc.source"), true);
	JCheckBox showIptcCopyright = new JCheckBox(texts.getString("iptc.copyright"), true);
	JCheckBox showIptcWriter = new JCheckBox(texts.getString("iptc.writer"), true);

	// Debug metadata functionality
	ButtonGroup debugMetadata = new ButtonGroup();
	JRadioButton debugMetadataNormal = new JRadioButton(texts.getString("ui.debugMetadataNormal"), true);
	debugMetadataNormal.setActionCommand("Normal");
	JRadioButton debugMetadataAllOnlyDefined = new JRadioButton(texts.getString("ui.debugMetadataAllOnlyDefined"), true);
	debugMetadataAllOnlyDefined.setActionCommand("All (only defined)");
	JRadioButton debugMetadataAllEvenUndefined = new JRadioButton(texts.getString("ui.debugMetadataAllEvenUndefined"), false);
	debugMetadataAllEvenUndefined.setActionCommand("All");
	debugMetadata.add(debugMetadataNormal);
	debugMetadata.add(debugMetadataAllOnlyDefined);
	debugMetadata.add(debugMetadataAllEvenUndefined);

	// Custom separator
	JTextField customSep = new JTextField("");

	// Set this variable so we can test later if the UI has been loaded
	JCheckBox userInterface = new JCheckBox();

};

public List getSupportedLanguages()
{
	Iterator it = Arrays.asList(new File(skinDirectory,"texts").listFiles()).iterator();
	List result = new LinkedList();
	
	while( it.hasNext() )
	{
		String file_name = ((File)it.next()).getName().toLowerCase();
		
		if( !file_name.startsWith("texts_") || !file_name.endsWith(".properties") )
			continue;
		
		int end_index = file_name.indexOf(".properties");
		
		result.add( file_name.substring(6, end_index) );
	}
	return result;
}

public void setItemsForComboBox(JComboBox combo, List items)
{
//	Collections.sort(items);
	combo.removeAllItems();
	
	Iterator it = items.iterator();
	
	while( it.hasNext() )
		combo.addItem( it.next() );
}

public List getIconSets()
{
	Iterator it = Arrays.asList(new File(skinDirectory,"button-sets").listFiles()).iterator();
	List result = new LinkedList();
	
	result.add( "default" );
	while( it.hasNext() )
	{
		File file = (File)it.next();
		
		if( !file.isDirectory() )
			continue;
		
		result.add( file.getName() );
	}
	return result;
}

JEditorPane text = new JEditorPane("text/html", texts.getString("ui.guestBook.info") + "<a href=\"http://www.fyvie.net/photos/userguide.html#guestbook\">http://exhibitplus.fyvie.net</a>");

text.addHyperlinkListener(new javax.swing.event.HyperlinkListener() {
   public void hyperlinkUpdate(HyperlinkEvent e) {
      if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
         try {
            edu.stanford.ejalbert.BrowserLauncher.openURL(e.getURL().toExternalForm());
         }
         catch (IOException ex) {}
      }
   }
});

text.setEditable(false);
text.setOpaque(false);

RiverLayout layout = (RiverLayout)ui.getLayout();
layout.setHgap(0);


ControlPanel generalPanel = new ControlPanel(texts.getString("ui.generalOptions"));
RiverLayout layout = (RiverLayout)generalPanel.getLayout();
layout.setHgap(1);
setItemsForComboBox(ui.language, getSupportedLanguages());
generalPanel.add(new JLabel(texts.getString("ui.languageLabel")));
generalPanel.add("tab", ui.language);
setItemsForComboBox(ui.iconSet, getIconSets());
generalPanel.add("br", new JLabel(texts.getString("ui.iconSetLabel")));
generalPanel.add("tab", ui.iconSet);
generalPanel.add("br", ui.keyboardShortcuts);
generalPanel.add("br", ui.promotionalLogos);
generalPanel.add(ui.charityName);
generalPanel.add("br", new JLabel(texts.getString("ui.dateFormat") + " "));
generalPanel.add(ui.dateFormat);

ControlPanel expertPanel = new ControlPanel(texts.getString("ui.expertOptions"));
RiverLayout layout = (RiverLayout)expertPanel.getLayout();
layout.setHgap(1);
expertPanel.add(ui.globalHeader);
expertPanel.add("tab", ui.globalFooter);
expertPanel.add("br", ui.allow35mmFocusFromCcdDimension);
expertPanel.add("br", new JLabel(texts.getString("ui.customSep") + " "));
expertPanel.add("hfill", ui.customSep);

ControlPanel debugMetadataPanel = new ControlPanel(texts.getString("ui.debugMetadataPanel"));
RiverLayout layout = (RiverLayout)debugMetadataPanel.getLayout();
layout.setHgap(0);
layout.setVgap(0);
debugMetadataPanel.add(ui.debugMetadataNormal);
debugMetadataPanel.add("br", ui.debugMetadataAllOnlyDefined);
debugMetadataPanel.add("br", ui.debugMetadataAllEvenUndefined);
expertPanel.add("br hfill", debugMetadataPanel);

ControlPanel slidePanel = new ControlPanel(texts.getString("ui.slides"));
RiverLayout layout = (RiverLayout)slidePanel.getLayout();
layout.setHgap(0);
layout.setVgap(0);

ControlPanel upperSlidePanel = new ControlPanel();

RiverLayout layout = (RiverLayout)upperSlidePanel.getLayout();
layout.setHgap(1);
layout.setVgap(1);

upperSlidePanel.add(ui.navigationTop);
upperSlidePanel.add("tab", ui.fullScreenButtons);
upperSlidePanel.add("tab", ui.displayW3CLogosOnSlide);
upperSlidePanel.add("br", ui.navigationBottom);
upperSlidePanel.add("tab", ui.protectSlideImages);
upperSlidePanel.add("tab", ui.slideShowContinuous);
upperSlidePanel.add("br", ui.commentAboveSlide);
upperSlidePanel.add("tab", ui.polaroidMode);
upperSlidePanel.add("tab", ui.shutterfly);
JLinkLabel link = new JLinkLabel("shutterfly.com");
link.setURL("http://www.shutterfly.com");
upperSlidePanel.add(link);
upperSlidePanel.add("br", ui.showPhotoName);
upperSlidePanel.add("tab", ui.multiNavSlide);
upperSlidePanel.add("tab", ui.guestBook);

upperSlidePanel.add("br", new JLabel(texts.getString("ui.slideOrientation")));
upperSlidePanel.add(new JLabel("   "));
upperSlidePanel.add("hfill", ui.slideLayoutAutomatic);
upperSlidePanel.add("hfill", ui.slideLayoutPortrait);
upperSlidePanel.add("hfill", ui.slideLayoutLandscape);

slidePanel.add("br hfill", upperSlidePanel);

ControlPanel lowerSlidePanel = new ControlPanel();

lowerSlidePanel.add("br", new JLabel(texts.getString("ui.miniThumbnails") + " "));
lowerSlidePanel.add("tab", ui.numberOfMiniThumbs);
lowerSlidePanel.add("br", new JLabel(texts.getString("ui.miniThumbAdjust") + " "));
lowerSlidePanel.add("tab", ui.miniThumbAdjust);
lowerSlidePanel.add(new JLabel("%"));
lowerSlidePanel.add("br", new JLabel(texts.getString("ui.imageFrameAdjust") + " "));
lowerSlidePanel.add("tab", ui.imagePaddingAdjust);
lowerSlidePanel.add(new JLabel("%"));
lowerSlidePanel.add("br", new JLabel(texts.getString("ui.slideshowDelay") + " "));
lowerSlidePanel.add("tab", ui.slideShowDelay);
lowerSlidePanel.add(new JLabel(" " + texts.getString("ui.seconds")));
lowerSlidePanel.add("br", new JLabel(texts.getString("ui.displayEXIF") + " "));
lowerSlidePanel.add("tab", ui.displayEXIF);
lowerSlidePanel.add("br", new JLabel(texts.getString("ui.watermarkSize") + " "));
lowerSlidePanel.add("tab", ui.watermarkSize);
lowerSlidePanel.add("tab", new JLabel(texts.getString("ui.watermarkText") + " "));
lowerSlidePanel.add("hfill", ui.watermark);

slidePanel.add("p hfill", lowerSlidePanel);

ControlPanel indexPanel = new ControlPanel(texts.getString("ui.thumbnails"));
RiverLayout layout = (RiverLayout)indexPanel.getLayout();
layout.setHgap(1);
indexPanel.add(ui.allowEmptyFolderDescription);
indexPanel.add("tab", ui.displayW3CLogosOnIndex);
indexPanel.add("br", ui.fixedFormatIndexPage);
indexPanel.add("tab", ui.imageCommentUnderThumbnail);
indexPanel.add("br", ui.jumpDirectFullscreen);
indexPanel.add("tab", ui.imageNameUnderThumbnail);
indexPanel.add("br", ui.protectIndexImages);
indexPanel.add("tab", ui.imageDateUnderThumbnail);
indexPanel.add("br", ui.useThumbForFolderIcon);
indexPanel.add("tab", ui.displayFolderDateAdded);
indexPanel.add("br", ui.sameSizeFilterIndex);
indexPanel.add("tab", ui.multiNavIndex);

indexPanel.add("br", new JLabel(texts.getString("ui.imagePadding") + " "));
indexPanel.add(ui.imagePadding);
indexPanel.add(new JLabel(" " + texts.getString("ui.imagePaddingPixels")));

indexPanel.add("tab", new JLabel(texts.getString("ui.folderThumbScale") + " "));
indexPanel.add(ui.folderThumbScale);
indexPanel.add(new JLabel("%"));

indexPanel.add("br", new JLabel(texts.getString("ui.numberIndexColumns") + " "));
indexPanel.add(ui.numberIndexColumns);

indexPanel.add("br", new JLabel(texts.getString("ui.newFolders") + " "));
indexPanel.add(ui.folderAgeNew);
indexPanel.add(new JLabel(" " + texts.getString("ui.daysOld")));

indexPanel.add("br", new JLabel(texts.getString("ui.upButton") + " "));
indexPanel.add(ui.upButtonAtRootIndexPage);



ControlPanel infoPanel = new ControlPanel(texts.getString("ui.info"));
RiverLayout layout = (RiverLayout)infoPanel.getLayout();
layout.setHgap(0);
layout.setVgap(0);


// File data
infoPanel.add("br", ui.showFileName);
infoPanel.add("tab", ui.showFileSize);

// EXIF data
ControlPanel exifPanel = new ControlPanel(texts.getString("ui.exif-fields"));
RiverLayout layout = (RiverLayout)exifPanel.getLayout();
layout.setHgap(1);
layout.setVgap(1);
exifPanel.add(ui.showNativeFocus);
exifPanel.add("tab", ui.show35mmFocus);
exifPanel.add("tab", ui.showExposureTime);
exifPanel.add("tab", ui.showDateTaken);
exifPanel.add("br", ui.showCamera);
exifPanel.add("tab", ui.showResolution);
exifPanel.add("tab", ui.showFlash);
exifPanel.add("tab", ui.showWhiteBalanceMode);
exifPanel.add("br", ui.showIso);
exifPanel.add("tab", ui.showMeteringMode);
exifPanel.add("tab", ui.showUserComment);
exifPanel.add("tab", ui.showArtist);
exifPanel.add("br", ui.showAperture);
exifPanel.add("tab", ui.showExposureMode);

infoPanel.add("br hfill", exifPanel);

// IPTC data
ControlPanel iptcPanel = new ControlPanel(texts.getString("ui.iptc-fields"));
RiverLayout layout = (RiverLayout)iptcPanel.getLayout();
layout.setHgap(1);
layout.setVgap(1);
iptcPanel.add(ui.showIptcHeadline);
iptcPanel.add("tab", ui.showIptcKeywords);
iptcPanel.add("tab", ui.showIptcByLine);
iptcPanel.add("tab", ui.showIptcByLineTitle);
iptcPanel.add("br", ui.showIptcObjectName);
iptcPanel.add("tab", ui.showIptcSpecialInstructions);
iptcPanel.add("tab", ui.showIptcCategory);
iptcPanel.add("tab", ui.showIptcUrgency);
iptcPanel.add("br", ui.showIptcSubCategories);
iptcPanel.add("tab", ui.showIptcCity);
iptcPanel.add("tab", ui.showIptcProvince);
iptcPanel.add("tab", ui.showIptcCountry);
iptcPanel.add("br", ui.showIptcReference);
iptcPanel.add("tab", ui.showIptcCredit);
iptcPanel.add("tab", ui.showIptcSource);
iptcPanel.add("tab", ui.showIptcCopyright);
iptcPanel.add("br", ui.showIptcWriter);

infoPanel.add("br hfill", iptcPanel);

// Consolidate the infoPanel into a JScrollPane
JScrollPane imageMetadataScrollPane = new JScrollPane();
imageMetadataScrollPane.getViewport().add(infoPanel, null);


//
// Panel: ABOUT
//

ControlPanel aboutPanel = new ControlPanel(texts.getString("ui.about"));
JLinkLabel homeLink = new JLinkLabel("http://exhibitplus.fyvie.net");
JLinkLabel docLink = new JLinkLabel("http://www.fyvie.net/photos/userguide.html");
JLinkLabel historyLink = new JLinkLabel("http://www.fyvie.net/photos/history.html");
JLinkLabel forumLink = new JLinkLabel("http://jalbum.net/forum/forum.jspa?forumID=17");

homeLink.setURL("http://exhibitplus.fyvie.net");
docLink.setURL("http://www.fyvie.net/photos/userguide.html");
historyLink.setURL("http://www.fyvie.net/photos/history.html");
forumLink.setURL("http://jalbum.net/forum/forum.jspa?forumID=17");

aboutPanel.add(new JLabel(texts.getString("ui.aboutAuthor")));
aboutPanel.add("tab", new JLabel("Mark Fyvie"));
aboutPanel.add("br", new JLabel(texts.getString("ui.aboutSkinDateVersion")));
aboutPanel.add("tab", new JLabel("29 October 2005 (v1.4a)"));
aboutPanel.add("br", new JLabel(texts.getString("ui.aboutHomePage")));
aboutPanel.add("tab", homeLink);
aboutPanel.add("br", new JLabel(texts.getString("ui.aboutDocumentationUserGuide")));
aboutPanel.add("tab", docLink);
aboutPanel.add("br", new JLabel(texts.getString("ui.aboutChangeHistory")));
aboutPanel.add("tab", historyLink);
aboutPanel.add("br", new JLabel(texts.getString("ui.aboutForum")));
aboutPanel.add("tab", forumLink);

JTabbedPane tabs = new JTabbedPane();
tabs.add(generalPanel, texts.getString("ui.generalPanel"));
tabs.add(indexPanel, texts.getString("ui.indexPanel"));
tabs.add(slidePanel, texts.getString("ui.slidePanel"));
tabs.add(imageMetadataScrollPane, texts.getString("ui.infoPanel"));
tabs.add(expertPanel, texts.getString("ui.expertPanel"));
tabs.add(aboutPanel, texts.getString("ui.aboutPanel"));

ui.add("vtop hfill vfill", tabs);

// Configure controls
ui.allowEmptyFolderDescription.setToolTipText(texts.getString("ui.allowEmptyFolderDescriptionToolTip"));
ui.dateFormat.setToolTipText(texts.getString("ui.dateFormat.setToolTipText"));
ui.displayEXIF.setToolTipText(texts.getString("ui.displayEXIF.setToolTipText"));
ui.displayW3CLogosOnIndex.setToolTipText(texts.getString("ui.displayW3CLogosOnIndex.setToolTipText"));
ui.displayW3CLogosOnSlide.setToolTipText(texts.getString("ui.displayW3CLogosOnSlide.setToolTipText"));
ui.fixedFormatIndexPage.setToolTipText(texts.getString("ui.fixedFormatIndexPage.setToolTipText"));
ui.folderAgeNew.setToolTipText(texts.getString("ui.folderAgeNew.setToolTipText"));
ui.imageCommentUnderThumbnail.setToolTipText(texts.getString("ui.imageCommentUnderThumbnail.setToolTipText"));
ui.imageNameUnderThumbnail.setToolTipText(texts.getString("ui.imageNameUnderThumbnail.setToolTipText"));
ui.imagePaddingAdjust.setToolTipText(texts.getString("ui.imagePaddingAdjust.setToolTipText"));
ui.keyboardShortcuts.setToolTipText(texts.getString("ui.keyboardShortcuts.setToolTipText"));
ui.numberOfMiniThumbs.setToolTipText(texts.getString("ui.numberOfMiniThumbs.setToolTipText"));
ui.polaroidMode.setToolTipText(texts.getString("ui.polaroidMode.setToolTipText"));
ui.protectIndexImages.setToolTipText(texts.getString("ui.protectIndexImages.setToolTipText"));
ui.protectSlideImages.setToolTipText(texts.getString("ui.protectSlideImages.setToolTipText"));
ui.sameSizeFilterIndex.setToolTipText(texts.getString("ui.sameSizeFilterIndex.setToolTipText"));
ui.upButtonAtRootIndexPage.setToolTipText(texts.getString("ui.upButtonAtRootIndexPage.setToolTipText"));
ui.useThumbForFolderIcon.setToolTipText(texts.getString("ui.useThumbForFolderIcon.setToolTipText"));
ui.shutterfly.setToolTipText(texts.getString("ui.shutterfly.setToolTipText"));
ui.watermark.setToolTipText(texts.getString("ui.watermark.setToolTipText"));
ui.watermarkSize.setToolTipText(texts.getString("ui.watermarkSize.setToolTipText"));
ui.fullScreenButtons.setToolTipText(texts.getString("ui.fullScreenButtons.setToolTipText"));
ui.navigationTop.setToolTipText(texts.getString("ui.navigationTop.setToolTipText"));
ui.navigationBottom.setToolTipText(texts.getString("ui.navigationBottom.setToolTipText"));
ui.jumpDirectFullscreen.setToolTipText(texts.getString("ui.jumpDirectFullscreen.setToolTipText"));
ui.commentAboveSlide.setToolTipText(texts.getString("ui.commentAboveSlide.setToolTipText"));
ui.slideShowContinuous.setToolTipText(texts.getString("ui.slideShowContinuous.setToolTipText"));
ui.miniThumbAdjust.setToolTipText(texts.getString("ui.miniThumbAdjust.setToolTipText"));
ui.language.setToolTipText(texts.getString("ui.language.setToolTipText"));
ui.iconSet.setToolTipText(texts.getString("ui.iconSet.setToolTipText"));
ui.displayFolderDateAdded.setToolTipText(texts.getString("ui.displayFolderDateAdded.setToolTipText"));
ui.imageDateUnderThumbnail.setToolTipText(texts.getString("ui.imageDateUnderThumbnail.setToolTipText"));
ui.folderThumbScale.setToolTipText(texts.getString("ui.folderThumbScale.setToolTipText"));
ui.slideLayoutAutomatic.setToolTipText(texts.getString("ui.slideOrientation.setToolTipText"));
ui.slideLayoutPortrait.setToolTipText(texts.getString("ui.slideOrientation.setToolTipText"));
ui.slideLayoutLandscape.setToolTipText(texts.getString("ui.slideOrientation.setToolTipText"));
ui.showPhotoName.setToolTipText(texts.getString("ui.showPhotoName.setToolTipText"));
ui.promotionalLogos.setToolTipText(texts.getString("ui.promotionalLogos.setToolTipText"));
ui.charityName.setToolTipText(texts.getString("ui.charityName.setToolTipText"));
ui.imagePadding.setToolTipText(texts.getString("ui.imagePadding.setToolTipText"));
ui.multiNavIndex.setToolTipText(texts.getString("ui.multiNav.setToolTipText"));
ui.multiNavSlide.setToolTipText(texts.getString("ui.multiNav.setToolTipText"));
ui.globalHeader.setToolTipText(texts.getString("ui.globalHeader.setToolTipText"));
ui.globalFooter.setToolTipText(texts.getString("ui.globalFooter.setToolTipText"));
ui.guestBook.setToolTipText(texts.getString("ui.guestBook.setToolTipText"));
ui.allow35mmFocusFromCcdDimension.setToolTipText(texts.getString("ui.allow35mmFocusFromCcdDimension.setToolTipText"));
ui.debugMetadataNormal.setToolTipText(texts.getString("ui.debugMetadataNormal.setToolTipText"));
ui.debugMetadataAllOnlyDefined.setToolTipText(texts.getString("ui.debugMetadataAllOnlyDefined.setToolTipText"));
ui.debugMetadataAllEvenUndefined.setToolTipText(texts.getString("ui.debugMetadataAllEvenUndefined.setToolTipText"));
ui.customSep.setToolTipText(texts.getString("ui.customSep.setToolTipText"));

// Allow other languages than specified in list
ui.language.setEditable(true);

// Set default language
ui.language.setSelectedItem(System.getProperty("user.language"));

// Set default iconSet
ui.iconSet.setSelectedItem("default");

window.addJAlbumListener(new JAlbumAdapter() {
   public void skinUIDisplayed(JAlbumEvent e) {
   	System.out.println("Displayed");
   }

   public void skinUIHidden(JAlbumEvent e) {
   	System.out.println("Hidden");
   }

   public void styleChanged(JAlbumEvent e) {
   	System.out.println("StyleChange");
	// Set default iconSet
	ui.iconSet.setSelectedItem("default");
   }

   public void skinChanged(JAlbumEvent e) {
   	System.out.println("SkinChange");
   }
   
   public void albumCreationStarted(JAlbumEvent e) {
   	System.out.println("Creation started");
   }
   
   public void albumCreationFinished(JAlbumEvent e) {
   	System.out.println("Creation finished");
   }
   
});

ui.guestBook.addItemListener(new ItemListener() {
  public void itemStateChanged(ItemEvent e) {
    if (window.isSkinUISelected()) { 
      if (ui.guestBook.isSelected() && ui.keyboardShortcuts.isSelected()) {
        window.messageBox(texts.getString("ui.guestBook.compatibility") + " " + texts.getString("ui.keyboardShortcuts.disabled"));
        ui.keyboardShortcuts.setSelected(false);
      }
      if (ui.guestBook.isSelected()) {
        JOptionPane.showMessageDialog(window, text,
        "Guestbook", JOptionPane.WARNING_MESSAGE);
      }
    }
  }
});

ui.keyboardShortcuts.addItemListener(new ItemListener() {
  public void itemStateChanged(ItemEvent e) {
    if (window.isSkinUISelected()) { 
      if (ui.guestBook.isSelected() && ui.keyboardShortcuts.isSelected()) {
        window.messageBox(texts.getString("ui.guestBook.compatibility") + " " + texts.getString("ui.guestBook.disabled"));
        ui.guestBook.setSelected(false);
      }
    }
  }
});


// Finally install components into JAlbum
window.setSkinUI(ui);

// Resize the JAlbum window so the widgets display correctly
// But let's not forget that this might make JAlbum expand to be larger than 800x600, and for many users this is a problem!!
// window.pack();

