}
break;
case POLICY:
LevelChooserDialog lcD = new LevelChooserDialog();
lcD.showDialog();
PolicyLevel result = lcD.getResult();
if(result != PolicyLevel.NONE) {
dbModel.setActiveLevel(result);
pc.createPolicy();
}
break;
}
}
});
map.put(ActionKey.MAIN_DELETE, new PolicyAction(ActionKey.MAIN_DELETE, rb.getString("delapp"), PolicyUtilities.createImageIcon("/images/delete_24.png")) {
@Override
public void actionPerformed(ActionEvent e) {
switch (dbModel.getActiveItem()) {
case APP:
ac.removeApplication();
break;
case LIST:
lc.removeReceiverList();
break;
case POLICY:
pc.removePolicy(dbModel.getActiveLevel());
break;
}
}
});
map.put(ActionKey.MAIN_MAPPING, new PolicyAction(ActionKey.MAIN_MAPPING, rb.getString("mapping"), PolicyUtilities.createImageIcon("/images/delete_24.png")) {
@Override
public void actionPerformed(ActionEvent e) {
if(mDlg == null) {
mDlg = new MappingDialog();
mDlg.showDialog();
} else {
mDlg.refresh();
mDlg.showDialog();
}
if(!mDlg.getResult()) {
if(PolicyUtilities.isShowWarnings()) {
mb = PolicyUtilities.getMessageBundle();
PolicyUtilities.showMessageDialog(mb.getString("mappingwarning"), JOptionPane.WARNING_MESSAGE);
}
}
}
});
map.put(ActionKey.LIST_ADD, new PolicyAction(ActionKey.LIST_ADD, rb.getString("addlist"), PolicyUtilities.createImageIcon("/images/new_16.png")) {
@Override
public void actionPerformed(ActionEvent e) {
ReceiverListModel list = new ReceiverListModel();
list.setId(PolicyUtilities.getNewReceiverListId());
list.setName(rb.getString("newlist") + "_" + new Integer(list.getId()).toString());
if (dbModel.addReceiverList(list)) {
dbModel.setCurrentReceiverList(list);
}
}
});
map.put(ActionKey.LIST_DELETE, new PolicyAction(ActionKey.LIST_DELETE, rb.getString("dellist"), PolicyUtilities.createImageIcon("/images/delete_16.png")) {
@Override
public void actionPerformed(ActionEvent e) {
lc.removeReceiverList();
}
});
map.put(ActionKey.LIST_ADDRECEIVER, new PolicyAction(ActionKey.LIST_ADDRECEIVER, rb.getString("add")) {
@Override
public void actionPerformed(ActionEvent e) {
lc.addReceiver();
}
});
map.put(ActionKey.LIST_RECEIVEREDIT, new PolicyAction(ActionKey.LIST_RECEIVEREDIT, rb.getString("edit")) {
@Override
public void actionPerformed(ActionEvent e) {
lc.editReceiver();
}
});
map.put(ActionKey.LIST_RECEIVERDELETE, new PolicyAction(ActionKey.LIST_RECEIVERDELETE, rb.getString("delete")) {
@Override
public void actionPerformed(ActionEvent e) {
lc.deleteReceiver();
}
});
map.put(ActionKey.POLICY_ADDA, new PolicyAction(ActionKey.POLICY_ADDA, rb.getString("newpolicy"), PolicyUtilities.createImageIcon("/images/new_16.png")) {
@Override
public void actionPerformed(ActionEvent e) {
dbModel.setActiveLevel(PolicyLevel.A);
pc.createPolicy();
}
});
map.put(ActionKey.POLICY_ADDC, new PolicyAction(ActionKey.POLICY_ADDC, rb.getString("newpolicy"), PolicyUtilities.createImageIcon("/images/new_16.png")) {
@Override
public void actionPerformed(ActionEvent e) {
dbModel.setActiveLevel(PolicyLevel.C);
pc.createPolicy();
}
});
map.put(ActionKey.POLICY_ADDI, new PolicyAction(ActionKey.POLICY_ADDI, rb.getString("newpolicy"), PolicyUtilities.createImageIcon("/images/new_16.png")) {
@Override
public void actionPerformed(ActionEvent e) {
dbModel.setActiveLevel(PolicyLevel.I);
pc.createPolicy();
}
});
map.put(ActionKey.POLICY_DELETEA, new PolicyAction(ActionKey.POLICY_DELETEA, rb.getString("delpolicy"), PolicyUtilities.createImageIcon("/images/delete_16.png")) {
@Override
public void actionPerformed(ActionEvent e) {
pc.removePolicy(PolicyLevel.A);
}
});
map.put(ActionKey.POLICY_DELETEC, new PolicyAction(ActionKey.POLICY_DELETEC, rb.getString("delpolicy"), PolicyUtilities.createImageIcon("/images/delete_16.png")) {
@Override
public void actionPerformed(ActionEvent e) {
pc.removePolicy(PolicyLevel.C);
}
});
map.put(ActionKey.POLICY_DELETEI, new PolicyAction(ActionKey.POLICY_DELETEI, rb.getString("delpolicy"), PolicyUtilities.createImageIcon("/images/delete_16.png")) {
@Override
public void actionPerformed(ActionEvent e) {
pc.removePolicy(PolicyLevel.I);
}
});
map.put(ActionKey.POLICY_CHOOSEFB, new PolicyAction(ActionKey.POLICY_CHOOSEFB, rb.getString("choosefallback")) {
@Override
public void actionPerformed(ActionEvent e) {
PolicyModel policy = dbModel.getCurrentPolicy();
List<PolicyModel> currentPolicies = null;
PolicyLevel level = dbModel.getActiveLevel();
if (level == PolicyLevel.A) {
currentPolicies = dbModel.getAPolicies();
} else if (level == PolicyLevel.C) {
currentPolicies = dbModel.getCPolicies();