diff --git a/com/gallery/GalleryRemote/MainFrame.java b/com/gallery/GalleryRemote/MainFrame.java index 834dd7a..efcf25b 100644 --- a/com/gallery/GalleryRemote/MainFrame.java +++ b/com/gallery/GalleryRemote/MainFrame.java @@ -82,7 +82,6 @@ public class MainFrame extends javax.swing.JFrame JPanel jPanel3 = new JPanel(); GridLayout gridLayout1 = new GridLayout(); JButton upload = new JButton(); - JButton delete = new JButton(); JButton browse = new JButton(); JComboBox url = new JComboBox(); JPanel jPanel4 = new JPanel(); @@ -148,11 +147,13 @@ public void initComponents() jCheckBoxMenuPath.setSelected( GalleryRemote.getInstance().properties.getShowPath() ); setShowThumbnails( GalleryRemote.getInstance().properties.getShowThumbnails() ); inspectorDivider.setDividerLocation( GalleryRemote.getInstance().properties.getIntProperty( "inspectorDividerLocation" ) ); - - url.addItem( GalleryRemote.getInstance().properties.getProperty( "url.1" ) ); - username.setText( GalleryRemote.getInstance().properties.getProperty( "username.1" ) ); - password.setText( GalleryRemote.getInstance().properties.getBase64Property( "password.1" ) ); - + + if (GalleryRemote.getInstance().properties.getProperty( "url.1" ) != null) { + url.addItem( GalleryRemote.getInstance().properties.getProperty( "url.1" ) ); + username.setText( GalleryRemote.getInstance().properties.getProperty( "username.1" ) ); + password.setText( GalleryRemote.getInstance().properties.getBase64Property( "password.1" ) ); + } + setVisible( true ); if ( GalleryRemote.getInstance().properties.getShowPreview() ) { @@ -169,7 +170,9 @@ public void initComponents() *@param e Event */ void thisWindowClosing( java.awt.event.WindowEvent e ) { - GalleryRemote.getInstance().properties.setProperty( "url.1", (String) url.getSelectedItem() ); + if ((String) url.getSelectedItem() != null) { + GalleryRemote.getInstance().properties.setProperty( "url.1", (String) url.getSelectedItem() ); + } GalleryRemote.getInstance().properties.setProperty( "username.1", username.getText() ); GalleryRemote.getInstance().properties.setBase64Property( "password.1", password.getText() ); @@ -201,7 +204,6 @@ void updateUI() { int sel = picturesList.getSelectedIndex(); int selN = picturesList.getSelectedIndices().length; - delete.setEnabled( sel != -1 ); if ( sel == -1 ) { setStatus( mAlbum.sizePictures() + " pictures, " @@ -213,7 +215,6 @@ void updateUI() { //jButtonUp.setEnabled( selN == 1 ); //jButtonDown.setEnabled( selN == 1 ); - } @@ -558,8 +559,6 @@ private void jbInit() upload.setAlignmentX( (float) 2.0 ); upload.setText( "Upload" ); upload.setActionCommand( "Upload" ); - delete.setText( "Delete" ); - delete.setActionCommand( "Delete" ); inspectorDivider.setBorder( new TitledBorder( BorderFactory.createEtchedBorder( Color.white, new Color( 148, 145, 140 ) ), "Pictures to Upload (Drag and Drop files into this panel)" ) ); jPanel1.setBorder( new TitledBorder( BorderFactory.createEtchedBorder( Color.white, new Color( 148, 145, 140 ) ), "Destination Gallery" ) ); browse.setAlignmentX( (float) 1.0 ); @@ -617,7 +616,6 @@ private void jbInit() this.getContentPane().add( jPanel3, new GridBagConstraints( 0, 2, 1, 1, 1.0, 0.0 , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets( 5, 5, 5, 5 ), 0, 0 ) ); jPanel3.add( browse, null ); - jPanel3.add( delete, null ); jPanel3.add( upload, null ); this.getContentPane().add( jPanel4, new GridBagConstraints( 0, 3, 1, 1, 1.0, 0.0 , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets( 0, 0, 0, 0 ), 0, 0 ) ); @@ -641,7 +639,6 @@ private void jbInit() private void jbInitEvents() { fetch.addActionListener( this ); upload.addActionListener( this ); - delete.addActionListener( this ); browse.addActionListener( this ); jMenuItemQuit.addActionListener( this ); jMenuItemAbout.addActionListener( this ); @@ -693,8 +690,8 @@ public void actionPerformed( ActionEvent e ) { showAboutBox(); } else if ( command.equals( "Fetch" ) ) { fetchAlbums(); - } else if ( command.equals( "Delete" ) ) { - deleteSelectedPictures(); + //} else if ( command.equals( "Delete" ) ) { + // deleteSelectedPictures(); } else if ( command.equals( "Browse" ) ) { browseAddPictures(); } else if ( command.equals( "Upload" ) ) { diff --git a/com/gallery/GalleryRemote/PictureInspector.java b/com/gallery/GalleryRemote/PictureInspector.java index 126c144..840b58b 100644 --- a/com/gallery/GalleryRemote/PictureInspector.java +++ b/com/gallery/GalleryRemote/PictureInspector.java @@ -34,7 +34,10 @@ *@created August 16, 2002 */ public class PictureInspector extends JPanel + implements ActionListener { + public static final String MODULE = "PictInspec"; + GridBagLayout gridBagLayout4 = new GridBagLayout(); JLabel icon = new JLabel(); JLabel jLabel5 = new JLabel(); @@ -53,6 +56,8 @@ public class PictureInspector extends JPanel MainFrame mf = null; Picture p = null; + JButton delete = new JButton(); + JLabel jLabel2 = new JLabel(); /** @@ -61,6 +66,7 @@ public class PictureInspector extends JPanel public PictureInspector() { try { jbInit(); + jbInitEvents(); } catch ( Exception e ) { e.printStackTrace(); } @@ -79,47 +85,86 @@ private void jbInit() jLabel6.setText( "Album:" ); album.setText( "album" ); jLabel4.setText( "Caption:" ); - up.setMinimumSize( new Dimension( 89, 23 ) ); - up.setPreferredSize( new Dimension( 89, 23 ) ); + up.setMaximumSize(new Dimension( 100, 23 ) ); + up.setMinimumSize( new Dimension( 100, 23 ) ); + up.setPreferredSize( new Dimension( 100, 23 ) ); up.setText( "Move up" ); jLabel8.setText( "Move:" ); + down.setMaximumSize(new Dimension( 100, 23 ) ); + down.setMinimumSize( new Dimension( 100, 23 ) ); + down.setPreferredSize( new Dimension( 100, 23 ) ); down.setText( "Move down" ); jLabel1.setText( "Size:" ); size.setText( "size" ); + caption.setBackground(SystemColor.control); caption.setFont( new java.awt.Font( "SansSerif", 0, 11 ) ); caption.setBorder( null ); caption.setEditable( false ); caption.setText( "caption" ); - add( icon, new GridBagConstraints( 0, 0, 2, 1, 1.0, 0.0 - , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets( 0, 0, 0, 0 ), 0, 0 ) ); - add( jLabel5, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0 - , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0 ), 2, 0 ) ); - add( path, new GridBagConstraints( 1, 1, 1, 1, 1.0, 0.0 - , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets( 0, 0, 0, 0 ), 0, 0 ) ); - add( jLabel6, new GridBagConstraints( 0, 2, 1, 1, 0.0, 0.0 - , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0 ), 2, 0 ) ); - add( album, new GridBagConstraints( 1, 2, 1, 1, 1.0, 0.0 - , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets( 0, 0, 0, 0 ), 0, 0 ) ); - add( Caption, new GridBagConstraints( 0, 5, 1, 1, 0.0, 0.0 - , GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0 ), 0, 0 ) ); - add( jLabel4, new GridBagConstraints( 0, 4, 1, 1, 0.0, 0.0 - , GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0 ), 2, 0 ) ); - add( up, new GridBagConstraints( 1, 6, 1, 1, 0.0, 0.0 - , GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0 ), 0, 0 ) ); - add( jLabel8, new GridBagConstraints( 0, 6, 1, 2, 0.0, 0.0 - , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0 ), 2, 0 ) ); - add( down, new GridBagConstraints( 1, 7, 1, 1, 0.0, 0.0 - , GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0 ), 0, 0 ) ); - add( spacer, new GridBagConstraints( 0, 8, 2, 1, 1.0, 1.0 - , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( 0, 0, 0, 0 ), 0, 0 ) ); - this.add( jLabel1, new GridBagConstraints( 0, 3, 1, 1, 0.0, 0.0 - , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0 ), 2, 0 ) ); - this.add( size, new GridBagConstraints( 1, 3, 1, 1, 1.0, 0.0 - , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets( 0, 0, 0, 0 ), 0, 0 ) ); - this.add( caption, new GridBagConstraints( 1, 4, 1, 1, 1.0, 0.0 - , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets( 0, 0, 0, 0 ), 0, 0 ) ); + delete.setMaximumSize(new Dimension( 100, 23 ) ); + delete.setMinimumSize(new Dimension( 100, 23 ) ); + delete.setPreferredSize(new Dimension( 100, 23 ) ); + delete.setActionCommand("Delete"); + delete.setText("Delete"); + jLabel2.setText("Delete:"); + add( icon, new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0) ); + add( jLabel5, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 2, 0) ); + add( path, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0) ); + add( jLabel6, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 2, 0) ); + add( album, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0) ); + add( Caption, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0) ); + add( jLabel4, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0 + ,GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 2, 0) ); + add( up, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 0, 0), 0, 0) ); + add( jLabel8, new GridBagConstraints(0, 6, 1, 2, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 2, 0) ); + add( down, new GridBagConstraints(1, 7, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0) ); + add( spacer, new GridBagConstraints(0, 9, 2, 1, 1.0, 1.0 + ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0) ); + this.add( jLabel1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 2, 0) ); + this.add( size, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0) ); + this.add( caption, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0) ); + this.add(delete, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 0, 0), 0, 0)); + this.add(jLabel2, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 2, 0)); } + private void jbInitEvents() { + delete.addActionListener( this ); + up.addActionListener( this ); + down.addActionListener( this ); + } + + // Event handling + /** + * Menu and button handling + * + *@param e Action event + */ + public void actionPerformed( ActionEvent e ) { + String command = e.getActionCommand(); + Log.log(Log.INFO, MODULE, "Command selected " + command ); + + if ( command.equals( "Delete" ) ) { + mf.deleteSelectedPictures(); + } else if ( command.equals( "Up" ) ) { + mf.movePictureUp(); + } else if ( command.equals( "Down" ) ) { + mf.movePictureDown(); + } + } /** * Sets the mainFrame attribute of the PictureInspector object