Skip to content

Commit 8b83c64

Browse files
authored
Merge pull request #6 from Queuebee2/release
Sometimes things just dont git out
2 parents d92256e + bfd92e0 commit 8b83c64

File tree

3 files changed

+40
-53
lines changed

3 files changed

+40
-53
lines changed

src/main/java/app.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/main/java/orfgui/ORFVisualiser.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
import javax.swing.*;
1010
import javax.swing.border.Border;
11+
import javax.swing.event.ListSelectionEvent;
12+
import javax.swing.event.ListSelectionListener;
1113
import javax.swing.plaf.ColorUIResource;
1214
import javax.swing.table.DefaultTableModel;
1315
import javax.swing.table.JTableHeader;
@@ -615,6 +617,44 @@ private void MakeSidePanel(ArrayList<String> indexlist){
615617
mainFrame.repaint();
616618
}
617619

620+
621+
/**
622+
* SharedListSelectionHandler handles the selection in the ORF table
623+
*/
624+
class SharedListSelectionHandler implements ListSelectionListener {
625+
/**
626+
* valueChanged makes an indexlist of all de IDs of the selected rows when the user stops changing the selection
627+
* @param e action
628+
*/
629+
public void valueChanged(ListSelectionEvent e) {
630+
ArrayList<String> indexlist = new ArrayList<>();
631+
ListSelectionModel lsm = (ListSelectionModel) e.getSource();
632+
633+
// boolean to check if the user is done with changing the selection
634+
boolean isAdjusting = e.getValueIsAdjusting();
635+
if (lsm.isSelectionEmpty()) {
636+
} else {
637+
// if no more changes are made to the selection get the index of the row selected
638+
if (!isAdjusting) {
639+
int minIndex = lsm.getMinSelectionIndex();
640+
int maxIndex = lsm.getMaxSelectionIndex();
641+
// for all selected rows get the ID out of column 4 and put it in the index list
642+
for (int i = minIndex; i <= maxIndex; i++) {
643+
if (lsm.isSelectedIndex(i)) {
644+
String index = (String) table.getValueAt(i, 4);
645+
System.out.println(index);
646+
indexlist.add(index);
647+
648+
}
649+
}
650+
// make the sidePanel
651+
MakeSidePanel(indexlist);
652+
}
653+
654+
}
655+
}
656+
}
657+
618658
/**
619659
* MenuItemlistner handles the clicks on the menu
620660
*/

src/main/java/orfgui/SharedListSelectionHandler.java

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)