decreaseService.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
try {
int planned = sElem.getPlanned();
int row = instanceTable.getSelectedRow();
ServiceBeanInstance instance =
(ServiceBeanInstance)instanceTable.getModel().
getValueAt(row, 1);
opMgr.decrement(instance, true, true);
if(planned>0)
planned--;
sElem.setPlanned(planned);
String value = Integer.toString(planned);
ServiceAttributeTableItem tableItem =
new ServiceAttributeTableItem();
tableItem.attributeDescription = new JLabel(value);
DefaultTableModel tableModel =
(DefaultTableModel)serviceAttributeTable.getModel();
tableModel.setValueAt(tableItem,
2, /*row*/
1); /*column*/
((DefaultTableModel)instanceTable.getModel()).removeRow(row);
setInstanceTableLabel(sElem,
(DefaultTableModel)instanceTable.getModel());
} catch (Exception e) {
Util.showError(e, parent, "Unable to decrease instance count");
}
}
});
/* Relocation instance behavior */
relocateService.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
try {
ServiceBeanInstance instance =
(ServiceBeanInstance)instanceTable.getModel().getValueAt(instanceTable.getSelectedRow(), 1);
opMgr.relocate(instance, null, null);
} catch (Exception e) {
Util.showError(e, parent, "Unable to relocate");
}