[freenet-cvs] r17855 - trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties

dieppe at freenetproject.org dieppe at freenetproject.org
Wed Feb 13 00:48:36 UTC 2008


Author: dieppe
Date: 2008-02-13 00:48:35 +0000 (Wed, 13 Feb 2008)
New Revision: 17855

Modified:
   trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBPublishTransportPanel.java
   trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBWizardDialog.java
Log:
Updates : when adding a flog, the only transport process is LOCAL
Todo : adding FCP transport


Modified: trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBPublishTransportPanel.java
===================================================================
--- trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBPublishTransportPanel.java	2008-02-13 00:38:25 UTC (rev 17854)
+++ trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBPublishTransportPanel.java	2008-02-13 00:48:35 UTC (rev 17855)
@@ -68,6 +68,7 @@
     private final String FTP = "FTP"; //$NON-NLS-1$
 	private final String SFTP = "SFTP"; //$NON-NLS-1$
 	private final String LOCAL = "Local"; //$NON-NLS-1$
+//        private final String FCP = "FCP";
 	
 	private TBWeblog weblog;
 	private JComboBox encodingsCombo;
@@ -75,6 +76,7 @@
 	private JPanel transportsPanel;
 	private RemoteTransportPanel ftpPanel;
 	private RemoteTransportPanel sftpPanel;
+//        private FcpTransportPanel fcpPanel;
 	private JPanel localPanel;
 	private CardLayout tLayout;
     private JTabbedPane ftpTabs = new JTabbedPane();
@@ -83,27 +85,45 @@
 	public TBPublishTransportPanel(TBWeblog wb)
 	{
 		weblog = wb;
-		String types[] = {FTP, SFTP, LOCAL};
-		
-		tLayout = new CardLayout();
-		ftpPanel = new RemoteTransportPanel(true);
-		ftpPanel.setBorder(new TitledBorder(i18n.str("ftp_transport"))); //$NON-NLS-1$
-		sftpPanel = new RemoteTransportPanel(false);
-		sftpPanel.setBorder(new TitledBorder(i18n.str("sftp_transport"))); //$NON-NLS-1$
-		localPanel = new JPanel();
-        
-        ftpTabs.add(ftpPanel, "FTP");
-        asciiPanel.setPreferredSize(new Dimension(210, 150));
-        JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
-        p.add(asciiPanel);
-        ftpTabs.add(p, "ASCII");
-        
-		
+                String types[];
+                tLayout = new CardLayout();
+                // If we are currently building a blog, the publish process can be FTP, SFTP, or LOCAL
+                if (weblog.getType().toString().equals("internet")) {
+                    types=new String[3];
+                    types[0]="LOCAL";
+                    types[1]="FTP";
+                    types[2]="SFTP";                    
+                    ftpPanel = new RemoteTransportPanel(true);
+                    ftpPanel.setBorder(new TitledBorder(i18n.str("ftp_transport"))); //$NON-NLS-1$
+                    sftpPanel = new RemoteTransportPanel(false);
+                    sftpPanel.setBorder(new TitledBorder(i18n.str("sftp_transport"))); //$NON-NLS-1$
+                    ftpTabs.add(ftpPanel, "FTP");
+                    asciiPanel.setPreferredSize(new Dimension(210, 150));
+                    JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
+                    p.add(asciiPanel);
+                    ftpTabs.add(p, "ASCII");
+                 }
+                // Else, we are building a flog, and the transport process is LOCAL or FCP
+                else {
+                    types=new String[1];
+                    types[0]="LOCAL";
+                    //types[2]="FCP";                    
+                    //fcpPanel = new FcpTransportPanel();
+                    //fcpPanel.setBorder(new TitledBorder(i18n.str("fcp_transport")));
+                 }
+                localPanel = new JPanel();
+                		
 		transportsPanel = new JPanel();
-		transportsPanel.setLayout(tLayout);		
-		transportsPanel.add(ftpTabs, FTP);
-		transportsPanel.add(sftpPanel, SFTP);
-		transportsPanel.add(localPanel, LOCAL);	
+		transportsPanel.setLayout(tLayout);
+                if (weblog.getType().toString().equals("internet")) {
+                    transportsPanel.add(localPanel, LOCAL);
+                    transportsPanel.add(ftpTabs, FTP);
+                    transportsPanel.add(sftpPanel, SFTP);
+                } else {
+                    transportsPanel.add(localPanel, LOCAL);
+                    //transportsPanel.add(fcpPanel, FCP);
+                }
+			
 		
 		/* Fill combo with all supported encodings */
 		encodingsCombo = new JComboBox();
@@ -147,7 +167,12 @@
 		{		
 			transportTypeCombo.setSelectedItem(LOCAL);
 			tLayout.show(transportsPanel, LOCAL);
-		}
+		} 
+//                else {
+//                    transportTypeCombo.setSelectedItem(FCP);
+//                    tLayout.show(transportsPanel, FCP);
+//                }
+                
 		transportTypeCombo.addActionListener(new ActionListener()
 		{
 			public void actionPerformed(ActionEvent e)
@@ -207,10 +232,12 @@
 				pt.setPassword(sftpPanel.getPassword());
 			transport = pt;					
 		}
-		else
+		else if(o == LOCAL)
 		{
 			transport = new LocalTransport();
-		}
+		} else {
+//                    transport = new FCPTransport();
+                }
 		
 		weblog.setPublishTransport(transport);
 		weblog.getPageGenerator().setCharset(encodingsCombo.getSelectedItem().toString());
