Skip to content

Commit

Permalink
Moved the delet button into the inspector, where it belongs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Luc Paour committed Aug 19, 2002
1 parent d16e586 commit 855953e
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 45 deletions.
27 changes: 12 additions & 15 deletions com/gallery/GalleryRemote/MainFrame.java
Expand Up @@ -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();
Expand Down Expand Up @@ -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() ) {
Expand All @@ -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() );

Expand Down Expand Up @@ -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, "
Expand All @@ -213,7 +215,6 @@ void updateUI() {

//jButtonUp.setEnabled( selN == 1 );
//jButtonDown.setEnabled( selN == 1 );

}


Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 ) );
Expand All @@ -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 );
Expand Down Expand Up @@ -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" ) ) {
Expand Down
105 changes: 75 additions & 30 deletions com/gallery/GalleryRemote/PictureInspector.java
Expand Up @@ -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();
Expand All @@ -53,6 +56,8 @@ public class PictureInspector extends JPanel

MainFrame mf = null;
Picture p = null;
JButton delete = new JButton();
JLabel jLabel2 = new JLabel();


/**
Expand All @@ -61,6 +66,7 @@ public class PictureInspector extends JPanel
public PictureInspector() {
try {
jbInit();
jbInitEvents();
} catch ( Exception e ) {
e.printStackTrace();
}
Expand All @@ -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
Expand Down

0 comments on commit 855953e

Please sign in to comment.