Package cli_fmw.directory.dialogs

Source Code of cli_fmw.directory.dialogs.DirectoryDialogDefault

/*
* DirectoryDialogDefault.java
*
* Created on 16 Январь 2008 г., 20:45
*/

package cli_fmw.directory.dialogs;

import cli_fmw.delegate.directory.Directory;
import cli_fmw.delegate.directory.DirectoryMagic;
import cli_fmw.delegate.directory.DirectoryItemRO;
import cli_fmw.delegate.directory.DirectoryItemRecursive;
import cli_fmw.main.ClipsException;
import cli_fmw.main.MainWindow;
import cli_fmw.main.audit.AuditManager;
import cli_fmw.utils.Selector;
import cli_fmw.utils.table_config_states.StateSaver;
import java.awt.Window;
import javax.swing.tree.TreeModel;

/**
*
* @author  Axe Ilshat
*/
public class DirectoryDialogDefault  extends GenericChooseDialog {
   
   
    private boolean canEdit;
           
    /** Creates new form DirectoryDialogDefault
     * @param selected
     * @param rootTitle
     * @param multipleSelected
     * @param directory
     * @throws ClipsException
     */
    public DirectoryDialogDefault(Window parent, boolean multipleSelected,
        Object selected, String rootTitle, Directory directory) throws ClipsException {
        super(parent, multipleSelected, selected, rootTitle, null);//NULL AL
        initComponents();
        setTitle(directory.getDirectoryTitle());
        Object items[] = directory.toArray();
        setData(items, tree, selectBtn, cancelBtn);
       
       
        attachSearchEngine(searchField);
       
        if(directory instanceof DirectoryMagic) {
            DirectoryMagic de = (DirectoryMagic)directory;
            canEdit = de.canEdit();
        }
    StateSaver.attachTo(this);
    }

    public DirectoryDialogDefault(boolean multipleSelected,
        Object selected, String rootTitle, Directory directory) throws ClipsException {

        super(multipleSelected, selected, rootTitle, null);//NULL AL
        initComponents();
        setTitle(directory.getDirectoryTitle());
        Object items[] = directory.toArray();
        setData(items, tree, selectBtn, cancelBtn);


        attachSearchEngine(searchField);

        if(directory instanceof DirectoryMagic) {
            DirectoryMagic de = (DirectoryMagic)directory;
            canEdit = de.canEdit();
        }
    StateSaver.attachTo(this);
    }

    @Override
    protected TreeModel getModel(Object[] items, String rootTitle ) {
        return new DirectoryDialogTreeModel(items, rootTitle);
    }

    @Override
    protected boolean isFit(Object item) throws ClipsException {
        if(item instanceof DirectoryItemRO) {
            DirectoryItemRO si = (DirectoryItemRO) item;
            if(si.isVisible()) {
                return true;
            }           
        }
        return false;
    }

   
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainTreePane = new javax.swing.JScrollPane();
        tree = new javax.swing.JTree();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        searchField = new javax.swing.JTextField();
        jPanel1 = new javax.swing.JPanel();
        selectBtn = new javax.swing.JButton();
        cancelBtn = new javax.swing.JButton();

        mainTreePane.setViewportView(tree);

        jPanel2.setLayout(new java.awt.BorderLayout(10, 0));

        jLabel1.setText("Поиск:");
        jPanel2.add(jLabel1, java.awt.BorderLayout.WEST);

        searchField.setColumns(15);
        jPanel2.add(searchField, java.awt.BorderLayout.CENTER);

        jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));

        selectBtn.setText("Выбрать");
        selectBtn.setEnabled(false);
        jPanel1.add(selectBtn);

        cancelBtn.setText("Отмена");
        jPanel1.add(cancelBtn);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)
                    .addComponent(mainTreePane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(mainTreePane, javax.swing.GroupLayout.DEFAULT_SIZE, 388, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(2, 2, 2)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton cancelBtn;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane mainTreePane;
    private javax.swing.JTextField searchField;
    private javax.swing.JButton selectBtn;
    private javax.swing.JTree tree;
    // End of variables declaration//GEN-END:variables
}
TOP

Related Classes of cli_fmw.directory.dialogs.DirectoryDialogDefault

TOP
Copyright © 2018 www.massapi.com. 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.