@@ -388,4 +415,10 @@
             passiveModeCheckBox.setSelected(b);
         }
     }
-}
+        
+//        private class FCPTransportPanel extends JPanel {
+//            /**
+//             * Ask for some options like : is the node on the same computer, etc..
+//             */
+//        }
+}
\ No newline at end of file

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-13 00:38:25 UTC (rev 17854)
+++ trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBWizardDialog.java	2008-02-13 00:48:35 UTC (rev 17855)
@@ -106,7 +106,8 @@
 		
 		weblog = new TBWeblog(dir);
 		weblog.setBackend(backend);
-		weblog.setPublishTransport(new net.sf.thingamablog.transport.FTPTransport());
+                // Default behavior is to publish the b/flog locally
+		weblog.setPublishTransport(new net.sf.thingamablog.transport.LocalTransport());
 		//weblog.setAuthorStore(authStore);
 		//weblog.setCategoryStore(catStore);
 		
@@ -135,24 +136,16 @@
 		
 		templPanel = new TemplatePanel();
 		templPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
-		panels.add(templPanel);
+		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$
+		wizPanel.add(templPanel, "6"); //$NON-NLS-1$                
 		
 		ActionListener listener = new ButtonHandler();
 		nextButton = new JButton(i18n.str("next-")); //$NON-NLS-1$
@@ -275,19 +268,33 @@
 		public void actionPerformed(ActionEvent e)
 		{
 			if(e.getSource() == nextButton)
-			{
-				if(!donePanel.isVisible())
+			{                            
+                                // We check if the current panel is the starterPanel (donePanel is not yet initialized) or if the current panel is not donePanel
+				if(starterPanel.isVisible() || !donePanel.isVisible())
 				{				
 					//if(isCurrentPanelValid())
                     PropertyPanel p = getCurrentPanel();
                     if(p != null && p.isValidData())
                     {
 						p.saveProperties();
+                                // We initialize the transport panel after save the type propertie
+                                if(starterPanel.isVisible()) {
+                                    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(transportPanel, "7"); //$NON-NLS-1$
+                                    wizPanel.add(donePanel, "8");	 //$NON-NLS-1$
+                                }
                         wizLayout.next(wizPanel);
                         
                     }
-				}
-														
+				}                                
+
 				if(donePanel.isVisible())
 				{
 					doneButton.setText(FINISH);
@@ -380,8 +387,7 @@
 				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,
@@ -446,7 +452,7 @@
 		}
 		
 		public boolean isValidData()
-		{			
+		{		                                            
 			if(titleField.getText().equals("")) //$NON-NLS-1$
 			{
 				JOptionPane.showMessageDialog(TBWizardDialog.this, 




More information about the cvs mailing list