Link samples table to GUI events
This commit is contained in:
@@ -68,14 +68,16 @@ public class MainPanel extends Panel {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
try {
|
||||
String add = String.valueOf(tablePucks.getModel().getValueAt(tablePucks.getSelectedRow(), 0));
|
||||
String cur = Controller.getInstance().getCurrentSelection();
|
||||
if (cur != null) {
|
||||
cur = cur.substring(0, 2);
|
||||
}
|
||||
if (!add.equals(cur)) {
|
||||
Puck puck = Controller.getInstance().getPuck(add);
|
||||
Controller.getInstance().selectPuck(puck);
|
||||
if (e.getValueIsAdjusting() == false) {
|
||||
String add = String.valueOf(tablePucks.getModel().getValueAt(tablePucks.getSelectedRow(), 0));
|
||||
String cur = Controller.getInstance().getCurrentSelection();
|
||||
if (cur != null) {
|
||||
cur = cur.substring(0, 2);
|
||||
}
|
||||
if (!add.equals(cur)) {
|
||||
Puck puck = Controller.getInstance().getPuck(add);
|
||||
Controller.getInstance().selectPuck(puck);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
@@ -87,18 +89,30 @@ public class MainPanel extends Panel {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
try {
|
||||
if (e.getValueIsAdjusting() == false) {
|
||||
int selection = tableSamples.getSelectedRow();
|
||||
if (selection>=0){
|
||||
String add = String.valueOf(tableSamples.getModel().getValueAt(selection, 3));
|
||||
if (!add.trim().isEmpty()) {
|
||||
String cur = Controller.getInstance().getCurrentSelection();
|
||||
if (cur != null) {
|
||||
cur = cur.substring(0, 2);
|
||||
}
|
||||
if (!add.equals(cur)) {
|
||||
Puck puck = Controller.getInstance().getPuck(add);
|
||||
Controller.getInstance().selectPuck(puck);
|
||||
}
|
||||
if (selection>=0){
|
||||
String add = String.valueOf(tableSamples.getModel().getValueAt(selection, 3));
|
||||
if (!add.trim().isEmpty()) {
|
||||
int pos = -1;
|
||||
try{
|
||||
pos = Integer.valueOf(String.valueOf(tableSamples.getModel().getValueAt(selection, 7)));
|
||||
} catch (Exception ex){
|
||||
}
|
||||
String curSelection = Controller.getInstance().getCurrentSelection();
|
||||
String curPuck = (curSelection == null) ? null : curSelection.substring(0, 2);
|
||||
if (!add.equals(curPuck)) {
|
||||
Puck puck = Controller.getInstance().getPuck(add);
|
||||
Controller.getInstance().selectPuck(puck);
|
||||
}
|
||||
if (pos>=0){
|
||||
add += pos;
|
||||
if (!add.equals(curSelection)) {
|
||||
Sample sample = Controller.getInstance().getSample(add);
|
||||
Controller.getInstance().selectSample(sample);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@@ -482,6 +496,11 @@ public class MainPanel extends Panel {
|
||||
|
||||
for (int i = 0; i < tableSamples.getModel().getRowCount(); i++) {
|
||||
if (add.equals(tableSamples.getModel().getValueAt(i, 3))) {
|
||||
if (sample!=null){
|
||||
if (!sample.equals(tableSamples.getModel().getValueAt(i, 7))){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (tableSamples.getSelectedRow() != i) {
|
||||
tableSamples.setRowSelectionInterval(i, i);
|
||||
SwingUtils.scrollToVisible(tableSamples, i, 0);
|
||||
|
||||
Reference in New Issue
Block a user