Package de.netsysit.model

Examples of de.netsysit.model.ReceiverListModel


                        listnames[i] = lists.get(i);
                    }

                    ListSelectionDialog lsd = new ListSelectionDialog();
                    lsd.showDialog(listnames);
                    ReceiverListModel selection = (ReceiverListModel) lsd.getResult();

                    if (selection != null) {
                        app.addReceiverList(selection);
                    }
                } else if(PolicyUtilities.isShowWarnings()) {
                    mb = PolicyUtilities.getMessageBundle();
                    PolicyUtilities.showMessageDialog(mb.getString("nolistavailable"), JOptionPane.INFORMATION_MESSAGE);
                }         
            }
        });

        map.put(ActionKey.APP_DELETELIST, new PolicyAction(ActionKey.APP_DELETELIST, rb.getString("delete")) {

            @Override
            public void actionPerformed(ActionEvent e) {
                ac.deleteList();
            }
        });

        map.put(ActionKey.MAIN_OPENDB, new PolicyAction(ActionKey.MAIN_OPENDB, rb.getString("opendb")) {

            @Override
            public void actionPerformed(ActionEvent e) {
                SelectDBDialog dlgSelectDB = new SelectDBDialog(MainFrame.getInstance(), true);
                dlgSelectDB.setVisible(true);
            }
        });

        map.put(ActionKey.MAIN_SAVE, new PolicyAction(ActionKey.MAIN_SAVE,  rb.getString("save"), PolicyUtilities.createImageIcon("/images/save_24.png")) {

            @Override
            public void actionPerformed(ActionEvent e) {
                XMLPolicyDBWriter writer = new XMLPolicyDBWriter();
                try {                                            
                    writer.savePolicyDB(dbModel.getFilePath());
                } catch (Exception ex) {
                    Logger.getLogger(ActionFactory.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
       
        map.put(ActionKey.MAIN_SAVEAS, new PolicyAction(ActionKey.MAIN_SAVEAS,  rb.getString("saveas"), PolicyUtilities.createImageIcon("/images/save_24.png")) {

            @Override
            public void actionPerformed(ActionEvent e) {
                XMLPolicyDBWriter writer = new XMLPolicyDBWriter();
                try {                  
                    String path = PolicyUtilities.showSaveDialog();
                    writer.savePolicyDB(path);
                } catch (Exception ex) {
                    Logger.getLogger(ActionFactory.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });       

        map.put(ActionKey.MAIN_ADD, new PolicyAction(ActionKey.MAIN_ADD, rb.getString("addapp"), PolicyUtilities.createImageIcon("/images/new_24.png")) {

            @Override
            public void actionPerformed(ActionEvent e) {
                switch (dbModel.getActiveItem()) {
                    case APP:
                        ApplicationModel app = new ApplicationModel();
                        app.setId(PolicyUtilities.getNewApplicationId());
                        app.setName(rb.getString("newapp") + "_" + new Integer(app.getId()).toString());
                        app.setBaseA(ApplicationBase.NONE);
                        app.setBaseC(ApplicationBase.NONE);
                        app.setBaseI(ApplicationBase.NONE);
                        if (dbModel.addApplication(app)) {
                            dbModel.setCurrentApplication(app);
                        }
                        break;
                    case LIST:
                        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);
                        }
                        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();
                } else if (level == PolicyLevel.I) {
                    currentPolicies = dbModel.getIPolicies();
                }

                List<PolicyModel> list = new ArrayList<PolicyModel>(currentPolicies);
                list.remove(policy); // die darf sowieso nicht drin sein
                for (Iterator<PolicyModel> it = list.iterator(); it.hasNext();) {
                    PolicyModel next = it.next();
                    if (!PolicyUtilities.isValidPolicyFallback(policy, next)) {
                        it.remove(); // entferne alle invaliden
                    } else {
                            // prüfen, ob Policy schon Elternteil einer anderen Policy ist
                        for (int i=0; i<currentPolicies.size(); i++) {
                            PolicyModel ref = currentPolicies.get(i);
                            if(!ref.equals(next))
                                if(PolicyUtilities.isParentPolicy(ref, next))
                                    it.remove();
                        }
                    }
                }
               
                PolicyModel p = PolicyUtilities.getDummyPolicy();

                if ((list.isEmpty()) && (policy.getFallback() == null)) {
                    if(PolicyUtilities.isShowWarnings()) {
                        mb = PolicyUtilities.getMessageBundle();
                        PolicyUtilities.showMessageDialog(mb.getString("nofbavailable"), JOptionPane.INFORMATION_MESSAGE);
                   
                } else {
                    list.add(p);
                    Object[] policies = list.toArray();

                    FallBackChooserDialog dlg = new FallBackChooserDialog();
                    dlg.showDialog(policies);
                    Object result = dlg.getResult();
                    if (result != null) {
View Full Code Here


        appReceiverListsLst.setModel(currentApplication.getReceiverListsAsListModel());
        appReceiverListsLst.addPropertyChangeListener(appPcl);
    }
   
    public void deleteList() {
        ReceiverListModel selection = (ReceiverListModel) appReceiverListsLst.getSelectedValue();
        currentApplication.removeReceiverList(selection);
    }
View Full Code Here

        ReceiverListModel selection = (ReceiverListModel) appReceiverListsLst.getSelectedValue();
        currentApplication.removeReceiverList(selection);
    }
   
    public void jumpToList() {
        ReceiverListModel selection = (ReceiverListModel) appReceiverListsLst.getSelectedValue();
        dbModel.setCurrentReceiverList(selection);
       
        ListController cont = new ListController();
       
        dbModel.setActiveItem(ItemTypes.LIST);
View Full Code Here

                   
                    currentReceiverList = dbModel.getCurrentReceiverList();
                    currentReceiverList.addPropertyChangeListener(listPcl);
                    currentReceiverList.addPropertyChangeListener((ChangeListModel) listReceiverListsLst.getModel());
                    listReceiverListsLst.setSelectedValue(currentReceiverList, true);
                    ReceiverListModel prevApplication = (ReceiverListModel) evt.getOldValue();
                    if (prevApplication != null) {
                        prevApplication.removePropertyChangeListener(listPcl);
                    }
                    fillReceiverListGUI();
                } else if (propName.equals("editingStopped")) {
                    ReceiverModel rm = (ReceiverModel) listReceiversLst.getSelectedValue();
                    rm.setName(editorComp.getText());
View Full Code Here

TOP

Related Classes of de.netsysit.model.ReceiverListModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.