Package de.netsysit.model

Examples of de.netsysit.model.ChangeListModel


                    }
                }
            }
        };

        policyAPoliciesLst.setModel(new ChangeListModel());
        policyCPoliciesLst.setModel(new ChangeListModel());
        policyIPoliciesLst.setModel(new ChangeListModel());
       
        policyAPoliciesLst.setDragEnabled(true);
        policyCPoliciesLst.setDragEnabled(true);
        policyIPoliciesLst.setDragEnabled(true);
        policyAPoliciesLst.setTransferHandler(new ListMoveTransferHandler());
View Full Code Here


            // prüfen, ob Liste als Model ChangeListModel besitzt
            if (!(list.getModel() instanceof ChangeListModel)) {
                return false;
            }
            final ChangeListModel model = (ChangeListModel) list.getModel();

            // prüfen, ob Flavor unterstützt
            final DataFlavor flavor = new ListMoveDataFlavor(model);
            if (!info.isDataFlavorSupported(flavor)) {
                return false;
            }

            // auslesen der Policies
            switch (dbModel.getActiveLevel()) {
                case A:
                    policies = dbModel.getAPolicies();
                    break;
                case C:
                    policies = dbModel.getCPolicies();
                    break;
                case I:
                    policies = dbModel.getIPolicies();
                    break;
            }

            // prüfen, der Dragvoraussetzung
            if (list.getSelectedIndex() != -1) {
                p = (PolicyModel) model.getElementAt(list.getSelectedIndex());

                if (PolicyUtilities.getParentPolicy(p, policies) != null) {
                    return false;
                }

                // prüfen, der Dropvoraussetzung
                int index = location.getIndex();
                if (index <= model.getSize() - 1) {
                    p = (PolicyModel) model.getElementAt(location.getIndex());
                    if (PolicyUtilities.getParentPolicy(p, policies) == null) {
                        return true;
                    } else {
                        return false;
                    }
View Full Code Here

        }

        @Override
        protected Transferable createTransferable(JComponent c) {
            final JList list = (JList) c;
            final ChangeListModel model = (ChangeListModel) list.getModel();
//      int[] selectedIndices = list.getSelectedIndices();
            PolicyModel p = (PolicyModel) model.getElementAt(list.getSelectedIndex());
            int count = 1;
            int index = list.getSelectedIndex();

            while (p.getFallback() != null) {
                count++;
View Full Code Here

            final ListModel lm = list.getModel();
            if (!(lm instanceof ChangeListModel)) {
                return false;
            }

            final ChangeListModel listModel = (ChangeListModel) lm;
            final DataFlavor flavor = new ListMoveDataFlavor(listModel);
            if (!info.isDataFlavorSupported(flavor)) {
                return false;
            }

            final Transferable transferable = info.getTransferable();
            try {
                final ListMoveTransferData data =
                        (ListMoveTransferData) transferable.getTransferData(flavor);

                // get the initial insertion index
                final JList.DropLocation dropLocation = list.getDropLocation();
                int insertAt = dropLocation.getIndex();

                // get the indices sorted (we use them in reverse order, below)
                final int[] indices = data.getIndices();
                PolicyModel p = (PolicyModel) lm.getElementAt(indices[0]);
                Arrays.sort(indices);

                // remove old elements from model, store them on stack
                final Stack<Object> elements = new Stack<Object>();
                int shift = 0;
                for (int i = indices.length - 1; i >= 0; i--) {
                    final int index = indices[i];
                    if (index < insertAt) {
                        shift--;
                    }
                    elements.push(listModel.remove(index));
                }
                insertAt += shift;

                // insert stored elements from stack to model
                final ListSelectionModel sm = list.getSelectionModel();
                try {
                    sm.setValueIsAdjusting(true);
                    sm.clearSelection();
                    final int anchor = insertAt;
                    while (!elements.isEmpty()) {
                        listModel.insertElementAt(elements.pop(), insertAt);
                        sm.addSelectionInterval(insertAt, insertAt++);
                    }
                    final int lead = insertAt - 1;
                    if (!sm.isSelectionEmpty()) {
                        sm.setAnchorSelectionIndex(anchor);
                        sm.setLeadSelectionIndex(lead);
                    }
                } finally {
                    // richtige Selection setzen
                    list.setSelectedValue(p, true);
                    int index = list.getSelectedIndex();
                    sm.setSelectionInterval(index, index);
                    sm.setValueIsAdjusting(false);
                    // Ränge neu ordnen
                    List<PolicyModel> policies = new ArrayList();
                    for (int i = 0; i < listModel.size(); i++) {
                        policies.add((PolicyModel) listModel.get(i));
                    }
                    PolicyUtilities.setPolicyRanks(policies, true);
                }
                return true;
            } catch (UnsupportedFlavorException ex) {
View Full Code Here

            public void changedUpdate(DocumentEvent e) {
                changeName();
            }
        };

        listReceiverListsLst.setModel(new ChangeListModel());
        listNameTxt.getDocument().addDocumentListener(listDl);
        dbModel.addPropertyChangeListener(listPcl);
        dbModel.addPropertyChangeListener((ChangeListModel)listReceiverListsLst.getModel());
        listReceiversLst.setListCellEditor(new DefaultListCellEditor(editorComp));
View Full Code Here

TOP

Related Classes of de.netsysit.model.ChangeListModel

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.