jButtonAssign.setEnabled(false);
jButtonAssign.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (jListUnAssigned.getSelectedIndex() > -1)
{
JDBPrinterLineMembership plm = new JDBPrinterLineMembership(Common.selectedHostID, Common.sessionID);
for (int j = jListUnAssigned.getMaxSelectionIndex(); j >= jListUnAssigned.getMinSelectionIndex(); j--)
{
if (jListUnAssigned.isSelectedIndex(j))
{
JDBListData item = (JDBListData) jListUnAssigned.getModel().getElementAt(j);
if (plm.addPrintertoLine(jListLines.getSelectedValue().toString(), item.toString()))
{
addToList(assignedList, item, false);
}
}
}
for (int j = jListUnAssigned.getMaxSelectionIndex(); j >= jListUnAssigned.getMinSelectionIndex(); j--)
{
if (jListUnAssigned.isSelectedIndex(j))
{
Object item = jListUnAssigned.getModel().getElementAt(j);
removeFromList(unassignedList, item);
}
}
refreshJList(jListAssigned, assignedModel, assignedList);
refreshJList(jListUnAssigned, unassignedModel, unassignedList);
setButtonState();
}
}
});
}
{
jButtonUnAssign = new JButton4j(Common.icon_arrow_right);
jDesktopPane1.add(jButtonUnAssign);
jButtonUnAssign.setBounds(390, 185, 25, 25);
jButtonUnAssign.setEnabled(false);
jButtonUnAssign.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (jListAssigned.getSelectedIndex() > -1)
{
JDBPrinterLineMembership plm = new JDBPrinterLineMembership(Common.selectedHostID, Common.sessionID);
for (int j = jListAssigned.getMaxSelectionIndex(); j >= jListAssigned.getMinSelectionIndex(); j--)
{
if (jListAssigned.isSelectedIndex(j))
{
JDBListData item = (JDBListData) jListAssigned.getModel().getElementAt(j);
addToList(unassignedList, item, true);
}
}
for (int j = jListAssigned.getMaxSelectionIndex(); j >= jListAssigned.getMinSelectionIndex(); j--)
{
if (jListAssigned.isSelectedIndex(j))
{
Object item = jListAssigned.getModel().getElementAt(j);
if (plm.removePrinterfromLine(jListLines.getSelectedValue().toString(), item.toString()))
{
removeFromList(assignedList, item);
}
}
}