Skip to content

Commit

Permalink
Unhacked list selection.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Luc Paour committed Jun 13, 2003
1 parent 33171cd commit 4a7ca9f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 46 deletions.
1 change: 0 additions & 1 deletion com/gallery/GalleryRemote/MainFrame.java
Expand Up @@ -351,7 +351,6 @@ private void updatePicturesList() {
} else {
if (jPicturesList.getModel() != currentAlbum) {
jPicturesList.setModel( currentAlbum );
currentAlbum.setListSelectionModel(jPicturesList.getSelectionModel());
currentAlbum.addListDataListener( this );
}

Expand Down
32 changes: 5 additions & 27 deletions com/gallery/GalleryRemote/model/Album.java
Expand Up @@ -27,8 +27,6 @@
import java.util.Vector;

import javax.swing.*;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;

import com.gallery.GalleryRemote.GalleryCommCapabilities;
import com.gallery.GalleryRemote.Log;
Expand All @@ -54,12 +52,8 @@ public class Album extends Picture implements ListModel, Serializable
* LOCAL STORAGE
*/
Vector pictures = new Vector();

/* -------------------------------------------------------------------------
* WORKAROUND FOR LIST SELECTION BUG
*/
transient ListSelectionModel listSelectionModel;



/* -------------------------------------------------------------------------
* SERVER INFO
*/
Expand Down Expand Up @@ -234,16 +228,9 @@ public void clearPictures() {
*@param n item number of the picture to remove
*/
public void removePicture( int n ) {
// deselect pictures pictures at the end of the list so they will
// not cause selection problems (the JList doesn't synch properly
// the selection to the model)
listSelectionModel.removeSelectionInterval(sizePictures() - 1, sizePictures() - 1);

pictures.remove( n );

//ListDataEvent lde = new ListDataEvent( com.gallery.GalleryRemote.GalleryRemote.getInstance().mainFrame, ListDataEvent.INTERVAL_REMOVED, n, n );
fireIntervalRemoved(this, n, n);
//notifyListeners(lde);
}

public void removePicture( Picture p ) {
Expand All @@ -259,19 +246,12 @@ public void removePictures( int[] indices ) {
int min, max;
min = max = indices[0];

// deselect pictures pictures at the end of the list so they will
// not cause selection problems (the JList doesn't synch properly
// the selection to the model)
listSelectionModel.removeSelectionInterval(sizePictures() - 1 - indices.length, sizePictures() - 1);

for ( int i = indices.length - 1; i >= 0; i-- ) {
pictures.remove( indices[i] );
if (indices[i] > max) max = indices[i];
if (indices[i] < min) min = indices[i];
}

//ListDataEvent lde = new ListDataEvent( com.gallery.GalleryRemote.GalleryRemote.getInstance().mainFrame, ListDataEvent.INTERVAL_REMOVED, min, max );
//notifyListeners(lde);
fireIntervalRemoved(this, min, max);
}

Expand Down Expand Up @@ -434,9 +414,9 @@ && getName() != null
}


public void setListSelectionModel(ListSelectionModel listSelectionModel) {
this.listSelectionModel = listSelectionModel;
}
//public void setListSelectionModel(ListSelectionModel listSelectionModel) {
// this.listSelectionModel = listSelectionModel;
//}


/* -------------------------------------------------------------------------
Expand Down Expand Up @@ -525,8 +505,6 @@ public void setCanCreateSubAlbum( boolean b ){
public boolean getCanCreateSubAlbum(){
return canCreateSubAlbum;
}




/* -------------------------------------------------------------------------
Expand Down
18 changes: 0 additions & 18 deletions com/gallery/GalleryRemote/model/Picture.java
Expand Up @@ -46,13 +46,10 @@ public class Picture extends GalleryAbstractListModel implements Serializable, P
File source = null;
String caption = null;
Album album = null;
private int listIndex;

transient double fileSize = 0;
transient String escapedCaption = null;

transient protected EventListenerList listenerList = new EventListenerList();

/**
* Constructor for the Picture object
*/
Expand Down Expand Up @@ -218,21 +215,6 @@ public Album getAlbum() {
return album;
}

/** Getter for property listIndex.
* @return Value of property listIndex.
*
*/
public int getListIndex() {
return this.listIndex;
}

/** Setter for property listIndex.
* @param listIndex New value of property listIndex.
*
*/
public void setListIndex(int listIndex) {
}

public String toString() {
return source.getName();
}
Expand Down

0 comments on commit 4a7ca9f

Please sign in to comment.