} else if (source == moveAeLeftButton) {
int index = aeTabbedPane.getSelectedIndex();
if (index > 0) {
// update CPE descriptor
try {
CpeCasProcessor casProcToMove = currentCpeDesc.getCpeCasProcessors().getCpeCasProcessor(
index);
currentCpeDesc.getCpeCasProcessors().removeCpeCasProcessor(index);
currentCpeDesc.getCpeCasProcessors().addCpeCasProcessor(casProcToMove, index - 1);
} catch (CpeDescriptorException e) {
displayError(e);
return;
}
// update GUI
aeTabbedPane.moveTab(index, index - 1);
aeTabbedPane.setSelectedIndex(index - 1);
Object specifierToMove = aeSpecifiers.remove(index);
aeSpecifiers.add(index - 1, specifierToMove);
}
} else if (source == moveAeRightButton) {
int index = aeTabbedPane.getSelectedIndex();
if (index > -1 && index < aeTabbedPane.getTabCount() - 1) {
// update CPE descriptor
try {
CpeCasProcessor casProcToMove = currentCpeDesc.getCpeCasProcessors().getCpeCasProcessor(
index);
currentCpeDesc.getCpeCasProcessors().removeCpeCasProcessor(index);
currentCpeDesc.getCpeCasProcessors().addCpeCasProcessor(casProcToMove, index + 1);
} catch (CpeDescriptorException e) {
displayError(e);
return;
}
// update GUI
aeTabbedPane.moveTab(index, index + 1);
aeTabbedPane.setSelectedIndex(index + 1);
Object specifierToMove = aeSpecifiers.remove(index);
aeSpecifiers.add(index + 1, specifierToMove);
}
} else if (source == addConsumerButton) {
int rv = consumerFileChooser.showOpenDialog(addConsumerButton);
if (rv == JFileChooser.APPROVE_OPTION) {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
File file = consumerFileChooser.getSelectedFile();
// Create consumer panel on the tabbed pane
// for this consumer specifier file:
try {
addConsumer(file.getPath());
} catch (Exception e) {
displayError(e);
}
int lastTabIndex = consumerTabbedPane.getTabCount() - 1;
consumerTabbedPane.setSelectedIndex(lastTabIndex);
setCursor(Cursor.getDefaultCursor());
}
} else if (source == moveConsumerLeftButton) {
int index = consumerTabbedPane.getSelectedIndex();
if (index > 0) {
// update CPE descriptor
try {
int absIndex = aeSpecifiers.size() + index;
CpeCasProcessor casProcToMove = currentCpeDesc.getCpeCasProcessors().getCpeCasProcessor(
absIndex);
currentCpeDesc.getCpeCasProcessors().removeCpeCasProcessor(absIndex);
currentCpeDesc.getCpeCasProcessors().addCpeCasProcessor(casProcToMove, absIndex - 1);
} catch (CpeDescriptorException e) {
displayError(e);
return;
}
// update GUI
consumerTabbedPane.moveTab(index, index - 1);
consumerTabbedPane.setSelectedIndex(index - 1);
Object specifierToMove = consumerSpecifiers.remove(index);
consumerSpecifiers.add(index - 1, specifierToMove);
}
} else if (source == moveConsumerRightButton) {
int index = consumerTabbedPane.getSelectedIndex();
if (index > -1 && index < consumerTabbedPane.getTabCount() - 1) {
// update CPE descriptor
try {
int absIndex = aeSpecifiers.size() + index;
CpeCasProcessor casProcToMove = currentCpeDesc.getCpeCasProcessors().getCpeCasProcessor(
absIndex);
currentCpeDesc.getCpeCasProcessors().removeCpeCasProcessor(absIndex);
currentCpeDesc.getCpeCasProcessors().addCpeCasProcessor(casProcToMove, absIndex + 1);
} catch (CpeDescriptorException e) {
displayError(e);