[freenet-dev] [freenet-cvs] r17770 - in trunk/apps/thingamablog/src/net/sf/thingamablog: blog gui/properties xml

Matthew Toseland toad at amphibian.dyndns.org
Tue Feb 12 16:11:40 UTC 2008


On Sunday 10 February 2008 03:51, dieppe at freenetproject.org wrote:
> Author: dieppe
> Date: 2008-02-10 03:51:06 +0000 (Sun, 10 Feb 2008)
> New Revision: 17770
> 
> Modified:
>    trunk/apps/thingamablog/src/net/sf/thingamablog/blog/TBWeblog.java
>    
trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBGeneralPanel.java
>    
trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBWizardDialog.java
>    trunk/apps/thingamablog/src/net/sf/thingamablog/xml/TBPersistFactory.java
> Log:
> Update : same as the first patch, but clean.

Doesn't look it to me. :(

You're still doing gratuitous indenting at the same time as functional 
changes.

Sorry ... but if we're gonna host it, we need to maintain basic standards of 
diff readability...
> 
> 
> Modified: trunk/apps/thingamablog/src/net/sf/thingamablog/blog/TBWeblog.java
> ===================================================================
> --- trunk/apps/thingamablog/src/net/sf/thingamablog/blog/TBWeblog.java	
2008-02-09 20:27:58 UTC (rev 17769)
> +++ trunk/apps/thingamablog/src/net/sf/thingamablog/blog/TBWeblog.java	
2008-02-10 03:51:06 UTC (rev 17770)
> @@ -89,6 +89,9 @@
>  	private String archivePath = basePath;
>  	private String mediaPath = basePath;
>  	
> +        // Should be internet or freenet
> +        private String type;
> +        
>  	//private Vector outdatedTopLevelPages = new Vector();
>  	private Vector outdatedCategoryPages = new Vector();
>  	private Vector outdatedArchivePages = new Vector();
> @@ -114,9 +117,6 @@
>  	private File homeDir;
>  	private File tmplDir;
>  	private File outputDir;
> -
> -        // Should be internet or freenet
> -        private String type;
>  	
>  	
>  	/**
> @@ -1398,7 +1398,7 @@
>      }
>  
>      public void setType(String type) {
> -        this.type=type;
> +        this.type = type;
>      }
>      
>      public String getType() {
> 
> Modified: 
trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBGeneralPanel.java
> ===================================================================
> --- 
trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBGeneralPanel.java	
2008-02-09 20:27:58 UTC (rev 17769)
> +++ 
trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBGeneralPanel.java	
2008-02-10 03:51:06 UTC (rev 17770)
> @@ -30,277 +30,295 @@
>  /**
>   * @author Bob Tantlinger
>   *
> - *
> - *
> + * 
> + * 
>   */
> -public class TBGeneralPanel extends PropertyPanel {
> +public class TBGeneralPanel extends PropertyPanel
> +{
>      /**
> -     *
> +     * 
>       */
>      private static final long serialVersionUID = 1L;
> -    
> +
>      private static final I18n i18n = 
I18n.getInstance("net.sf.thingamablog.gui.properties");
>      
>      private TBWeblog weblog;
> +	
> +	private JTextField titleField;
> +	private JTextArea descrArea;
> +	private JTextField basePathField;
> +	private JTextField urlField;
> +	private JTextField arcUrlField;
> +	private JTextField mediaUrlField;
> +	
> +	private JComboBox localeCombo;
> +	private JComboBox dateFormatCombo;
> +	private JComboBox timeFormatCombo;
> +        private JComboBox typeCombo;
> +	
> +	private static Locale LOCS[] = DateFormat.getAvailableLocales();
> +        private static String TYPE[] = {"internet","freenet"};
> +        
> +	private String[] getDateFormats(Locale locale) {
> +		String s = i18n.str("DateFormatOptions",locale);
> +		return tokenize(s);
> +	}
> +	private String[] getTimeFormats(Locale locale) {
> +		String s = i18n.str("TimeFormatOptions",locale);
> +		return tokenize(s);
> +	}
> +	private String[] tokenize(String s) {
> +		StringTokenizer st = new StringTokenizer(s,"|");
> +		String[] formats = new String[st.countTokens()];
> +		for (int i = 0; i < formats.length; i++) {
> +			formats[i] = st.nextToken();
> +		}
> +		return formats;
> +	}
> +	/*
> +	private static final String DATE_FORMATS[] =
> +	{
> +		"EEEE, MMMM dd, yyyy", //$NON-NLS-1$
> +		"EEE, MMM dd, yyyy", //$NON-NLS-1$
> +		"EEEE, dd MMMM, yyyy", //$NON-NLS-1$
> +		"EEEE dd MMMM yyyy", //$NON-NLS-1$
> +		"EEEE",
> +		"MMMM dd, yyyy", //$NON-NLS-1$
> +		"MMMM dd yyyy", //$NON-NLS-1$		
> +    	
> +		"MM/dd/yyyy",    		 //$NON-NLS-1$
> +		"MM/dd/yy", //$NON-NLS-1$
> +		"dd/MM/yyyy", //$NON-NLS-1$
> +		"dd/MM/yy", //$NON-NLS-1$
> +    	
> +		"dd MMMM yyyy", //$NON-NLS-1$
> +		"dd MMMM", //$NON-NLS-1$
> +    	    	
> +		"yyyy-MM-dd", //$NON-NLS-1$
> +		"yy-MM-dd", //$NON-NLS-1$
> +		"yy.MM.dd", //$NON-NLS-1$
> +		"yyyy.MM.dd", //$NON-NLS-1$
> +		"EEEE, MM/dd/yyyy", //$NON-NLS-1$
> +		"EEE, MM/dd/yyyy" //$NON-NLS-1$
> +	};
>      
> -    private JTextField titleField;
> -    private JTextArea descrArea;
> -    private JTextField basePathField;
> -    private JTextField urlField;
> -    private JTextField arcUrlField;
> -    private JTextField mediaUrlField;
> -    
> -    private JComboBox localeCombo;
> -    private JComboBox dateFormatCombo;
> -    private JComboBox timeFormatCombo;
> -    private JComboBox typeCombo;
> -    
> -    private static Locale LOCS[] = DateFormat.getAvailableLocales();
> -    private static String TYPE[] = {"internet","freenet"};
> -    
> -    private String[] getDateFormats(Locale locale) {
> -        String s = i18n.str("DateFormatOptions",locale);
> -        return tokenize(s);
> +	private static final SimpleDateFormat GMT_TIME_FORMAT = 
> +		new SimpleDateFormat("k:mm.ss z"); //$NON-NLS-1$
> +	private static final String TIME_FORMATS[] =
> +	{
> +		"h:mm a", //$NON-NLS-1$
> +		"h:mm.ss a", //$NON-NLS-1$
> +		"h:mm a z", //$NON-NLS-1$
> +		"h:mm.ss a z", //$NON-NLS-1$
> +		"h:mm a zzzz", //$NON-NLS-1$
> +		"h:mm.ss a zzzz", //$NON-NLS-1$
> +		"k:mm", //$NON-NLS-1$
> +		"k:mm.ss", //$NON-NLS-1$
> +		//GMT_TIME_FORMAT       
> +	};	
> +    */
> +	
> +    public TBGeneralPanel(TBWeblog blog)
> +    {
> +    	weblog = blog;
> +    	
> +    	TextEditPopupManager popupMan = TextEditPopupManager.getInstance();
> +		titleField = new JTextField();
> +		titleField.setText(weblog.getTitle());
> +		popupMan.registerJTextComponent(titleField);
> +		
> +		descrArea = new JTextArea(3, 2);
> +		//descrArea.setMinimumSize(descrArea.getPreferredSize());		
> +		descrArea.setLineWrap(true);
> +		descrArea.setWrapStyleWord(true);
> +		descrArea.setText(weblog.getDescription());
> +		popupMan.registerJTextComponent(descrArea);
> +
> +		
> +		//DateFormat.getAvailableLocales()
> +		localeCombo = new JComboBox(LOCS);
> +		//localeCombo = new JComboBox();
> +		localeCombo.setSelectedItem(weblog.getLocale());
> +		localeCombo.setRenderer(new ComboRenderer());
> +		localeCombo.addActionListener(new ActionListener()
> +		{
> +			public void actionPerformed(ActionEvent e)
> +			{
> +				String[] dateFormats = 
getDateFormats((Locale)localeCombo.getSelectedItem());
> +				replaceComboItem(dateFormatCombo,dateFormats);
> +				String[] timeFormats = 
getTimeFormats((Locale)localeCombo.getSelectedItem());
> +				replaceComboItem(timeFormatCombo,timeFormats);								
> +			}
> +		});
> +		
> +		dateFormatCombo = new JComboBox(getDateFormats(weblog.getLocale()));
> +		
dateFormatCombo.setSelectedItem(weblog.getPageGenerator().getDateFormat());
> +		dateFormatCombo.setRenderer(new ComboRenderer());
> +		
> +		timeFormatCombo = new JComboBox(getTimeFormats(weblog.getLocale()));
> +		
timeFormatCombo.setSelectedItem(weblog.getPageGenerator().getTimeFormat());
> +		timeFormatCombo.setRenderer(new ComboRenderer());
> +		
> +                typeCombo = new JComboBox(TYPE);
> +                typeCombo.setSelectedItem(weblog.getType());
> +                
> +		basePathField = new JTextField();
> +		basePathField.setText(weblog.getBasePath());
> +		popupMan.registerJTextComponent(basePathField);
> +		
> +		urlField = new JTextField();
> +		urlField.setText(weblog.getBaseUrl());
> +		popupMan.registerJTextComponent(urlField);
> +		
> +		arcUrlField = new JTextField();
> +		arcUrlField.setText(weblog.getArchiveUrl());
> +		popupMan.registerJTextComponent(arcUrlField);
> +		
> +		mediaUrlField = new JTextField();
> +		mediaUrlField.setText(weblog.getMediaUrl());
> +		popupMan.registerJTextComponent(mediaUrlField);
> +		
> +		setLayout(new BorderLayout(5, 5));
> +		setBorder(new EmptyBorder(5, 5, 5, 5));
> +		LabelledItemPanel lip1 = new LabelledItemPanel();
> +		lip1.setBorder(new TitledBorder(i18n.str("weblog"))); //$NON-NLS-1$
> +		lip1.addItem(i18n.str("site_title"), titleField); //$NON-NLS-1$
> +		//JPanel descPanel = new JPanel(new BorderLayout());
> +		//descPanel.add(new JScrollPane(descrArea), BorderLayout.CENTER);
> +		//lip1.addItem("Description", descPanel);
> +		lip1.addItem(i18n.str("description"), new 
JScrollPane(descrArea)); //$NON-NLS-1$
> +		lip1.addItem(i18n.str("language"), localeCombo); //$NON-NLS-1$
> +		lip1.addItem(i18n.str("date_format"), dateFormatCombo); //$NON-NLS-1$
> +		lip1.addItem(i18n.str("time_format"), timeFormatCombo); //$NON-NLS-1$
> +		lip1.addItem(i18n.str("type"), typeCombo);
> +                
> +		LabelledItemPanel lip2 = new LabelledItemPanel();
> +		lip2.setBorder(new TitledBorder(i18n.str("location"))); //$NON-NLS-1$
> +		lip2.addItem(i18n.str("base_path"), basePathField); //$NON-NLS-1$
> +		lip2.addItem(i18n.str("base_url"), urlField); //$NON-NLS-1$
> +		lip2.addItem(i18n.str("archive_url"), arcUrlField); //$NON-NLS-1$
> +		lip2.addItem(i18n.str("media_url"), mediaUrlField); //$NON-NLS-1$
> +		
> +		add(lip1, BorderLayout.CENTER);
> +		add(lip2, BorderLayout.SOUTH);
> +					 	
>      }
> -    private String[] getTimeFormats(Locale locale) {
> -        String s = i18n.str("TimeFormatOptions",locale);
> -        return tokenize(s);
> -    }
> -    private String[] tokenize(String s) {
> -        StringTokenizer st = new StringTokenizer(s,"|");
> -        String[] formats = new String[st.countTokens()];
> -        for (int i = 0; i < formats.length; i++) {
> -            formats[i] = st.nextToken();
> -        }
> -        return formats;
> -    }
> -        /*
> -        private static final String DATE_FORMATS[] =
> -        {
> -                "EEEE, MMMM dd, yyyy", //$NON-NLS-1$
> -                "EEE, MMM dd, yyyy", //$NON-NLS-1$
> -                "EEEE, dd MMMM, yyyy", //$NON-NLS-1$
> -                "EEEE dd MMMM yyyy", //$NON-NLS-1$
> -                "EEEE",
> -                "MMMM dd, yyyy", //$NON-NLS-1$
> -                "MMMM dd yyyy", //$NON-NLS-1$
> -         
> -                "MM/dd/yyyy",    		 //$NON-NLS-1$
> -                "MM/dd/yy", //$NON-NLS-1$
> -                "dd/MM/yyyy", //$NON-NLS-1$
> -                "dd/MM/yy", //$NON-NLS-1$
> -         
> -                "dd MMMM yyyy", //$NON-NLS-1$
> -                "dd MMMM", //$NON-NLS-1$
> -         
> -                "yyyy-MM-dd", //$NON-NLS-1$
> -                "yy-MM-dd", //$NON-NLS-1$
> -                "yy.MM.dd", //$NON-NLS-1$
> -                "yyyy.MM.dd", //$NON-NLS-1$
> -                "EEEE, MM/dd/yyyy", //$NON-NLS-1$
> -                "EEE, MM/dd/yyyy" //$NON-NLS-1$
> -        };
> -         
> -        private static final SimpleDateFormat GMT_TIME_FORMAT =
> -                new SimpleDateFormat("k:mm.ss z"); //$NON-NLS-1$
> -        private static final String TIME_FORMATS[] =
> -        {
> -                "h:mm a", //$NON-NLS-1$
> -                "h:mm.ss a", //$NON-NLS-1$
> -                "h:mm a z", //$NON-NLS-1$
> -                "h:mm.ss a z", //$NON-NLS-1$
> -                "h:mm a zzzz", //$NON-NLS-1$
> -                "h:mm.ss a zzzz", //$NON-NLS-1$
> -                "k:mm", //$NON-NLS-1$
> -                "k:mm.ss", //$NON-NLS-1$
> -                //GMT_TIME_FORMAT
> -        };
> -         */
> -    
> -    public TBGeneralPanel(TBWeblog blog) {
> -        weblog = blog;
> -        
> -        TextEditPopupManager popupMan = TextEditPopupManager.getInstance();
> -        titleField = new JTextField();
> -        titleField.setText(weblog.getTitle());
> -        popupMan.registerJTextComponent(titleField);
> -        
> -        descrArea = new JTextArea(3, 2);
> -        //descrArea.setMinimumSize(descrArea.getPreferredSize());
> -        descrArea.setLineWrap(true);
> -        descrArea.setWrapStyleWord(true);
> -        descrArea.setText(weblog.getDescription());
> -        popupMan.registerJTextComponent(descrArea);
> -        
> -        
> -        //DateFormat.getAvailableLocales()
> -        localeCombo = new JComboBox(LOCS);
> -        //localeCombo = new JComboBox();
> -        localeCombo.setSelectedItem(weblog.getLocale());
> -        localeCombo.setRenderer(new ComboRenderer());
> -        localeCombo.addActionListener(new ActionListener() {
> -            public void actionPerformed(ActionEvent e) {
> -                String[] dateFormats = 
getDateFormats((Locale)localeCombo.getSelectedItem());
> -                replaceComboItem(dateFormatCombo,dateFormats);
> -                String[] timeFormats = 
getTimeFormats((Locale)localeCombo.getSelectedItem());
> -                replaceComboItem(timeFormatCombo,timeFormats);
> -            }
> -        });
> -        
> -        dateFormatCombo = new 
JComboBox(getDateFormats(weblog.getLocale()));
> -        
dateFormatCombo.setSelectedItem(weblog.getPageGenerator().getDateFormat());
> -        dateFormatCombo.setRenderer(new ComboRenderer());
> -        
> -        timeFormatCombo = new 
JComboBox(getTimeFormats(weblog.getLocale()));
> -        
timeFormatCombo.setSelectedItem(weblog.getPageGenerator().getTimeFormat());
> -        timeFormatCombo.setRenderer(new ComboRenderer());
> -        
> -        typeCombo = new JComboBox(TYPE);
> -        typeCombo.setSelectedItem(weblog.getType());
> -        
> -        basePathField = new JTextField();
> -        basePathField.setText(weblog.getBasePath());
> -        popupMan.registerJTextComponent(basePathField);
> -        
> -        urlField = new JTextField();
> -        urlField.setText(weblog.getBaseUrl());
> -        popupMan.registerJTextComponent(urlField);
> -        
> -        arcUrlField = new JTextField();
> -        arcUrlField.setText(weblog.getArchiveUrl());
> -        popupMan.registerJTextComponent(arcUrlField);
> -        
> -        mediaUrlField = new JTextField();
> -        mediaUrlField.setText(weblog.getMediaUrl());
> -        popupMan.registerJTextComponent(mediaUrlField);
> -        
> -        setLayout(new BorderLayout(5, 5));
> -        setBorder(new EmptyBorder(5, 5, 5, 5));
> -        LabelledItemPanel lip1 = new LabelledItemPanel();
> -        lip1.setBorder(new TitledBorder(i18n.str("weblog"))); //$NON-NLS-1$
> -        lip1.addItem(i18n.str("site_title"), titleField); //$NON-NLS-1$
> -        //JPanel descPanel = new JPanel(new BorderLayout());
> -        //descPanel.add(new JScrollPane(descrArea), BorderLayout.CENTER);
> -        //lip1.addItem("Description", descPanel);
> -        lip1.addItem(i18n.str("description"), new 
JScrollPane(descrArea)); //$NON-NLS-1$
> -        lip1.addItem(i18n.str("language"), localeCombo); //$NON-NLS-1$
> -        lip1.addItem(i18n.str("date_format"), 
dateFormatCombo); //$NON-NLS-1$
> -        lip1.addItem(i18n.str("time_format"), 
timeFormatCombo); //$NON-NLS-1$
> -        lip1.addItem(i18n.str("type"), typeCombo);
> -        
> -        LabelledItemPanel lip2 = new LabelledItemPanel();
> -        lip2.setBorder(new 
TitledBorder(i18n.str("location"))); //$NON-NLS-1$
> -        lip2.addItem(i18n.str("base_path"), basePathField); //$NON-NLS-1$
> -        lip2.addItem(i18n.str("base_url"), urlField); //$NON-NLS-1$
> -        lip2.addItem(i18n.str("archive_url"), arcUrlField); //$NON-NLS-1$
> -        lip2.addItem(i18n.str("media_url"), mediaUrlField); //$NON-NLS-1$       
> -        
> -        add(lip1, BorderLayout.CENTER);
> -        add(lip2, BorderLayout.SOUTH);
> -        
> -    }
>      private void replaceComboItem(JComboBox combo, String[] items) {
> -        combo.removeAllItems();
> -        for (int i = 0; i < items.length; i++) {
> -            combo.addItem(items[i]);
> -        }
> -    }
> +    	combo.removeAllItems();
> +    	for (int i = 0; i < items.length; i++) {
> +    		combo.addItem(items[i]);
> +    	}
> +	}
>      
>      /* (non-Javadoc)
>       * @see 
net.sf.thingamablog.gui.properties.PropertyPanel#savePropertiesToWeblog()
>       */
> -    public void saveProperties() {
> -        weblog.setPublishAll(true);
> +    public void saveProperties()
> +    {
> +        weblog.setPublishAll(true);        
>          weblog.setBlogUrls(
> -                basePathField.getText(), urlField.getText(),
> -                arcUrlField.getText(), mediaUrlField.getText());
> +        	basePathField.getText(), urlField.getText(), 
> +        	arcUrlField.getText(), mediaUrlField.getText());
>          weblog.setLocale((Locale)localeCombo.getSelectedItem());
>          weblog.setTitle(titleField.getText());
>          weblog.setDescription(descrArea.getText());
>          
weblog.getPageGenerator().setDateFormat(dateFormatCombo.getSelectedItem().toString());
> -        
weblog.getPageGenerator().setTimeFormat(timeFormatCombo.getSelectedItem().toString());
> -        weblog.setType(typeCombo.getSelectedItem().toString());
> +		
weblog.getPageGenerator().setTimeFormat(timeFormatCombo.getSelectedItem().toString());
> +                weblog.setType(typeCombo.getSelectedItem().toString());
>      }
>      
> +
>      
> -    
> -    public boolean isValidData() {
> -        String base = urlField.getText();
> -        String arc = arcUrlField.getText();
> -        String media = mediaUrlField.getText();
> -        
> -        if(basePathField.getText() == null || 
basePathField.getText().equals("")) //$NON-NLS-1$
> -        {
> -            JOptionPane.showMessageDialog(this,
> -                    i18n.str("no_base_path_prompt"), //$NON-NLS-1$
> -                    i18n.str("warning"), 
JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$
> -            return false;
> -        }
> -        
> -        if(typeCombo.getSelectedItem().equals("internet") && 
(!isValidUrl(base) || !isValidUrl(arc) || !isValidUrl(media)))
> -            return false;
> -        
> -        if(typeCombo.getSelectedItem().equals("freenet") && 
(!isValidKey(base) || !isValidKey(arc) || !isValidKey(media)))
> -            return false;
> -        
> -        if(!arc.startsWith(base)) {
> -            JOptionPane.showMessageDialog(this,
> -                    i18n.str("bad_arc_url_prompt"), //$NON-NLS-1$
> -                    i18n.str("warning"), 
JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$
> -            
> -            return false;
> -        }
> -        
> -        if(!media.startsWith(base)) {
> -            JOptionPane.showMessageDialog(this,
> -                    i18n.str("bad_media_url_prompt"), //$NON-NLS-1$
> -                    i18n.str("warning"), 
JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$
> -            
> -            return false;
> -        }
> -        
> -        return true;
> +    public boolean isValidData()
> +    {
> +		String base = urlField.getText();
> +		String arc = arcUrlField.getText();
> +		String media = mediaUrlField.getText();
> +		
> +		if(basePathField.getText() == null || 
basePathField.getText().equals("")) //$NON-NLS-1$
> +		{		
> +			JOptionPane.showMessageDialog(this,
> +				i18n.str("no_base_path_prompt"), //$NON-NLS-1$
> +				i18n.str("warning"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$
> +				return false;
> +		}
> +		
> +		if(typeCombo.getSelectedItem().toString().equals("internet") && 
(!isValidUrl(base) || !isValidUrl(arc) || !isValidUrl(media)))
> +			return false;	
> +		
> +                if(typeCombo.getSelectedItem().toString().equals("freenet") 
&& (!isValidSSK(base)) || !isValidSSK(arc) || !isValidSSK(media))
> +                        return false;
> +                
> +		if(!arc.startsWith(base))
> +		{
> +			JOptionPane.showMessageDialog(this,
> +				i18n.str("bad_arc_url_prompt"), //$NON-NLS-1$
> +				i18n.str("warning"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$
> +			
> +			return false;	
> +		}
> +		
> +		if(!media.startsWith(base))
> +		{
> +			JOptionPane.showMessageDialog(this,
> +				i18n.str("bad_media_url_prompt"), //$NON-NLS-1$
> +				i18n.str("warning"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$
> +			
> +			return false;	
> +		}
> +		
> +		return true;
>      }
>      
> -    private boolean isValidUrl(String u) {
> -        try {
> -            new URL(u);
> -        } catch(Exception ex)//malformed url
> -        {
> -            JOptionPane.showMessageDialog(this,
> -                    u + i18n.str("invalid_url_prompt"), //$NON-NLS-1$
> -                    i18n.str("warning"), 
JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$
> -            return false;
> -        }
> -        return true;
> +    private boolean isValidUrl(String u)
> +    {
> +    	try
> +    	{
> +    		new URL(u);
> +    	}
> +    	catch(Exception ex)//malformed url
> +    	{
> +			JOptionPane.showMessageDialog(this,
> +				u + i18n.str("invalid_url_prompt"), //$NON-NLS-1$
> +				i18n.str("warning"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$
> +    		return false;
> +    	}
> +    	return true;    	
>      }
>      
> -    private boolean isValidKey(String key) {
> -        // TODO : Check if the key match a USK key
> +    private boolean isValidSSK(String u)
> +    {
> +        // TODO : Check if u match a SSK key
>          return true;
>      }
> +
>      
> -    private class ComboRenderer extends DefaultListCellRenderer {
> -        /**
> -         *
> +	private class ComboRenderer extends DefaultListCellRenderer
> +	{
> +		/**
> +         * 
>           */
>          private static final long serialVersionUID = 1L;
>          private Date date = new Date();
> -        
> -        public Component getListCellRendererComponent(JList list,
> -                Object value, int index, boolean isSelected, boolean 
cellHasFocus) {
> -            if(value instanceof Locale) {
> -                Locale loc = (Locale)value;
> -                value = loc.getDisplayName();
> -            } else {
> -                Locale loc = (Locale)localeCombo.getSelectedItem();
> -                SimpleDateFormat df = new 
SimpleDateFormat(value.toString(),loc);
> -                value = df.format(date);
> -            }
> -            
> -            return super.getListCellRendererComponent(
> -                    list, value, index, isSelected, cellHasFocus);
> -        }
> -    }
> -    
> +		
> +		public Component getListCellRendererComponent(JList list,
> +			Object value, int index, boolean isSelected, boolean cellHasFocus)
> +		{
> +			if(value instanceof Locale)
> +			{
> +				Locale loc = (Locale)value;
> +				value = loc.getDisplayName();
> +			}
> +			else 
> +			{
> +				Locale loc = (Locale)localeCombo.getSelectedItem();
> +				SimpleDateFormat df = new SimpleDateFormat(value.toString(),loc);
> +				value = df.format(date);				
> +			}
> +			
> +			return super.getListCellRendererComponent(
> +				list, value, index, isSelected, cellHasFocus);
> +		}
> +	}
> +
>  }
> 
> Modified: 
trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBWizardDialog.java
> ===================================================================
> --- 
trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBWizardDialog.java	
2008-02-09 20:27:58 UTC (rev 17769)
> +++ 
trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBWizardDialog.java	
2008-02-10 03:51:06 UTC (rev 17770)
> @@ -52,200 +52,216 @@
>  /**
>   * @author Bob Tantlinger
>   *
> - *
> - *
> + * 
> + * 
>   */
> -public class TBWizardDialog extends JDialog {
> +public class TBWizardDialog extends JDialog
> +{
>      /**
> -     *
> +     * 
>       */
>      private static final long serialVersionUID = 1L;
> -    
> +
>      private static final I18n i18n = 
I18n.getInstance("net.sf.thingamablog.gui.properties"); //$NON-NLS-1$
>      
>      private static final String CANCEL = i18n.str("cancel"); //$NON-NLS-1$
> -    private static final String FINISH = i18n.str("finish");	 //$NON-NLS-1$
> -    
> -    private CardLayout wizLayout;
> -    private JPanel wizPanel;
> -    
> -    private PropertyPanel starterPanel;
> -    private TitleDescrPanel titlePanel;
> -    private CategoriesPanel catPanel;
> -    private AuthorsPanel authPanel;
> +	private static final String FINISH = i18n.str("finish");	 //$NON-NLS-1$
> +	
> +	private CardLayout wizLayout;
> +	private JPanel wizPanel;
> +	
> +	private PropertyPanel starterPanel;
> +	private TitleDescrPanel titlePanel;
> +	private CategoriesPanel catPanel;
> +	private AuthorsPanel authPanel;
>      private PropertyPanel emailPanel;
> -    private PropertyPanel templPanel;
> -    private PropertyPanel transportPanel;
> -    private PropertyPanel donePanel;
> -    private Vector panels = new Vector();
> +	private PropertyPanel templPanel;
> +	private PropertyPanel transportPanel;
> +	private PropertyPanel donePanel;
> +	private Vector panels = new Vector();	
> +		
> +	private JButton nextButton, backButton, doneButton;
> +	
> +	private boolean isCancelled;
> +	
> +	private TBWeblog weblog;
>      
> -    private JButton nextButton, backButton, doneButton;
> +	private TextEditPopupManager popupManager = 
TextEditPopupManager.getInstance();
>      
> -    private boolean isCancelled;
> -    
> -    private TBWeblog weblog;
> -    
> -    private TextEditPopupManager popupManager = 
TextEditPopupManager.getInstance();
> -    
>      private TemplatePack selectedPack;
> -    
> -    public TBWizardDialog(Frame f, File dir, WeblogBackend backend) {
> -        super(f, true);
> -        setTitle(i18n.str("new_weblog")); //$NON-NLS-1$
> +	
> +	public TBWizardDialog(Frame f, File dir, WeblogBackend backend)
> +	{
> +		super(f, true);
> +		setTitle(i18n.str("new_weblog")); //$NON-NLS-1$
> +		
> +		WindowAdapter windowAdapter = new WindowAdapter()
> +		{
> +			public void windowClosing(WindowEvent windowEvent)
> +			{
> +				cancelDialog();
> +			}
> +		};
> +		addWindowListener(windowAdapter);
> +		
> +		weblog = new TBWeblog(dir);
> +		weblog.setBackend(backend);
> +		weblog.setPublishTransport(new 
net.sf.thingamablog.transport.FTPTransport());
> +		//weblog.setAuthorStore(authStore);
> +		//weblog.setCategoryStore(catStore);
> +		
> +		wizLayout = new CardLayout();
> +		wizPanel = new JPanel(wizLayout);
> +		
> +		starterPanel = new StarterPanel();
> +		starterPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
> +		panels.add(starterPanel);
> +		
> +		titlePanel = new TitleDescrPanel();
> +		titlePanel.setBorder(new EmptyBorder(10, 10, 10, 10));
> +		panels.add(titlePanel);
> +		
> +		catPanel = new CategoriesPanel();
> +		catPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
> +		panels.add(catPanel);
> +		
> +		authPanel = new AuthorsPanel();
> +		authPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
> +		panels.add(authPanel);
>          
> -        WindowAdapter windowAdapter = new WindowAdapter() {
> -            public void windowClosing(WindowEvent windowEvent) {
> -                cancelDialog();
> -            }
> -        };
> -        addWindowListener(windowAdapter);
> -        
> -        weblog = new TBWeblog(dir);
> -        weblog.setBackend(backend);
> -        weblog.setPublishTransport(new 
net.sf.thingamablog.transport.FTPTransport());
> -        //weblog.setAuthorStore(authStore);
> -        //weblog.setCategoryStore(catStore);
> -        
> -        wizLayout = new CardLayout();
> -        wizPanel = new JPanel(wizLayout);
> -        
> -        starterPanel = new StarterPanel();
> -        starterPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
> -        panels.add(starterPanel);
> -        
> -        titlePanel = new TitleDescrPanel();
> -        titlePanel.setBorder(new EmptyBorder(10, 10, 10, 10));
> -        panels.add(titlePanel);
> -        
> -        catPanel = new CategoriesPanel();
> -        catPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
> -        panels.add(catPanel);
> -        
> -        authPanel = new AuthorsPanel();
> -        authPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
> -        panels.add(authPanel);
> -        
>          emailPanel = new EmailPanel();
>          emailPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
>          panels.add(emailPanel);
> -        
> -        templPanel = new TemplatePanel();
> -        templPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
> -        panels.add(templPanel);
> -        
> -        transportPanel = new TransportPanel();
> -        transportPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
> -        panels.add(transportPanel);
> -        
> -        donePanel = new DonePanel();
> -        donePanel.setBorder(new EmptyBorder(10, 10, 10, 10));
> -        panels.add(donePanel);
> -        
> -        wizPanel.add(starterPanel, "1"); //$NON-NLS-1$
> -        wizPanel.add(titlePanel, "2"); //$NON-NLS-1$
> -        wizPanel.add(catPanel, "3"); //$NON-NLS-1$
> -        wizPanel.add(authPanel, "4"); //$NON-NLS-1$
> +		
> +		templPanel = new TemplatePanel();
> +		templPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
> +		panels.add(templPanel);
> +		
> +		transportPanel = new TransportPanel();
> +		transportPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
> +		panels.add(transportPanel);
> +		
> +		donePanel = new DonePanel();
> +		donePanel.setBorder(new EmptyBorder(10, 10, 10, 10));
> +		panels.add(donePanel);
> +		
> +		wizPanel.add(starterPanel, "1"); //$NON-NLS-1$
> +		wizPanel.add(titlePanel, "2"); //$NON-NLS-1$
> +		wizPanel.add(catPanel, "3"); //$NON-NLS-1$
> +		wizPanel.add(authPanel, "4"); //$NON-NLS-1$
>          wizPanel.add(emailPanel, "5"); //$NON-NLS-1$
> -        wizPanel.add(templPanel, "6"); //$NON-NLS-1$
> -        wizPanel.add(transportPanel, "7"); //$NON-NLS-1$
> -        wizPanel.add(donePanel, "8");	 //$NON-NLS-1$
> -        
> -        ActionListener listener = new ButtonHandler();
> -        nextButton = new JButton(i18n.str("next-")); //$NON-NLS-1$
> -        nextButton.addActionListener(listener);
> -        backButton = new JButton(i18n.str("-back")); //$NON-NLS-1$
> -        backButton.setEnabled(false);
> -        backButton.addActionListener(listener);
> -        doneButton = new JButton(CANCEL);
> -        doneButton.addActionListener(listener);
> -        
> -        JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
> -        controlPanel.setBorder(new EtchedBorder());
> -        JPanel buttonPanel = new JPanel(new GridLayout(1, 3, 5, 5));
> -        buttonPanel.add(backButton);
> -        buttonPanel.add(nextButton);
> -        buttonPanel.add(doneButton);
> -        controlPanel.add(buttonPanel);
> -        
> -        JLabel img = new JLabel();
> -        img.setVerticalAlignment(SwingConstants.TOP);
> -        img.setOpaque(true);
> -        img.setBackground(Color.WHITE);
> -        
img.setIcon(UIUtils.getIcon(UIUtils.MISC, "wizard.jpg")); //$NON-NLS-1$
> -        
> -        getContentPane().add(wizPanel, BorderLayout.CENTER);
> -        getContentPane().add(controlPanel, BorderLayout.SOUTH);
> -        getContentPane().add(img, BorderLayout.WEST);
> -        
> -        pack();
> +		wizPanel.add(templPanel, "6"); //$NON-NLS-1$
> +		wizPanel.add(transportPanel, "7"); //$NON-NLS-1$
> +		wizPanel.add(donePanel, "8");	 //$NON-NLS-1$
> +		
> +		ActionListener listener = new ButtonHandler();
> +		nextButton = new JButton(i18n.str("next-")); //$NON-NLS-1$
> +		nextButton.addActionListener(listener);
> +		backButton = new JButton(i18n.str("-back")); //$NON-NLS-1$
> +		backButton.setEnabled(false);
> +		backButton.addActionListener(listener);
> +		doneButton = new JButton(CANCEL);
> +		doneButton.addActionListener(listener);
> +		
> +		JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
> +		controlPanel.setBorder(new EtchedBorder());
> +		JPanel buttonPanel = new JPanel(new GridLayout(1, 3, 5, 5));		
> +		buttonPanel.add(backButton);
> +		buttonPanel.add(nextButton);
> +		buttonPanel.add(doneButton);
> +		controlPanel.add(buttonPanel);
> +		
> +		JLabel img = new JLabel();
> +		img.setVerticalAlignment(SwingConstants.TOP);
> +		img.setOpaque(true);
> +		img.setBackground(Color.WHITE);
> +		img.setIcon(UIUtils.getIcon(UIUtils.MISC, "wizard.jpg")); //$NON-NLS-1$
> +		
> +		getContentPane().add(wizPanel, BorderLayout.CENTER);
> +		getContentPane().add(controlPanel, BorderLayout.SOUTH);
> +		getContentPane().add(img, BorderLayout.WEST);
> +		
> +		pack();
>          setSize(560, getHeight());
> -        setResizable(false);
> -    }
> -    
> -    public TBWeblog getWeblog() {
> -        return weblog;
> -    }
> -    
> -    public boolean hasUserCancelled() {
> -        return isCancelled;
> -    }
> -    
> -    private void doFinish() {
> -                /*for(int i = 0; i < panels.size(); i++)
> -                {
> -                        PropertyPanel p = 
(PropertyPanel)panels.elementAt(i);
> -                        p.saveProperties();
> -                }*/
> +		setResizable(false);
> +	}
> +	
> +	public TBWeblog getWeblog()
> +	{
> +		return weblog;
> +	}
> +	
> +	public boolean hasUserCancelled()
> +	{
> +		return isCancelled;
> +	}
> +	
> +	private void doFinish()
> +	{		
> +		/*for(int i = 0; i < panels.size(); i++)
> +		{
> +			PropertyPanel p = (PropertyPanel)panels.elementAt(i);
> +			p.saveProperties();
> +		}*/
>          
> -        try {
> +        try
> +        {
>              selectedPack.installPack(weblog.getHomeDirectory());
> -        } catch(Exception ex) {
> +        }
> +        catch(Exception ex)
> +        {
>              UIUtils.showError(this, ex);
>          }
> +		
> +		//add a couple ping services
> +		WeblogsDotComPing ping = new WeblogsDotComPing();
>          
> -        //add a couple ping services
> -        WeblogsDotComPing ping = new WeblogsDotComPing();
> -        
>          //removed because the TAMB ping server has been shutdown...
> -                /*ping.setServiceName("Updated Thingamablogs");
> -                
ping.setServiceUrl("http://thingamablog.sourceforge.net/rpc.php");
> -                ping.setEnabled(true);
> -                weblog.addPingService(ping);*/
> -        
> -        ping = new WeblogsDotComPing();
> -        ping.setServiceName("weblogs.com"); //$NON-NLS-1$
> -        ping.setServiceUrl("http://rpc.weblogs.com/RPC2"); //$NON-NLS-1$
> -        ping.setEnabled(false);
> -        weblog.addPingService(ping);
> -        
> -        dispose();
> -    }
> +		/*ping.setServiceName("Updated Thingamablogs");
> +		ping.setServiceUrl("http://thingamablog.sourceforge.net/rpc.php");
> +		ping.setEnabled(true);		
> +		weblog.addPingService(ping);*/
> +		
> +		ping = new WeblogsDotComPing();
> +		ping.setServiceName("weblogs.com"); //$NON-NLS-1$
> +		ping.setServiceUrl("http://rpc.weblogs.com/RPC2"); //$NON-NLS-1$
> +		ping.setEnabled(false);
> +		weblog.addPingService(ping);	
> +		
> +		dispose();
> +	}
> +	
> +	private void cancelDialog()
> +	{
> +		isCancelled = true;
> +		try{
> +			weblog.deleteAll();
> +		}catch(BackendException ex){}
> +		dispose();		
> +	}
>      
> -    private void cancelDialog() {
> -        isCancelled = true;
> -        try{
> -            weblog.deleteAll();
> -        }catch(BackendException ex){}
> -        dispose();
> -    }
> -    
> -    public void dispose() {
> -        WeblogPreviewer.getInstance().clearPreviewData();
> +    public void dispose()
> +    {       
> +        WeblogPreviewer.getInstance().clearPreviewData();        
>          super.dispose();
>      }
>      
> +
> +	private JLabel createHeaderLabel(String text)
> +	{
> +		JLabel label = new JLabel("<html><h2>" + text 
+ "</h2></html>"); //$NON-NLS-1$ //$NON-NLS-2$
> +		return label;
> +	}
>      
> -    private JLabel createHeaderLabel(String text) {
> -        JLabel label = new JLabel("<html><h2>" + text 
+ "</h2></html>"); //$NON-NLS-1$ //$NON-NLS-2$
> -        return label;
> -    }
> +	
>      
> -    
> -    
> -    private PropertyPanel getCurrentPanel() {
> -        for(int i = 0; i < panels.size(); i++) {
> +    private PropertyPanel getCurrentPanel()
> +    {
> +        for(int i = 0; i < panels.size(); i++)
> +        {
>              PropertyPanel p = (PropertyPanel)panels.elementAt(i);
> -            if(p.isVisible()) {
> +            if(p.isVisible())
> +            {
>                  //return p.isValidData();
>                  return p;
>              }
> @@ -253,224 +269,260 @@
>          
>          return null;
>      }
> -    
> -    private class ButtonHandler implements ActionListener {
> -        public void actionPerformed(ActionEvent e) {
> -            if(e.getSource() == nextButton) {
> -                if(!donePanel.isVisible()) {
> -                    //if(isCurrentPanelValid())
> +	
> +	private class ButtonHandler implements ActionListener
> +	{
> +		public void actionPerformed(ActionEvent e)
> +		{
> +			if(e.getSource() == nextButton)
> +			{
> +				if(!donePanel.isVisible())
> +				{				
> +					//if(isCurrentPanelValid())
>                      PropertyPanel p = getCurrentPanel();
> -                    if(p != null && p.isValidData()) {
> -                        p.saveProperties();
> +                    if(p != null && p.isValidData())
> +                    {
> +						p.saveProperties();
>                          wizLayout.next(wizPanel);
>                          
>                      }
> -                }
> -                
> -                if(donePanel.isVisible()) {
> -                    doneButton.setText(FINISH);
> -                    nextButton.setEnabled(false);
> -                }
> -                backButton.setEnabled(true);
> -            } else if(e.getSource() == backButton) {
> -                if(!starterPanel.isVisible())
> -                    wizLayout.previous(wizPanel);
> -                if(starterPanel.isVisible())
> -                    backButton.setEnabled(false);
> -                if(doneButton.getText().equals(FINISH))
> -                    doneButton.setText(CANCEL);
> -                nextButton.setEnabled(true);
> -            } else if(e.getSource() == doneButton) {
> -                //the new Weblog was canceled, so delete the
> -                //directory structure that was created when
> -                //the Weblog was instantiated
> -                if(doneButton.getText().equals(FINISH)) {
> -                    doFinish();
> -                } else {
> -                    cancelDialog();
> -                }
> -            }
> -        }
> -    }
> -    
> -    
> -    
> -    
> -    private class StarterPanel extends PropertyPanel {
> -        /**
> -         *
> +				}
> +														
> +				if(donePanel.isVisible())
> +				{
> +					doneButton.setText(FINISH);
> +					nextButton.setEnabled(false);
> +				}
> +				backButton.setEnabled(true);
> +			}
> +			else if(e.getSource() == backButton)
> +			{
> +				if(!starterPanel.isVisible())
> +					wizLayout.previous(wizPanel);				
> +				if(starterPanel.isVisible())
> +					backButton.setEnabled(false);				
> +				if(doneButton.getText().equals(FINISH))
> +					doneButton.setText(CANCEL);
> +				nextButton.setEnabled(true);
> +			}
> +			else if(e.getSource() == doneButton)
> +			{
> +				//the new Weblog was canceled, so delete the 
> +				//directory structure that was created when
> +				//the Weblog was instantiated
> +				if(doneButton.getText().equals(FINISH))
> +				{
> +					doFinish();				
> +				}
> +				else
> +				{
> +					cancelDialog();	
> +				}								
> +			}
> +		}
> +	}
> +	
> +
> +
> +	
> +	private class StarterPanel extends PropertyPanel
> +	{
> +		/**
> +         * 
>           */
>          private static final long serialVersionUID = 1L;
>          private JTextField pathField = new JTextField(20);
> -        private JTextField urlField = new JTextField(20);
> -        private String TYPE[] = {"internet","freenet"};
> -        private JComboBox typeCombo = new JComboBox(TYPE);
> -        
> -        public StarterPanel() {
> -            JLabel header = 
createHeaderLabel(i18n.str("weblog_wizard"));			 //$NON-NLS-1$
> -            String text =
> -                    i18n.str("welcome_panel_text"); //$NON-NLS-1$
> -            
> -            
> -            LabelledItemPanel lip = new LabelledItemPanel();
> -            lip.addItem(i18n.str("base_path"), pathField); //$NON-NLS-1$
> -            lip.addItem(i18n.str("base_url"), urlField); //$NON-NLS-1$
> -            lip.addItem(i18n.str("type"), typeCombo);
> -            
> -            popupManager.registerJTextComponent(pathField);
> -            popupManager.registerJTextComponent(urlField);
> -            
> -            setLayout(new BorderLayout());
> -            add(header, BorderLayout.NORTH);
> -            add(new MultilineText(text), BorderLayout.CENTER);
> -            add(lip, BorderLayout.SOUTH);
> -        }
> -        
> -        public boolean isValidData() {
> +		private JTextField urlField = new JTextField(20);
> +                private String TYPE[]={"internet","freenet"};
> +                private JComboBox typeCombo = new JComboBox(TYPE);
> +		
> +		public StarterPanel()
> +		{			
> +			JLabel header = 
createHeaderLabel(i18n.str("weblog_wizard"));			 //$NON-NLS-1$
> +			String text =
> +			i18n.str("welcome_panel_text"); //$NON-NLS-1$
> +			
> +			
> +			LabelledItemPanel lip = new LabelledItemPanel();
> +			lip.addItem(i18n.str("base_path"), pathField); //$NON-NLS-1$
> +			lip.addItem(i18n.str("base_url"), urlField); //$NON-NLS-1$
> +			lip.addItem(i18n.str("type"), typeCombo);
> +                        
> +			popupManager.registerJTextComponent(pathField);
> +			popupManager.registerJTextComponent(urlField);
> +			
> +			setLayout(new BorderLayout());	
> +			add(header, BorderLayout.NORTH);
> +			add(new MultilineText(text), BorderLayout.CENTER);
> +			add(lip, BorderLayout.SOUTH);			
> +		}
> +		
> +		public boolean isValidData()
> +		{
>              if(pathField.getText().equals("")) //$NON-NLS-1$
>              {
>                  JOptionPane.showMessageDialog(TBWizardDialog.this,
> -                        i18n.str("invalid_path_prompt"), 
i18n.str("invalid_path"),  //$NON-NLS-1$ //$NON-NLS-2$
> -                        JOptionPane.WARNING_MESSAGE);
> +                    i18n.str("invalid_path_prompt"), 
i18n.str("invalid_path"),  //$NON-NLS-1$ //$NON-NLS-2$
> +                    JOptionPane.WARNING_MESSAGE);
>                  return false;
>              }
>              
>              if(urlField.getText().equals("")) //$NON-NLS-1$
>              {
>                  JOptionPane.showMessageDialog(TBWizardDialog.this,
> -                        i18n.str("invalid_url_prompt"), 
i18n.str("invalid_url"),  //$NON-NLS-1$ //$NON-NLS-2$
> -                        JOptionPane.WARNING_MESSAGE);
> +                    i18n.str("invalid_url_prompt"), 
i18n.str("invalid_url"),  //$NON-NLS-1$ //$NON-NLS-2$
> +                    JOptionPane.WARNING_MESSAGE);
>                  return false;
>              }
> -            
> -            if(typeCombo.getSelectedItem().toString().equals("internet")) {
> -                try {
> -                    new URL(urlField.getText());
> -                } catch(MalformedURLException ex) //invalid url
> +            if (typeCombo.getSelectedItem().toString().equals("internet")) 
{
> +            try
> +			{
> +				new URL(urlField.getText());				
> +			}
> +			catch(MalformedURLException ex) //invalid url
> +			{
> +                            
> +				// Display a warning message instead of just put http:// at the 
beginning of the url, in case the user enter a USK key and didn't use the 
type combobox                                                                                           
> +				urlField.setText("http://" + urlField.getText()); //$NON-NLS-1$
> +                                
JOptionPane.showMessageDialog(TBWizardDialog.this,
> +                                    i18n.str("invalid_url_prompt"), 
i18n.str("invalid_url"),  //$NON-NLS-1$ //$NON-NLS-2$
> +                                    JOptionPane.WARNING_MESSAGE);
> +                                return false;
> +			}			
> +            }		
> +            if (typeCombo.getSelectedItem().toString().equals("freenet"))
> +                        return isValidSSK(urlField.getText());
> +			
> +            return true;		
> +            }
> +        	private boolean isValidSSK(String u)
>                  {
> -                    urlField.setText("http://" + 
urlField.getText()); //$NON-NLS-1$
> +                    // TODO : Check if u match a SSK key                    
> +                    return true;
>                  }
> -            } else {
> -                return isValidKey(urlField.getText());
> -            }
> -            
> -            return true;
> -        }
> -        
> -        public Boolean isValidKey(String key){
> -            // TODO : Check if the key match a USK key
> -            return true;
> -        }
> -        
> -        public void saveProperties() {
> -            String path = pathField.getText();
> -            String url = urlField.getText();
> -            if(!url.endsWith("/")) //$NON-NLS-1$
> -                url += "/";; //$NON-NLS-1$
> -                
> -                String arcUrl = url + "archives"; //$NON-NLS-1$
> -                String mediaUrl = url + "media"; //$NON-NLS-1$
> -                
> -                weblog.setBlogUrls(path, url, arcUrl, mediaUrl);
> -                weblog.setType(typeCombo.getSelectedItem().toString());
> -        }
> -    }
> -    
> -    private class TitleDescrPanel extends PropertyPanel {
> -        /**
> -         *
> +		public void saveProperties()
> +		{
> +			String path = pathField.getText();
> +			String url = urlField.getText();
> +			if(!url.endsWith("/")) //$NON-NLS-1$
> +				url += "/";; //$NON-NLS-1$
> +			String arcUrl = url + "archives"; //$NON-NLS-1$
> +			String mediaUrl = url + "media"; //$NON-NLS-1$
> +			
> +			weblog.setBlogUrls(path, url, arcUrl, mediaUrl);
> +                        
weblog.setType(typeCombo.getSelectedItem().toString());
> +		}
> +	}
> +	
> +	private class TitleDescrPanel extends PropertyPanel
> +	{
> +		/**
> +         * 
>           */
>          private static final long serialVersionUID = 1L;
>          private JTextField titleField = new JTextField();
> -        private JTextArea textArea = new JTextArea(4, 4);
> +		private JTextArea textArea = new JTextArea(4, 4);
> +		
> +		public TitleDescrPanel()
> +		{
> +			setLayout(new BorderLayout());
> +			
> +			JPanel instrPanel = new JPanel(new BorderLayout());
> +			JLabel header = 
createHeaderLabel(i18n.str("title_and_description")); //$NON-NLS-1$
> +			String text =
> +			i18n.str("title_panel_text"); //$NON-NLS-1$
> +			instrPanel.add(header, BorderLayout.NORTH);
> +			instrPanel.add(new MultilineText(text), BorderLayout.CENTER);
> +			
> +			popupManager.registerJTextComponent(titleField);
> +			popupManager.registerJTextComponent(textArea);
> +			
> +			LabelledItemPanel lip = new LabelledItemPanel();
> +			lip.addItem(i18n.str("site_title"), titleField); //$NON-NLS-1$
> +			lip.addItem(i18n.str("description"), new 
JScrollPane(textArea)); //$NON-NLS-1$
> +			
> +			add(instrPanel, BorderLayout.NORTH);
> +			add(lip, BorderLayout.CENTER);						
> +		}
> +		
> +		public boolean isValidData()
> +		{			
> +			if(titleField.getText().equals("")) //$NON-NLS-1$
> +			{
> +				JOptionPane.showMessageDialog(TBWizardDialog.this, 
> +					i18n.str("invalid_title_prompt"), i18n.str("title"), 
JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$ //$NON-NLS-2$
> +				return false;
> +			}
> +			return true;	
> +		}
> +		
> +		public void saveProperties()
> +		{
> +			weblog.setTitle(titleField.getText());
> +			weblog.setDescription(textArea.getText());
> +		}	
>          
> -        public TitleDescrPanel() {
> -            setLayout(new BorderLayout());
> -            
> -            JPanel instrPanel = new JPanel(new BorderLayout());
> -            JLabel header = 
createHeaderLabel(i18n.str("title_and_description")); //$NON-NLS-1$
> -            String text =
> -                    i18n.str("title_panel_text"); //$NON-NLS-1$
> -            instrPanel.add(header, BorderLayout.NORTH);
> -            instrPanel.add(new MultilineText(text), BorderLayout.CENTER);
> -            
> -            popupManager.registerJTextComponent(titleField);
> -            popupManager.registerJTextComponent(textArea);
> -            
> -            LabelledItemPanel lip = new LabelledItemPanel();
> -            lip.addItem(i18n.str("site_title"), titleField); //$NON-NLS-1$
> -            lip.addItem(i18n.str("description"), new 
JScrollPane(textArea)); //$NON-NLS-1$
> -            
> -            add(instrPanel, BorderLayout.NORTH);
> -            add(lip, BorderLayout.CENTER);
> -        }
> -        
> -        public boolean isValidData() {
> -            if(titleField.getText().equals("")) //$NON-NLS-1$
> -            {
> -                JOptionPane.showMessageDialog(TBWizardDialog.this,
> -                        i18n.str("invalid_title_prompt"), 
i18n.str("title"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$ //$NON-NLS-2$
> -                return false;
> -            }
> -            return true;
> -        }
> -        
> -        public void saveProperties() {
> -            weblog.setTitle(titleField.getText());
> -            weblog.setDescription(textArea.getText());
> -        }
> -        
> -        public String getTitle() {
> +        public String getTitle()
> +        {
>              return titleField.getText();
>          }
>          
> -        public String getDescription() {
> +        public String getDescription()
> +        {
>              return textArea.getText();
>          }
> -    }
> -    
> -    private class CategoriesPanel extends PropertyPanel {
> -        /**
> -         *
> +	}
> +	
> +	private class CategoriesPanel extends PropertyPanel
> +	{
> +		/**
> +         * 
>           */
>          private static final long serialVersionUID = 1L;
>          private EditableList list;
> -        private WeblogEditableListModel model;
> -        
> -        public CategoriesPanel() {
> -            setLayout(new BorderLayout(5, 5));
> +		private WeblogEditableListModel model;
> +		
> +		public CategoriesPanel()
> +		{
> +			setLayout(new BorderLayout(5, 5));
> +			
> +			JPanel instrPanel = new JPanel(new BorderLayout());
> +			JLabel header = createHeaderLabel(i18n.str("categories")); //$NON-NLS-1$
> +			String text =
> +			i18n.str("categories_panel_text"); //$NON-NLS-1$
> +			instrPanel.add(header, BorderLayout.NORTH);
> +			instrPanel.add(new MultilineText(text), BorderLayout.CENTER);
> +			
> +			model = new WeblogEditableListModel(WeblogEditableListModel.CATEGORIES);
> +			list = new EditableList(model);
> +			setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
> +			
> +			add(instrPanel, BorderLayout.NORTH);
> +			add(list, BorderLayout.CENTER);	
>              
> -            JPanel instrPanel = new JPanel(new BorderLayout());
> -            JLabel header = 
createHeaderLabel(i18n.str("categories")); //$NON-NLS-1$
> -            String text =
> -                    i18n.str("categories_panel_text"); //$NON-NLS-1$
> -            instrPanel.add(header, BorderLayout.NORTH);
> -            instrPanel.add(new MultilineText(text), BorderLayout.CENTER);
>              
> -            model = new 
WeblogEditableListModel(WeblogEditableListModel.CATEGORIES);
> -            list = new EditableList(model);
> -            setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
> -            
> -            add(instrPanel, BorderLayout.NORTH);
> -            add(list, BorderLayout.CENTER);
> -            
> -            
> -        }
> +		}
> +		
> +		public boolean isValidData()
> +		{			
> +			return true;
> +		}
> +		
> +		public void saveProperties()
> +		{
> +			//ListModel lm = catList.getModel();			
> +			try
> +			{
> +				model.syncListWithWeblog(weblog);
> +			}
> +			catch(Exception ex)
> +			{
> +				ex.printStackTrace();
> +			}
> +		}
>          
> -        public boolean isValidData() {
> -            return true;
> -        }
> -        
> -        public void saveProperties() {
> -            //ListModel lm = catList.getModel();
> -            try {
> -                model.syncListWithWeblog(weblog);
> -            } catch(Exception ex) {
> -                ex.printStackTrace();
> -            }
> -        }
> -        
> -        public String[] getCategories() {
> +        public String[] getCategories()
> +        {
>              List data = list.getListData();
>              String[] cats = new String[data.size()];
>              for(int i = 0; i < cats.length; i++)
> @@ -478,50 +530,59 @@
>              return cats;
>          }
>          
> -        public WeblogEditableListModel getModel() {
> +        public WeblogEditableListModel getModel()
> +        {
>              return model;
>          }
> -    }
> -    
> -    private class AuthorsPanel extends PropertyPanel {
> -        /**
> -         *
> +	}
> +	
> +	private class AuthorsPanel extends PropertyPanel
> +	{
> +		/**
> +         * 
>           */
>          private static final long serialVersionUID = 1L;
>          private EditableList list;
> -        private WeblogEditableListModel model;
> +		private WeblogEditableListModel model;
> +		
> +		public AuthorsPanel()
> +		{
> +			setLayout(new BorderLayout(5, 5));
> +			
> +			JPanel instrPanel = new JPanel(new BorderLayout());
> +			JLabel header = createHeaderLabel(i18n.str("authors")); //$NON-NLS-1$
> +			String text =
> +			i18n.str("authors_panel_text"); //$NON-NLS-1$
> +			instrPanel.add(header, BorderLayout.NORTH);
> +			instrPanel.add(new MultilineText(text), BorderLayout.CENTER);
> +			
> +			model = new WeblogEditableListModel(WeblogEditableListModel.AUTHORS);
> +			list = new EditableList(model);
> +			setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
> +			
> +			add(instrPanel, BorderLayout.NORTH);
> +			add(list, BorderLayout.CENTER);										
> +		}
> +		
> +		public boolean isValidData()
> +		{			
> +			return true;
> +		}
> +		
> +		public void saveProperties()
> +		{
> +			try
> +			{
> +				model.syncListWithWeblog(weblog);
> +			}
> +			catch(Exception ex)
> +			{
> +				ex.printStackTrace();
> +			}
> +		}
>          
> -        public AuthorsPanel() {
> -            setLayout(new BorderLayout(5, 5));
> -            
> -            JPanel instrPanel = new JPanel(new BorderLayout());
> -            JLabel header = 
createHeaderLabel(i18n.str("authors")); //$NON-NLS-1$
> -            String text =
> -                    i18n.str("authors_panel_text"); //$NON-NLS-1$
> -            instrPanel.add(header, BorderLayout.NORTH);
> -            instrPanel.add(new MultilineText(text), BorderLayout.CENTER);
> -            
> -            model = new 
WeblogEditableListModel(WeblogEditableListModel.AUTHORS);
> -            list = new EditableList(model);
> -            setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
> -            
> -            add(instrPanel, BorderLayout.NORTH);
> -            add(list, BorderLayout.CENTER);
> -        }
> -        
> -        public boolean isValidData() {
> -            return true;
> -        }
> -        
> -        public void saveProperties() {
> -            try {
> -                model.syncListWithWeblog(weblog);
> -            } catch(Exception ex) {
> -                ex.printStackTrace();
> -            }
> -        }
> -        
> -        public Author[] getAuthors() {
> +        public Author[] getAuthors()
> +        {
>              List data = list.getListData();
>              Author[] a = new Author[data.size()];
>              for(int i = 0; i < a.length; i++)
> @@ -529,27 +590,30 @@
>              return a;
>          }
>          
> -        public WeblogEditableListModel getModel() {
> +        public WeblogEditableListModel getModel()
> +        {
>              return model;
>          }
> -    }
> +	}
>      
> -    private class EmailPanel extends PropertyPanel {
> -        
> +    private class EmailPanel extends PropertyPanel
> +    {
> +
>          /**
> -         *
> +         * 
>           */
>          private static final long serialVersionUID = 1L;
>          TBEmailPanel emailPanel;
>          
> -        public EmailPanel() {
> +        public EmailPanel()
> +        {
>              setLayout(new BorderLayout(5, 5));
>              
>              JPanel instrPanel = new JPanel(new BorderLayout());
>              JLabel header = createHeaderLabel("Email"); //$NON-NLS-1$
>              String text =
> -                    i18n.str("specify_mail_server_prompt"); //$NON-NLS-1$
> -            
> +            i18n.str("specify_mail_server_prompt"); //$NON-NLS-1$
> +                
>              instrPanel.add(header, BorderLayout.NORTH);
>              instrPanel.add(new MultilineText(text), BorderLayout.CENTER);
>              
> @@ -561,106 +625,120 @@
>          /* (non-Javadoc)
>           * @see 
net.sf.thingamablog.gui.properties.PropertyPanel#isValidData()
>           */
> -        public boolean isValidData() {
> +        public boolean isValidData()
> +        {            
>              return emailPanel.isValidData();
>          }
> -        
> +
>          /* (non-Javadoc)
>           * @see 
net.sf.thingamablog.gui.properties.PropertyPanel#saveProperties()
>           */
> -        public void saveProperties() {
> -            emailPanel.saveProperties();
> +        public void saveProperties()
> +        {
> +            emailPanel.saveProperties();            
>          }
>          
>      }
> -    
> -    private class TransportPanel extends PropertyPanel {
> -        /**
> -         *
> +	
> +	private class TransportPanel extends PropertyPanel
> +	{
> +		/**
> +         * 
>           */
>          private static final long serialVersionUID = 1L;
>          TBPublishTransportPanel pubPanel;
> -        
> -        public TransportPanel() {
> -            setLayout(new BorderLayout());
> -            
> -            JPanel instrPanel = new JPanel(new BorderLayout());
> -            JLabel header = 
createHeaderLabel(i18n.str("publishing")); //$NON-NLS-1$
> -            String text =
> -                    i18n.str("publishing_panel_text"); //$NON-NLS-1$
> -            instrPanel.add(header, BorderLayout.NORTH);
> -            instrPanel.add(new MultilineText(text), BorderLayout.CENTER);
> -            
> -            pubPanel = new TBPublishTransportPanel(weblog);
> -            add(instrPanel, BorderLayout.NORTH);
> -            add(pubPanel, BorderLayout.CENTER);
> -        }
> -        
> -        public boolean isValidData() {
> -            return pubPanel.isValidData();
> -        }
> -        
> -        public void saveProperties() {
> -            pubPanel.saveProperties();
> -        }
> -    }
> -    
> -    private class TemplatePanel extends PropertyPanel {
> -        /**
> -         *
> +		
> +		public TransportPanel()
> +		{
> +			setLayout(new BorderLayout());
> +			
> +			JPanel instrPanel = new JPanel(new BorderLayout());
> +			JLabel header = createHeaderLabel(i18n.str("publishing")); //$NON-NLS-1$
> +			String text = 
> +			i18n.str("publishing_panel_text"); //$NON-NLS-1$
> +			instrPanel.add(header, BorderLayout.NORTH);
> +			instrPanel.add(new MultilineText(text), BorderLayout.CENTER);
> +
> +			pubPanel = new TBPublishTransportPanel(weblog);
> +			add(instrPanel, BorderLayout.NORTH);
> +			add(pubPanel, BorderLayout.CENTER);							
> +		}
> +		
> +		public boolean isValidData()
> +		{			
> +			return pubPanel.isValidData();
> +		}
> +		
> +		public void saveProperties()
> +		{
> +			pubPanel.saveProperties();
> +		}		
> +	}
> +	
> +	private class TemplatePanel extends PropertyPanel
> +	{
> +		/**
> +         * 
>           */
>          private static final long serialVersionUID = 1L;
> -        //private JComboBox tmplCombo;
> +        //private JComboBox tmplCombo; 
>          //private TemplatePropertiesPanel propertyPanel;
>          private TemplateSelectionPanel selPanel;
> -        
> -        public TemplatePanel() {
> -            JPanel instrPanel = new JPanel(new BorderLayout());
> -            JLabel header = 
createHeaderLabel(i18n.str("templates")); //$NON-NLS-1$
> -            String text =
> -                    i18n.str("templates_panel_text"); //$NON-NLS-1$
> -            instrPanel.add(header, BorderLayout.NORTH);
> -            instrPanel.add(new MultilineText(text), BorderLayout.CENTER);
> -            
> -            selPanel = new TemplateSelectionPanel(weblog);
> -            
> +		
> +		public TemplatePanel()
> +		{
> +			JPanel instrPanel = new JPanel(new BorderLayout());
> +			JLabel header = createHeaderLabel(i18n.str("templates")); //$NON-NLS-1$
> +			String text =
> +			i18n.str("templates_panel_text"); //$NON-NLS-1$
> +			instrPanel.add(header, BorderLayout.NORTH);
> +			instrPanel.add(new MultilineText(text), BorderLayout.CENTER);
> +                        
> +            selPanel = new TemplateSelectionPanel(weblog);			
> +			
>              setLayout(new BorderLayout(5, 5));
> -            add(instrPanel, BorderLayout.NORTH);
> -            add(selPanel, BorderLayout.CENTER);
> -        }
> -        
> -        public boolean isValidData() {
> -            if(selPanel.getSelectedPack() == null)
> +			add(instrPanel, BorderLayout.NORTH);
> +			add(selPanel, BorderLayout.CENTER);								
> +		}
> +		
> +		public boolean isValidData()
> +		{			
> +			if(selPanel.getSelectedPack() == null)
>                  return false;
>              return true;
> -        }
> -        
> -        public void saveProperties() {
> +		}
> +		
> +        public void saveProperties()
> +        {           
>              selectedPack = selPanel.getSelectedPack();
>          }
> -    }
> -    
> -    private class DonePanel extends PropertyPanel {
> -        /**
> -         *
> +	}	
> +	
> +	private class DonePanel extends PropertyPanel
> +	{
> +		/**
> +         * 
>           */
>          private static final long serialVersionUID = 1L;
> -        
> -        public DonePanel() {
> -            JLabel header = 
createHeaderLabel(i18n.str("done")); //$NON-NLS-1$
> -            String text =
> -                    i18n.str("finished_panel_text"); //$NON-NLS-1$
> -            
> -            setLayout(new BorderLayout());
> -            add(header, BorderLayout.NORTH);
> -            add(new MultilineText(text), BorderLayout.CENTER);
> -        }
> -        
> -        public boolean isValidData() {
> -            return true;
> -        }
> -        
> -        public void saveProperties() {
> -        }
> -    }
> +
> +        public DonePanel()
> +		{
> +			JLabel header = createHeaderLabel(i18n.str("done")); //$NON-NLS-1$
> +			String text =
> +			i18n.str("finished_panel_text"); //$NON-NLS-1$
> +			
> +			setLayout(new BorderLayout());
> +			add(header, BorderLayout.NORTH);
> +			add(new MultilineText(text), BorderLayout.CENTER);	
> +		}
> +		
> +		public boolean isValidData()
> +		{			
> +			return true;
> +		}
> +		
> +		public void saveProperties()
> +		{			
> +		}		
> +	}
>  }
> 
> Modified: 
trunk/apps/thingamablog/src/net/sf/thingamablog/xml/TBPersistFactory.java
> ===================================================================
> --- 
trunk/apps/thingamablog/src/net/sf/thingamablog/xml/TBPersistFactory.java	
2008-02-09 20:27:58 UTC (rev 17769)
> +++ 
trunk/apps/thingamablog/src/net/sf/thingamablog/xml/TBPersistFactory.java	
2008-02-10 03:51:06 UTC (rev 17770)
> @@ -14,7 +14,7 @@
>   * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
> @@ -62,328 +62,362 @@
>  
>  
>  /**
> - *
> + * 
>   * Factory for persisting a Thingamablog XML "database"
> - *
> + * 
>   * @author Bob Tantlinger
>   *
>   */
> -public class TBPersistFactory {
> +public class TBPersistFactory
> +{
>      //private static final Logger logger = 
Logger.getLogger("net.sf.thingamablog.xml");
>      
>      /**
> -     * Saves the current data to an XML file
> -     *
> -     * @param blogList The list of weblogs
> -     * @param feedRootFolder The root FeedFolder
> -     * @param path The path to save the file to
> -     * @throws IOException If an IO error occurs
> -     * @throws JDOMException If a JDOM error occurs
> -     */
> -    public synchronized static void save(WeblogList blogList, FeedFolder 
feedRootFolder, String path)
> -    throws IOException, JDOMException {
> -        String mainRoot = "Thingamablog";
> -        //Document document = XMLUtils.initDocument(mainRoot, mainRoot, new 
File(path));
> -        Document document = new Document(new Element(mainRoot));
> -        Comment comment =
> -                new Comment("Generated by Thingamablog. DO NOT EDIT THIS 
FILE!!!");
> -        document.getContent().add(0, comment);
> -        
> -        Element weblogsRoot = new Element("Weblogs");
> -        Element feedsRoot = new Element("Feeds");
> -        saveWeblogsToXML(blogList, weblogsRoot);
> -        saveFeedFolder(feedRootFolder, feedsRoot);
> -        
> -        Element root = document.getRootElement();
> -        root.addContent(weblogsRoot);
> -        root.addContent(feedsRoot);
> -        
> -        XMLUtils.writeXML(document, path, true);
> -    }
> -    
> -    public static void loadData(String path, WeblogList list, FeedFolder 
rootFolder, WeblogBackend b1, FeedBackend b2)
> -    throws IOException, JDOMException {
> -        File f = new File(path);
> -        Document doc = createDocument(f);
> -        loadWeblogList(doc, f, list, b1);
> -        loadFeedTree(doc, rootFolder, b2);
> -    }
> -    
> -    private static Document createDocument(File file)
> -    throws IOException, JDOMException {
> -        SAXBuilder builder = new SAXBuilder(false);
> -        builder.setEntityResolver(new TBEntityResolver());
> -        Document document = builder.build(file);
> -        return document;
> -    }
> -    
> -    
> -    
> -    private static void saveFeedFolder(FeedFolder folder, Element element) 
{
> -        FeedFolder sub[] = folder.getFolders();
> -        for(int i = 0; i < sub.length; i++) {
> -            Element category = new Element("Folder");
> -            category.setAttribute("name", sub[i].getName());
> -            element.addContent(category);
> -            saveFeedFolder(sub[i], category);
> -        }
> -        
> -        Feed feeds[] = folder.getFeeds();
> -        for(int j = 0; j < feeds.length; j++) {
> -            Element link = new Element("Feed");
> -            link.setText(feeds[j].getURL());
> -            
> -            String title = feeds[j].getTitle();
> -            if(title != null)
> -                link.setAttribute("title", title);
> -            else
> -                link.setAttribute("title", "Untitled");
> -            
> -            link.setAttribute("archive", feeds[j].isLimitItems() + "");
> -            link.setAttribute("limit", feeds[j].getItemLimit() + "");
> -            
> -            Date updateDate = feeds[j].getLastUpdated();
> -            if(updateDate != null)
> -                link.setAttribute("update_date", updateDate.getTime() 
+ "");
> -            //link.setAttribute("update_failed", 
feeds[j].isLastUpdateFailed() + "");
> -            if(feeds[j].isLastUpdateFailed())
> -                link.setAttribute("update_failed", 
feeds[j].getLastUpdateFailedReason());
> -            
> -            element.addContent(link);
> -        }
> -    }
> -    
> -    /**
> -     * Loads the FeedFolder heirarchy from an XML file
> -     *
> -     * @param rootFolder The root FeedFolder
> -     * @param path The path to the XML file
> -     * @param backend The backend for the feeds
> -     * @throws IOException If an IO error occurs
> -     * @throws JDOMException If a JDOM error occurs
> -     */
> -    public static void loadFeedTree(FeedFolder rootFolder, String path, 
FeedBackend backend)
> -    throws IOException, JDOMException {
> -        Document document = createDocument(new File(path));
> -        if(document == null)
> -            return;
> -        
> -        loadFeedTree(document, rootFolder, backend);
> -    }
> -    
> -    private static void loadFeedTree(Document document, FeedFolder 
rootFolder, FeedBackend backend) {
> -        Element root = document.getRootElement();
> -        Element feedRoot = root.getChild("Feeds");
> -        
> -        if(feedRoot != null) {
> -            loadFeeds(rootFolder, feedRoot, backend);
> -        }
> -    }
> -    
> -    private static void loadFeeds(FeedFolder folder, Element element, 
FeedBackend backend) {
> -        List contents = element.getChildren();
> -        Iterator contentsIt = contents.iterator();
> -        
> -        while(contentsIt.hasNext()) {
> -            Element ele = (Element) contentsIt.next();
> -            
> -            /** The element is a category */
> -            if(ele.getName().equals("Folder")) {
> -                FeedFolder subFolder = loadFeedFolder(ele);
> -                folder.addFolder(subFolder);
> -                loadFeeds(subFolder, ele, backend);
> -            }
> -            /** The element is a favorite */
> -            else if (ele.getName().equals("Feed")) {
> -                folder.addFeed(loadFeed(ele, backend));
> -            }
> -        }
> -    }
> -    
> -    private static FeedFolder loadFeedFolder(Element element) {
> -        
> -        /** Name of the category */
> -        String folderName = element.getAttributeValue("name");
> -        
> -        /** Create a new category */
> -        FeedFolder sub = new FeedFolder(folderName);
> -        return sub;
> -    }
> -    
> -    private static Feed loadFeed(Element element, FeedBackend backend) {
> -        String url = "";
> -        String title = "";
> -        Date updated = null;
> -        boolean /*lastUpdateFailed = false,*/ archive = true;
> -        String failReason = null;
> -        int limit = 50;
> -        
> -        // Url of the feed
> -        if (element.getText() != null)
> -            url = element.getText();
> -        
> -        // Title of the feed
> -        if (element.getAttributeValue("title") != null)
> -            title = element.getAttributeValue("title");
> -        
> -        if(element.getAttributeValue("update_date") != null) {
> -            try {
> -                long epoch = 
Long.parseLong(element.getAttributeValue("update_date"));
> -                updated = new Date(epoch);
> -            } catch(Exception ex){}
> -        }
> -        
> -        try {
> -            limit = 
Integer.parseInt(element.getAttributeValue("limit", "50"));
> -        }catch(Exception ex){}
> -        
> -        archive = 
element.getAttributeValue("archive", "true").equals("true");
> -        
> -        if(element.getAttributeValue("update_failed") != null) {
> -            failReason = element.getAttributeValue("update_failed");
> -        }
> -        
> -        Feed f = new Feed(url);
> -        f.setTitle(title);
> -        f.setBackend(backend);
> -        f.setLastUpdated(updated);
> -        f.setLastUpdateFailed(failReason != null);
> -        f.setLimitItems(archive);
> -        f.setItemLimit(limit);
> -        if(failReason != null)
> -            f.setLastUpdateFailedReason(failReason);
> -        return f;
> -    }
> -    
> -    
> -    private static void saveWeblogsToXML(WeblogList blogList, Element root)
> -    throws IOException, JDOMException {
> -        for(int i = 0; i < blogList.getWeblogCount(); i++) {
> -            Weblog blog = blogList.getWeblogAt(i);
> -            Element bElement = createWeblogElement(blog);
> -            root.addContent(bElement);
> -        }
> -    }
> -    
> -    private static Element createWeblogElement(Weblog blog) {
> -        Element element = new Element("Weblog");
> -        element.setAttribute("title", blog.getTitle());
> -        element.setAttribute("key", blog.getKey());
> -        element.setAttribute("last_publish", 
blog.getLastPublishDate().getTime() + "");
> +	 * Saves the current data to an XML file
> +	 * 
> +	 * @param blogList The list of weblogs
> +	 * @param feedRootFolder The root FeedFolder
> +	 * @param path The path to save the file to
> +	 * @throws IOException If an IO error occurs
> +	 * @throws JDOMException If a JDOM error occurs
> +	 */
> +	public synchronized static void save(WeblogList blogList, FeedFolder 
feedRootFolder, String path)
> +	throws IOException, JDOMException
> +	{
> +		String mainRoot = "Thingamablog";		
> +		//Document document = XMLUtils.initDocument(mainRoot, mainRoot, new 
File(path));
> +		Document document = new Document(new Element(mainRoot));
> +		Comment comment =
> +			new Comment("Generated by Thingamablog. DO NOT EDIT THIS FILE!!!");
> +		document.getContent().add(0, comment);
> +				
> +		Element weblogsRoot = new Element("Weblogs");
> +		Element feedsRoot = new Element("Feeds");		
> +		saveWeblogsToXML(blogList, weblogsRoot);
> +		saveFeedFolder(feedRootFolder, feedsRoot);
> +		
> +		Element root = document.getRootElement();
> +		root.addContent(weblogsRoot);
> +		root.addContent(feedsRoot);			
> +		
> +		XMLUtils.writeXML(document, path, true);
> +	}
> +	
> +	public static void loadData(String path, WeblogList list, FeedFolder 
rootFolder, WeblogBackend b1, FeedBackend b2)
> +	throws IOException, JDOMException
> +	{
> +		File f = new File(path);
> +		Document doc = createDocument(f);
> +		loadWeblogList(doc, f, list, b1);
> +		loadFeedTree(doc, rootFolder, b2);		
> +	}
> +	
> +	private static Document createDocument(File file)
> +	throws IOException, JDOMException
> +	{
> +		SAXBuilder builder = new SAXBuilder(false);
> +		builder.setEntityResolver(new TBEntityResolver());
> +		Document document = builder.build(file);
> +		return document;
> +	}
> +	
> +	
> +
> +	private static void saveFeedFolder(FeedFolder folder, Element element)
> +	{
> +		FeedFolder sub[] = folder.getFolders();
> +		for(int i = 0; i < sub.length; i++)
> +		{
> +			Element category = new Element("Folder");
> +			category.setAttribute("name", sub[i].getName());
> +			element.addContent(category);
> +			saveFeedFolder(sub[i], category);
> +		}
> +		
> +		Feed feeds[] = folder.getFeeds();
> +		for(int j = 0; j < feeds.length; j++)
> +		{
> +			Element link = new Element("Feed");
> +			link.setText(feeds[j].getURL());
> +			
> +			String title = feeds[j].getTitle();
> +			if(title != null)			
> +				link.setAttribute("title", title);
> +			else
> +			link.setAttribute("title", "Untitled");			
> +			
> +			link.setAttribute("archive", feeds[j].isLimitItems() + "");
> +			link.setAttribute("limit", feeds[j].getItemLimit() + "");				
> +			
> +			Date updateDate = feeds[j].getLastUpdated();
> +			if(updateDate != null)
> +				link.setAttribute("update_date", updateDate.getTime() + "");
> +			//link.setAttribute("update_failed", feeds[j].isLastUpdateFailed() 
+ "");
> +			if(feeds[j].isLastUpdateFailed())
> +				link.setAttribute("update_failed", 
feeds[j].getLastUpdateFailedReason());
> +			
> +			element.addContent(link);
> +		}
> +	}	
> +	
> +	/**
> +	 * Loads the FeedFolder heirarchy from an XML file
> +	 * 
> +	 * @param rootFolder The root FeedFolder
> +	 * @param path The path to the XML file
> +	 * @param backend The backend for the feeds
> +	 * @throws IOException If an IO error occurs
> +	 * @throws JDOMException If a JDOM error occurs
> +	 */
> +	public static void loadFeedTree(FeedFolder rootFolder, String path, 
FeedBackend backend) 
> +	throws IOException, JDOMException 
> +	{
> +		Document document = createDocument(new File(path));
> +		if(document == null)
> +			return;
> +		
> +		loadFeedTree(document, rootFolder, backend);
> +	}
> +	
> +	private static void loadFeedTree(Document document, FeedFolder rootFolder, 
FeedBackend backend)
> +	{
> +		Element root = document.getRootElement();
> +		Element feedRoot = root.getChild("Feeds");		
> +
> +		if(feedRoot != null) 
> +		{			
> +			loadFeeds(rootFolder, feedRoot, backend);			
> +		}	
> +	}
> +	
> +	private static void loadFeeds(FeedFolder folder, Element element, 
FeedBackend backend)
> +	{
> +		List contents = element.getChildren();
> +		Iterator contentsIt = contents.iterator();
> +
> +		while(contentsIt.hasNext())
> +		{
> +			Element ele = (Element) contentsIt.next();
> +
> +			/** The element is a category */
> +			if(ele.getName().equals("Folder")) 
> +			{
> +				FeedFolder subFolder = loadFeedFolder(ele);
> +				folder.addFolder(subFolder);
> +				loadFeeds(subFolder, ele, backend);
> +			}
> +			/** The element is a favorite */
> +			else if (ele.getName().equals("Feed")) 
> +			{
> +				folder.addFeed(loadFeed(ele, backend));
> +			}
> +		}
> +	}	
> +	
> +	private static FeedFolder loadFeedFolder(Element element) 
> +	{
> +
> +		/** Name of the category */
> +		String folderName = element.getAttributeValue("name");
> +
> +		/** Create a new category */
> +		FeedFolder sub = new FeedFolder(folderName);
> +		return sub;
> +	}
> +	
> +	private static Feed loadFeed(Element element, FeedBackend backend)
> +	{
> +		String url = "";
> +		String title = "";
> +		Date updated = null;
> +		boolean /*lastUpdateFailed = false,*/ archive = true;
> +		String failReason = null;
> +		int limit = 50;
> +		
> +		// Url of the feed 
> +		if (element.getText() != null)
> +			url = element.getText();
> +
> +		// Title of the feed 
> +		if (element.getAttributeValue("title") != null)
> +			title = element.getAttributeValue("title");
> +		
> +		if(element.getAttributeValue("update_date") != null)
> +		{
> +			try
> +			{			
> +				long epoch = Long.parseLong(element.getAttributeValue("update_date"));
> +				updated = new Date(epoch);				
> +			}
> +			catch(Exception ex){}
> +		}
> +		
> +		try
> +		{
> +			limit = Integer.parseInt(element.getAttributeValue("limit", "50"));
> +		}catch(Exception ex){}
> +		
> +		archive = element.getAttributeValue("archive", "true").equals("true");
> +		
> +		if(element.getAttributeValue("update_failed") != null)
> +		{
> +			failReason = element.getAttributeValue("update_failed");
> +		}
> +		
> +		Feed f = new Feed(url);
> +		f.setTitle(title);
> +		f.setBackend(backend);
> +		f.setLastUpdated(updated);		
> +		f.setLastUpdateFailed(failReason != null);
> +		f.setLimitItems(archive);
> +		f.setItemLimit(limit);
> +		if(failReason != null)
> +			f.setLastUpdateFailedReason(failReason);
> +		return f;
> +	}
> +	
> +
> +	private static void saveWeblogsToXML(WeblogList blogList, Element root)
> +	throws IOException, JDOMException
> +	{
> +		for(int i = 0; i < blogList.getWeblogCount(); i++)
> +		{
> +			Weblog blog = blogList.getWeblogAt(i);
> +			Element bElement = createWeblogElement(blog);
> +			root.addContent(bElement);
> +		}	
> +	}
> +	
> +	private static Element createWeblogElement(Weblog blog)
> +	{
> +		Element element = new Element("Weblog");
> +		element.setAttribute("title", blog.getTitle());
> +		element.setAttribute("key", blog.getKey());
> +		element.setAttribute("last_publish", blog.getLastPublishDate().getTime() 
+ "");
>          element.setAttribute("publish_failed", blog.isPublishFailed() 
+ "");
> -        Element descr = new Element("Description");
> -        descr.addContent(blog.getDescription());
> -        element.addContent(descr);
> -        element.addContent(createPingServicesElement(blog));
> -        element.addContent(createPublishTransportElement(blog));
> +		Element descr = new Element("Description");
> +		descr.addContent(blog.getDescription());		
> +		element.addContent(descr);
> +		element.addContent(createPingServicesElement(blog));
> +		element.addContent(createPublishTransportElement(blog));
>          element.addContent(createMailSettingsElement(blog));
> -        
> -        if(blog instanceof TBWeblog) {
> -            TBWeblog tbBlog = (TBWeblog)blog;
> -            return createTBWeblogElement(tbBlog, element);
> -        }
> -        return element;
> -    }
> -    
> -    private static Element createPingServicesElement(Weblog blog) {
> -        Element element = new Element("PingServices");
> -        PingService ps[] = blog.getPingServices();
> -        for(int i = 0; i < ps.length; i++) {
> -            if(ps[i] instanceof WeblogsDotComPing) {
> -                Element ping = new Element("WeblogsDotComPing");
> -                ping.setAttribute("name", ps[i].getServiceName());
> -                ping.setAttribute("url", ps[i].getServiceUrl());
> -                ping.setAttribute("enabled", ps[i].isEnabled() + "");
> -                element.addContent(ping);
> -            }
> -        }
> -        return element;
> -    }
> -    
> -    private static Element createTBWeblogElement(TBWeblog blog, Element 
element) {
> -        element.setName("TBWeblog");
> -        element.setAttribute("url", blog.getBaseUrl());
> -        element.setAttribute("arc_url", blog.getArchiveUrl());
> -        element.setAttribute("media_url", blog.getMediaUrl());
> -        element.setAttribute("base_path", blog.getBasePath());
> -        element.setAttribute("base_date", 
blog.getArchiveBaseDate().getTime() + "");
> -        element.setAttribute("arc_policy", blog.getArchivePolicy() + "");
> -        element.setAttribute("day_interval", blog.getArchiveByDayInterval() 
+ "");
> -        element.setAttribute("arc_ext", blog.getArchivesExtension());
> -        element.setAttribute("cat_ext", blog.getCategoriesExtension());
> +		
> +		if(blog instanceof TBWeblog)
> +		{
> +			TBWeblog tbBlog = (TBWeblog)blog;
> +			return createTBWeblogElement(tbBlog, element);
> +		}
> +		return element;
> +	}
> +	
> +	private static Element createPingServicesElement(Weblog blog)
> +	{
> +		Element element = new Element("PingServices");
> +		PingService ps[] = blog.getPingServices();
> +		for(int i = 0; i < ps.length; i++)
> +		{
> +			if(ps[i] instanceof WeblogsDotComPing)
> +			{
> +				Element ping = new Element("WeblogsDotComPing");
> +				ping.setAttribute("name", ps[i].getServiceName());
> +				ping.setAttribute("url", ps[i].getServiceUrl());
> +				ping.setAttribute("enabled", ps[i].isEnabled() + "");
> +				element.addContent(ping);
> +			}
> +		}
> +		return element;
> +	}
> +	
> +	private static Element createTBWeblogElement(TBWeblog blog, Element 
element)
> +	{
> +		element.setName("TBWeblog");
> +		element.setAttribute("url", blog.getBaseUrl());
> +		element.setAttribute("arc_url", blog.getArchiveUrl());
> +		element.setAttribute("media_url", blog.getMediaUrl());
> +		element.setAttribute("base_path", blog.getBasePath());		
> +		element.setAttribute("base_date", blog.getArchiveBaseDate().getTime() 
+ "");
> +		element.setAttribute("arc_policy", blog.getArchivePolicy() + "");
> +		element.setAttribute("day_interval", blog.getArchiveByDayInterval() 
+ "");
> +		element.setAttribute("arc_ext", blog.getArchivesExtension());
> +		element.setAttribute("cat_ext", blog.getCategoriesExtension());
>          element.setAttribute("gen_cat_feed", blog.isGenerateCategoryFeeds() 
+ "");
>          element.setAttribute("cat_feed_ext", 
blog.getCategoriesFeedExtension());
> -        element.setAttribute("entry_ext", blog.getEntryPageExtension());
> -        element.setAttribute("gen_rss", blog.isGenerateRssFeed() + "");
> -        element.setAttribute("gen_arc_index", blog.isGenerateArchiveIndex() 
+ "");
> -        element.setAttribute("gen_entries", blog.isGenerateEntryPages() 
+ "");
> -        element.setAttribute("fp_filename", blog.getFrontPageFileName());
> -        element.setAttribute("rss_filename", blog.getRssFileName());
> -        element.setAttribute("arc_index_filename", 
blog.getArchiveIndexFileName());
> -        element.setAttribute("locale", blog.getLocale().toString());
> -        element.setAttribute("publish_all", blog.isPublishAll() + "");
> -        element.setAttribute("type", blog.getType());
> -        
> -        Element outdatedArcs = new Element("OutdatedArchives");
> -        ArchiveRange ar[] = blog.getOutdatedArchives();
> -        for(int i = 0; i < ar.length; i++) {
> -            Element arcRange = new Element("Archive");
> -            arcRange.setAttribute("start", ar[i].getStartDate().getTime() 
+ "");
> -            arcRange.setAttribute("end", 
ar[i].getExpirationDate().getTime() + "");
> -            outdatedArcs.addContent(arcRange);
> -        }
> -        element.addContent(outdatedArcs);
> -        
> -        Element outdatedCats = new Element("OutdatedCategories");
> -        String cats[] = blog.getOutdatedCategories();
> -        for(int i = 0; i < cats.length; i++) {
> -            Element category = new Element("Category");
> -            category.setText(cats[i]);
> -            outdatedCats.addContent(category);
> -        }
> -        element.addContent(outdatedCats);
> -        
> -        Element outdatedEntries = new Element("OutdatedEntries");
> -        long ids[] = blog.getOutdatedEntryIDs();
> -        for(int i = 0; i < ids.length; i++) {
> -            Element ent = new Element("Entry");
> -            ent.setText(ids[i] + "");
> -            outdatedEntries.addContent(ent);
> -        }
> -        element.addContent(outdatedEntries);
> -        
> -        Element genElement = new Element("Generator");
> -        PageGenerator gen = blog.getPageGenerator();
> -        genElement.setAttribute("charset", gen.getCharset());
> -        genElement.setAttribute("range_format", 
gen.getArchiveRangeFormat());
> -        genElement.setAttribute("span_range", gen.isSpanArcRange() + "");
> -        genElement.setAttribute("date_format", gen.getDateFormat());
> -        genElement.setAttribute("time_format", gen.getTimeFormat());
> -        genElement.setAttribute("front_asc", gen.isFrontPageAscending() 
+ "");
> -        genElement.setAttribute("cat_asc", gen.isCategoryPageAscending() 
+ "");
> -        genElement.setAttribute("arc_asc", gen.isArchivePageAscending() 
+ "");
> -        genElement.setAttribute("limit_front", gen.isLimitFrontPage() 
+ "");
> -        genElement.setAttribute("front_page_limit", gen.getFrontPageLimit() 
+ "");
> -        genElement.setAttribute("limit_cat", gen.isLimitCategoryPage() 
+ "");
> -        genElement.setAttribute("cat_page_limit", 
gen.getCategoryPageLimit() + "");
> -        genElement.setAttribute("limit_rss_body", gen.isLimitRssEntry() 
+ "");
> -        
> -        
> -        Element customTagsElement = new Element("CustomTags");
> -        CustomTag tags[] = gen.getCustomTags();
> -        for(int i = 0; i < tags.length; i++) {
> -            Element tag = new Element("Tag");
> -            tag.setAttribute("name", tags[i].getName());
> -            tag.setText(tags[i].getValue());
> -            customTagsElement.addContent(tag);
> -        }
> -        
> -        genElement.addContent(customTagsElement);
> -        element.addContent(genElement);
> -        return element;
> -    }
> +		element.setAttribute("entry_ext", blog.getEntryPageExtension());
> +		element.setAttribute("gen_rss", blog.isGenerateRssFeed() + "");
> +		element.setAttribute("gen_arc_index", blog.isGenerateArchiveIndex() 
+ "");
> +		element.setAttribute("gen_entries", blog.isGenerateEntryPages() + "");
> +		element.setAttribute("fp_filename", blog.getFrontPageFileName());
> +		element.setAttribute("rss_filename", blog.getRssFileName());
> +		element.setAttribute("arc_index_filename", 
blog.getArchiveIndexFileName());
> +		element.setAttribute("locale", blog.getLocale().toString());
> +		element.setAttribute("publish_all", blog.isPublishAll() + "");
> +		element.setAttribute("type", blog.getType());
> +                
> +		Element outdatedArcs = new Element("OutdatedArchives");
> +		ArchiveRange ar[] = blog.getOutdatedArchives();
> +		for(int i = 0; i < ar.length; i++)
> +		{
> +			Element arcRange = new Element("Archive");
> +			arcRange.setAttribute("start", ar[i].getStartDate().getTime() + "");
> +			arcRange.setAttribute("end", ar[i].getExpirationDate().getTime() + "");
> +			outdatedArcs.addContent(arcRange);		
> +		}
> +		element.addContent(outdatedArcs);
> +		
> +		Element outdatedCats = new Element("OutdatedCategories");
> +		String cats[] = blog.getOutdatedCategories();
> +		for(int i = 0; i < cats.length; i++)
> +		{
> +			Element category = new Element("Category");
> +			category.setText(cats[i]);
> +			outdatedCats.addContent(category);		
> +		}
> +		element.addContent(outdatedCats);
> +		
> +		Element outdatedEntries = new Element("OutdatedEntries");
> +		long ids[] = blog.getOutdatedEntryIDs();
> +		for(int i = 0; i < ids.length; i++)
> +		{
> +		    Element ent = new Element("Entry");
> +		    ent.setText(ids[i] + "");
> +		    outdatedEntries.addContent(ent);
> +		}
> +		element.addContent(outdatedEntries);
> +		
> +		Element genElement = new Element("Generator");
> +		PageGenerator gen = blog.getPageGenerator();
> +		genElement.setAttribute("charset", gen.getCharset());
> +		genElement.setAttribute("range_format", gen.getArchiveRangeFormat());
> +		genElement.setAttribute("span_range", gen.isSpanArcRange() + "");
> +		genElement.setAttribute("date_format", gen.getDateFormat());
> +		genElement.setAttribute("time_format", gen.getTimeFormat());
> +		genElement.setAttribute("front_asc", gen.isFrontPageAscending() + "");
> +		genElement.setAttribute("cat_asc", gen.isCategoryPageAscending() + "");
> +		genElement.setAttribute("arc_asc", gen.isArchivePageAscending() + "");
> +		genElement.setAttribute("limit_front", gen.isLimitFrontPage() + "");
> +		genElement.setAttribute("front_page_limit", gen.getFrontPageLimit() 
+ "");
> +		genElement.setAttribute("limit_cat", gen.isLimitCategoryPage() + "");
> +		genElement.setAttribute("cat_page_limit", gen.getCategoryPageLimit() 
+ "");
> +		genElement.setAttribute("limit_rss_body", gen.isLimitRssEntry() + "");
> +		
> +		
> +		Element customTagsElement = new Element("CustomTags");
> +		CustomTag tags[] = gen.getCustomTags();
> +		for(int i = 0; i < tags.length; i++)
> +		{
> +			Element tag = new Element("Tag");
> +			tag.setAttribute("name", tags[i].getName());
> +			tag.setText(tags[i].getValue());
> +			customTagsElement.addContent(tag);
> +		}
> +		
> +		genElement.addContent(customTagsElement);	
> +		element.addContent(genElement);
> +		return element;		
> +	}
>      
> -    private static Element createMailSettingsElement(Weblog blog) {
> +    private static Element createMailSettingsElement(Weblog blog)
> +    {        
>          Element mailSettings = new Element("MailSettings");
>          mailSettings.setAttribute("enabled", 
blog.isImportFromEmailEnabled() + "");
>          if(blog.getLastEmailCheck() != null)
> @@ -399,32 +433,36 @@
>          transport.setAttribute("port", rpt.getPort() + "");
>          transport.setAttribute("user", rpt.getUserName());
>          if(rpt.isSavePassword())
> -            transport.setAttribute("password",
> -                    PasswordUtil.encrypt(rpt.getPassword(), 
PasswordUtil.KEY));
> +            transport.setAttribute("password", 
> +            PasswordUtil.encrypt(rpt.getPassword(), PasswordUtil.KEY));
>          
>          mailSettings.addContent(transport);
>          return mailSettings;
>      }
> -    
> -    private static Element createPublishTransportElement(Weblog blog) {
> -        Element transport = new Element("Transport");
> -        PublishTransport pt = blog.getPublishTransport();
> -        if(pt instanceof RemoteTransport) {
> -            RemoteTransport rpt = (RemoteTransport)pt;
> -            transport.setAttribute("type", "sftp");
> -            transport.setAttribute("server", rpt.getAddress());
> -            transport.setAttribute("port", rpt.getPort() + "");
> -            transport.setAttribute("user", rpt.getUserName());
> -            if(rpt.isSavePassword())
> -                transport.setAttribute("password",
> -                        PasswordUtil.encrypt(rpt.getPassword(), 
PasswordUtil.KEY));
> -            if(rpt instanceof FTPTransport) {
> -                FTPTransport ftp = (FTPTransport)rpt;
> -                transport.setAttribute("type", "ftp");
> -                transport.setAttribute("passive", ftp.isPassiveMode()+"");
> +	
> +	private static Element createPublishTransportElement(Weblog blog)
> +	{
> +		Element transport = new Element("Transport");
> +		PublishTransport pt = blog.getPublishTransport();
> +		if(pt instanceof RemoteTransport)
> +		{
> +			RemoteTransport rpt = (RemoteTransport)pt;
> +			transport.setAttribute("type", "sftp");
> +			transport.setAttribute("server", rpt.getAddress());
> +			transport.setAttribute("port", rpt.getPort() + "");
> +			transport.setAttribute("user", rpt.getUserName());
> +			if(rpt.isSavePassword())
> +				transport.setAttribute("password", 
> +				PasswordUtil.encrypt(rpt.getPassword(), PasswordUtil.KEY));
> +			if(rpt instanceof FTPTransport)
> +			{
> +				FTPTransport ftp = (FTPTransport)rpt;
> +				transport.setAttribute("type", "ftp");
> +				transport.setAttribute("passive", ftp.isPassiveMode()+"");
>                  Element e = new Element("ASCIITypes");
>                  List exts = ftp.getASCIIExtensions();
> -                for(Iterator it = exts.iterator(); it.hasNext();) {
> +                for(Iterator it = exts.iterator(); it.hasNext();)
> +                {
>                      String ex = it.next().toString();
>                      Element c = new Element("ext");
>                      c.setText(ex);
> @@ -432,252 +470,284 @@
>                  }
>                  
>                  transport.addContent(e);
> -            }
> -        } else {
> -            transport.setAttribute("type", "local");
> -        }
> -        
> -        return transport;
> -    }
> -    
> -    
> -    /**
> -     * Creates a WeblogList from an XML file
> -     *
> -     * @param path The path to the XML file
> -     * @param backend The backend to connect the weblogs to
> -     * @param authStore The author store for the weblogs
> -     * @param catStore The category store for the weblogs
> -     * @return A list of weblogs
> -     * @throws IOException If an IO error occurs
> -     * @throws JDOMException If a JDOM error occurs
> -     */
> -    public static WeblogList loadWeblogsFromXML(String path, WeblogBackend 
backend)
> -    throws IOException, JDOMException {
> -        WeblogList list = new WeblogList();
> -        File f = new File(path);
> -        Document document = createDocument(f);
> -        loadWeblogList(document, f, list, backend);
> -        
> -        return list;
> -    }
> -    
> -    private static void loadWeblogList(Document document, File path, 
WeblogList list, WeblogBackend backend) {
> -        if(document == null)//couldn't load xml file
> -            return;//return empty WeblogList
> -        
> -        Element root = document.getRootElement();
> -        List weblogs = root.getChild("Weblogs").getChildren();
> -        Iterator weblogsIt = weblogs.iterator();
> -        //children should all be weblogs
> -        while(weblogsIt.hasNext()) {
> -            Element blogElement = (Element)weblogsIt.next();
> -            Weblog w = createWeblogFromElement(blogElement,path);
> -            if(w != null) {
> -                w.setBackend(backend);
> -                list.addWeblog(w);
> -            }
> -        }
> -        list.sortList();
> -    }
> -    
> -    private static Weblog createWeblogFromElement(Element blogEle, File 
path) {
> -        Weblog weblog = null;
> -        //different weblog types might be added later
> -        //for now we're only dealing with TBWeblogs
> -        if(blogEle.getName().equals("TBWeblog"))
> -            weblog = createTBWeblogFromElement(blogEle, path);
> -        
> -        if(weblog == null)
> -            return null;
> -        
> -        weblog.setPublishTransport(loadPublishTransportFromXML(blogEle));
> -        loadPingServicesFromXML(blogEle, weblog);
> +			}					
> +		}
> +		else
> +		{
> +			transport.setAttribute("type", "local");
> +		}
> +		
> +		return transport;
> +	}
> +	
> +
> +	/**
> +	 * Creates a WeblogList from an XML file
> +	 * 
> +	 * @param path The path to the XML file
> +	 * @param backend The backend to connect the weblogs to
> +	 * @param authStore The author store for the weblogs
> +	 * @param catStore The category store for the weblogs
> +	 * @return A list of weblogs
> +	 * @throws IOException If an IO error occurs
> +	 * @throws JDOMException If a JDOM error occurs
> +	 */
> +	public static WeblogList loadWeblogsFromXML(String path, WeblogBackend 
backend) 
> +	throws IOException, JDOMException
> +	{
> +		WeblogList list = new WeblogList();
> +		File f = new File(path);		
> +		Document document = createDocument(f);		
> +		loadWeblogList(document, f, list, backend);			
> +
> +		return list;
> +	}
> +	
> +	private static void loadWeblogList(Document document, File path, 
WeblogList list, WeblogBackend backend)
> +	{
> +		if(document == null)//couldn't load xml file
> +			return;//return empty WeblogList
> +