Package cli_fmw.delegate.directory.complex

Examples of cli_fmw.delegate.directory.complex.DirectoryTextTemplateTreeItem


    //Изменение текста
    @Override
    public void valueForPathChanged(TreePath path, Object newValue) {
        try {
            DirectoryTextTemplateTreeItem item = (DirectoryTextTemplateTreeItem) path.getLastPathComponent();
            item.setTitle(newValue.toString());
        } catch (ClipsException ex) {
            MessageBox.showException(ex);
        }
    }
View Full Code Here


private void btAddAtcNodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAddAtcNodeActionPerformed
    Object value = treeTextTemplates.getLastSelectedPathComponent();
    if (value instanceof DirectoryTextTemplateTreeItem){
        try {
            DirectoryTextTemplateTreeItem selected = (DirectoryTextTemplateTreeItem) 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 {
                    TextTemplateTreeDetails details = new TextTemplateTreeDetails();
                    details.title = tfName.getText();
                    details.parentItem = selected.getID();
                    DirectoryTextTemplateTreeItem newItem = new DirectoryTextTemplateTreeItem(details);
                    selected.getItems().append(newItem);
                }
                updateTree();
            }
        } catch (ClipsException ex) {
            MessageBox.showException(ex);
        }
    }else{
        try {
            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 {
                    TextTemplateTreeDetails details = new TextTemplateTreeDetails();
                    details.title = tfName.getText();
                    DirectoryTextTemplateTreeItem newItem = new DirectoryTextTemplateTreeItem(details);
                    templateTree.getItems().append(newItem);
                }
                updateTree();
            }
        } catch (ClipsException ex) {
View Full Code Here

            ArrayList path = new ArrayList();
            path.add(item);
            return path;
        }
        if(item instanceof DirectoryTextTemplateTreeItem) {
            DirectoryTextTemplateTreeItem parent = (DirectoryTextTemplateTreeItem)item;
            Selector ii = parent.getItems();
            for(int i=0; i<ii.size(); i++) {
                DirectoryItem child = (DirectoryItem) ii.get(i);
                List path = findMatch(child, pattern);
                if(path != null) {
                    path.add(parent);
View Full Code Here

    public int getChildCount(Object parent) {
      //  try {
            if(parent instanceof DefaultMutableTreeNode) {
                return items.size();
            } else {
                DirectoryTextTemplateTreeItem item = (DirectoryTextTemplateTreeItem)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 {
                DirectoryTextTemplateTreeItem item = (DirectoryTextTemplateTreeItem)parent;
                return item.getItems().get(index);
            }
        /*} catch (ClipsException ex) {
            ex.printStackTrace();
        }
        return null;*/
 
View Full Code Here

            } catch (ClipsException ex) {
                ex.printStackTrace();
            }
        } else if(parent instanceof DirectoryTextTemplateTreeItem) {
          //  try {
                DirectoryTextTemplateTreeItem item = (DirectoryTextTemplateTreeItem) parent;
                SelectorEditableExceptional<DirectoryTextTemplateTreeItem> sel = item.getItems();
                return sel.get(index);
           /* } catch (ClipsException ex) {
                ex.printStackTrace();
            }*/
        }
View Full Code Here

            } catch (ClipsException ex) {
                ex.printStackTrace();
            }
        } else if(parent instanceof DirectoryTextTemplateTreeItem) {
            //try {
                DirectoryTextTemplateTreeItem item = (DirectoryTextTemplateTreeItem) parent;
                SelectorEditableExceptional<DirectoryTextTemplateTreeItem> sel = item.getItems();
                return sel.size();
            /*} catch (ClipsException ex) {
                ex.printStackTrace();
            }*/
        }
View Full Code Here

        Object node = path.getLastPathComponent();
        if(node!= null &&
                node != root) {
            if(node instanceof DirectoryTextTemplateTreeItem) {
                try {
                    DirectoryTextTemplateTreeItem item = (DirectoryTextTemplateTreeItem) node;
                    item.setTitle(newValue.toString());
                } catch (ClipsException ex) {
                    MessageBox.showException(ex);
                }
            }
        }       
View Full Code Here

                } catch (ClipsException ex) {
                    ex.printStackTrace();
                }
            } else if(parent instanceof DirectoryTextTemplateTreeItem) {
               // try {
                    DirectoryTextTemplateTreeItem item = (DirectoryTextTemplateTreeItem) parent;
                    SelectorEditableExceptional<DirectoryTextTemplateTreeItem> sel = item.getItems();
                    for(int i=0; i<sel.size(); i++) {
                        if(sel.get(i) == child) {
                            return i;
                        }
                    }
View Full Code Here

}//GEN-LAST:event_mainTreeValueChanged

    private void rebuldListModel() {
        TreePath path = mainTree.getSelectionPath();
        Object treeItem = (path == null) ? null : path.getLastPathComponent();
        DirectoryTextTemplateTreeItem item = null;
        if (treeItem != null) {
            addGroupBtn.setEnabled(true);
            if (treeItem instanceof DirectoryTextTemplateTreeItem) {
                item = (DirectoryTextTemplateTreeItem) treeItem;
            }
        }

        DefaultListModel model = new DefaultListModel();
        if (item != null) {
            try {
                DirectoryTextTemplate dir = (DirectoryTextTemplate) DirectoryLocator.getDirectory(DirectoryTextTemplate.class, false);
                List<DirectoryTextTemplateItem> list = dir.getItems(item);
                for (int i = 0; i < list.size(); i++) {
                    DirectoryTextTemplateItem li = list.get(i);
                    System.out.println("Model + " + li);
                    model.add(i, li);
                }
                delGroupBtn.setEnabled(item.getItems().size() == 0);
            } catch (ClipsException ex) {
                MessageBox.showException(ex);
            }
        }
        mainList.setModel(model);
View Full Code Here

TOP

Related Classes of cli_fmw.delegate.directory.complex.DirectoryTextTemplateTreeItem

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.