Package clips.delegate.directory.complex

Examples of clips.delegate.directory.complex.DirectoryVidalFarmItem


        line = line.substring(1);
       
        ClassificationFarmDetails details = new ClassificationFarmDetails();
        details.title = line;
       
        DirectoryVidalFarmItem item = null;
       
        if (range == 0){
            item = new DirectoryVidalFarmItem(details);
            root.getItems().append(item);
            subRoot[0] = item;             
        }else{
            details.parentItem = subRoot[range-1].getID();
            item = new DirectoryVidalFarmItem(details);
            subRoot[range-1].getItems().append(item);
        }
        System.out.println("ITEM: "+ item.getTitle() + "--> add to " + (item.getParent() == null ? "directory" : item.getParent().getTitle()));
    }
View Full Code Here


    public int getChildCount(Object parent) {
     //   try {
            if(parent instanceof DefaultMutableTreeNode) {
                return items.size();
            } else {
                DirectoryVidalFarmItem item = (DirectoryVidalFarmItem)parent;
                return item.getItems().size();
            }
     /*   } catch (ClipsException ex) {
            ex.printStackTrace();
        }
        return 0;*/
 
View Full Code Here

    public Object getChild(Object parent, int index) {
     //   try {
            if(parent instanceof DefaultMutableTreeNode) {
              return items.get(index);
            } else {
                DirectoryVidalFarmItem item = (DirectoryVidalFarmItem)parent;
                return item.getItems().get(index);
            }
    /*    } catch (ClipsException ex) {
            ex.printStackTrace();
        }
        return null;*/
 
View Full Code Here

    //Изменение текста группы услуг
    @Override
    public void valueForPathChanged(TreePath path, Object newValue) {
        try {
            if (path.getLastPathComponent() instanceof DirectoryVidalFarmItem) {
                DirectoryVidalFarmItem item = (DirectoryVidalFarmItem) path.getLastPathComponent();
                item.setTitle(newValue.toString());
            }
            else {
                MessageBox.showWarning("Запрещено менять заголовок дерева");
            }
        } catch (ClipsException ex) {
View Full Code Here

    @Override
    public int getIndexOfChild(Object parent, Object child) {
        if (parent instanceof TreeNode) return super.getIndexOfChild(parent, child);
        if (parent instanceof DirectoryVidalFarmItem){
            DirectoryVidalFarmItem p = (DirectoryVidalFarmItem) parent;
            DirectoryVidalFarmItem c = (DirectoryVidalFarmItem) child;
          //  try {
                for (int i = 0; i< p.getItems().size(); i++){
                    if (c.getID() == p.getItems().get(i).getID()){
                        return i;
                    }
                }
               
          /*  } catch (ClipsException ex) {
View Full Code Here

    resizeColumn();

        DirectoryItemRO[] farmItems = directoryVidalFarm.toArray(false, true);
        String[] farmStrings = new String[farmItems.length];
        for (int i = 0; i < farmItems.length; i++) {
            DirectoryVidalFarmItem item = (DirectoryVidalFarmItem) farmItems[i];
            DirectoryVidalFarmItem parent = item.getParent();
            farmStrings[i] = item.getTitle() + (parent != null ? " (" + parent.getTitle() + ")" : "");
        }

        DefaultComboBoxModel model = new DefaultComboBoxModel(directoryVidalFarm.toArray(false, true)/*farmStrings*/);
        model.insertElementAt("", 0);
        model.setSelectedItem("");
View Full Code Here

private void treeVidalFarmValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_treeVidalFarmValueChanged
    Object value = treeVidalFarm.getLastSelectedPathComponent();
    vidalItems = new ArrayList<DirectoryVidalItem>();
    if (value instanceof DirectoryVidalFarmItem){
        try {
            DirectoryVidalFarmItem item = (DirectoryVidalFarmItem) value;
            SelectorEditableExceptional<DirectoryVidalItem> s = directoryVidal.getFilteredItems(item);
            if (s != null) {
                for (int i = 0; i < s.size(); i++) {
                    vidalItems.add(s.get(i));
                }
View Full Code Here

}//GEN-LAST:event_btDeleteVidalActionPerformed

private void btAddFarmNodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAddFarmNodeActionPerformed
    try {
        Object value = treeVidalFarm.getLastSelectedPathComponent();
        DirectoryVidalFarmItem newItem = null;
        if (value instanceof DirectoryVidalFarmItem) {
            DirectoryVidalFarmItem selected = (DirectoryVidalFarmItem) value;
            tfName.setText("");
            int res = JOptionPane.showConfirmDialog(null, pnlNewNode, "Заполните поля", JOptionPane.OK_CANCEL_OPTION, -1);
            if (res == JOptionPane.OK_OPTION) {
                if (tfName.getText().isEmpty()) {
                    MessageBox.showWarning(MessageBox.W_INCORRECT_DATA);
                    return;
                } else {
                    ClassificationFarmDetails details = new ClassificationFarmDetails();
                    details.title = tfName.getText();
                    details.parentItem = selected.getID();
                    newItem = new DirectoryVidalFarmItem(details);
                    selected.getItems().append(newItem);
                }
            }
        } else {
            tfName.setText("");
            int res = JOptionPane.showConfirmDialog(null, pnlNewNode, "Заполните поля", JOptionPane.OK_CANCEL_OPTION, -1);
            if (res == JOptionPane.OK_OPTION) {
                if (tfName.getText().isEmpty()) {
                    MessageBox.showWarning(MessageBox.W_INCORRECT_DATA);
                    return;
                } else {
                    ClassificationFarmDetails details = new ClassificationFarmDetails();
                    details.title = tfName.getText();
                    newItem = new DirectoryVidalFarmItem(details);
                    directoryVidalFarm.getItems().append(newItem);
                }
            }
        }
        updateTree();
View Full Code Here

    if (treeVidalFarm.getSelectionCount()>0 && selectedFarm != null) {
        try {
            if (selectedFarm.getItems().size() > 0) {
                MessageBox.showWarning(MessageBox.W_CANT_DEL_HAVE_CHILDREN);
            } else {
                DirectoryVidalFarmItem parent = selectedFarm.getParent();
                SelectorEditableExceptional<DirectoryVidalItem> s = directoryVidal.getFilteredItems(selectedFarm);
                while (s.size() > 0) {
                    s.remove(0);
                }
                if (selectedFarm.getParent() != null) {
View Full Code Here

    @Override
    public void print() {
        if (readyForPrint()) {
            String title = "Клинико-фармакологическая классификация лекарственных средств:";
            String group = "";
            DirectoryVidalFarmItem parent = selectedFarm;
            ArrayList<String> titles = new ArrayList<String>();
            while (parent != null) {
                titles.add(parent.getTitle()+ "\n");               
                parent = parent.getParent();
            }
            int k = titles.size() - 1;
            for (int i = k; i > -1; i--) {
                String iS  = titles.get(i);
                for (int j = i; j < k; j++) {
View Full Code Here

TOP

Related Classes of clips.delegate.directory.complex.DirectoryVidalFarmItem

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.