[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: prowler demo. Edit properities -> NP-Exception



Hi,
 
> With prowler0.2 you released version 1.4 of ProwlerConfigDialog.java.
> But you sent the diff for version 1.5. The file doesn't compile
> if I apply that patch. 
> Can you sent my the whole file, please?
 
Sorry for that. I've attached the file. But I think we'll make a new Prowler
release in the next few days.

Best Regards,
Gerd

-- 
________________________________________________________________
Gerd Mueller                               gerd@softwarebuero.de
softwarebuero m&b                    http://www.softwarebuero.de

// You can redistribute this software and/or modify it under the terms of
// the Infozone Core License version 1 published by the Infozone Group
// (http://www.infozone-group.org).
//
// Copyright (C) 2000 by The Infozone Group. All rights reserved.
//
// $Id: Prowler.java,v 1.31 2000/05/26 17:48:14 gerd Exp $

package samples.demo.pconfig;

import java.awt.*;
import java.io.File;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.filechooser.*;
import javax.swing.table.*;
import javax.swing.event.*;
import java.util.*;

import org.ozoneDB.infozone.prowler.*;
import samples.demo.*;

/**
*/
public class ProwlerConfigDialog extends StandardDialog 
                                 implements ActionListener, TableModelListener,FocusListener {
    // Constants ---------------------------------------------
    /** The Title of the Dialog */
    public static final String szTitle = "Prowler Configuration Dialog";
    private static final int GRIDSPACING = 5;
    private static final int LABELWIDTH = 30*GRIDSPACING;
    private static final int BUTTONWIDTH = 25 * GRIDSPACING;
    private static final int BUTTONHEIGHT = 5 * GRIDSPACING;
    private static final String FILENAME = "properties.xml";   
    
    // Variables ---------------------------------------------
    /** The Standalone-Flag. If it is true, the Dialog runs in Standalone-Mode*/
    private static boolean bnInStandaloneMode = false;
    /** The Data for all GUI-Elements */
    private ProwlerConfigDialogData pcddTheData = null;
    /** The alias of the currently selected Adapter */
    private String szCurrentAdapter = "";
    /** The alias of the currently selected Resource */
    private String szCurrentResource = "";
    /** The prowler-properties, the dialog works with. */
    private ProwlerProperties pp = null;
    
    // GUI-Elements ------------------------------------------
    private JButton jbtExit = new JButton ("Close");
    private JButton jbtLoad = new JButton ("Load");
    private JButton jbtStore = new JButton ("Save");

    private JTextField jtfProwlerName = new JTextField ();
    private JComboBox jcbProwlerRootAdapter = new JComboBox ();
    private JTextField jtfProwlerUserManager = new JTextField ();
    private JComboBox jcbProwlerResource = new JComboBox ();

    private JComboBox jcbAdapterAliases = new JComboBox ();
    private JComboBox jcbAdapterXMLCache = new JComboBox ();
    private JList jlsAdapterResources = new JList ();
    private JTextField jtfAdapterClassName = new JTextField ();
    private JButton jbtAdapterNew = new JButton ("New");
    private JButton jbtAdapterRemove = new JButton ("Delete");
    private JButton jbtAdapterNewProperty = new JButton ("New");
    private JButton jbtAdapterRemoveProperty = new JButton ("Delete");
    private JButton jbtAdapterRename = new JButton ("Rename");
    private JButton jbtAdapterNewResource = new JButton ("Add");
    private JButton jbtAdapterRemoveResource = new JButton ("Remove");
    private JTable jtbAdapterProperties = new JTable (new DefaultTableModel ());

    private JTextField jtfResourceClassName = new JTextField ();
    private JComboBox jcbResourceNames = new JComboBox ();
    private JButton jbtResourceNew = new JButton ("New");
    private JButton jbtResourceRemove = new JButton ("Delete");    
    private JButton jbtResourceNewProperty = new JButton ("New");
    private JButton jbtResourceRemoveProperty = new JButton ("Delete");
    private JButton jbtResourceRename = new JButton ("Rename");
    private JTable jtbResourceProperties = new JTable (new DefaultTableModel ());
    
    // Constructors ------------------------------------------
    /** The Constructor. Creates a new ConfigDialog
    @param JFrame parent - the Parent Frame
    @param String title - the desired title for the Dialog
    @param boolean modal - the flag, that sets, if this Dialog is modal or not
    */
    public ProwlerConfigDialog (JFrame parent) {
        super (parent, "Prowler Properties Configuration", true);
        
        if (bnInStandaloneMode) {
            addWindowListener (new WindowAdapter () {
                public void windowClosing (WindowEvent weEvent) {
                    System.exit (0);
                    }
                });
            
            pp = new ProwlerProperties ();
            createInsets ();
            update ();
            }     

        setResizable (false);
        setVisible (bnInStandaloneMode);
        }


    // Methods -----------------------------------------------
    /** Creates all insets of the Dialog, these are a lot!!
    */
    private void createInsets () {
        
        // The whole thing is a JTabbedPane:
        JTabbedPane jtpMainPane = new JTabbedPane ();
        
        // There are 3 JPanel in this Pane:
        // The Prowler, the Adapter, the Resource
        JPanel jpProwler = new JPanel ();
        JPanel jpAdapter = new JPanel ();
        JPanel jpResource  = new JPanel ();
        
        // At first - the Prowler-Panel
        jpProwler.setLayout (new AbsoluteLayout ());
        
        int iX = 2*GRIDSPACING;
        int iY = 10*GRIDSPACING;
        
        jpProwler.add (new JLabel ("Prowler Name"), new AbsoluteConstraints (iX, iY, LABELWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpProwler.add (new JLabel ("Root Adapter"), new AbsoluteConstraints (iX, iY, LABELWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpProwler.add (new JLabel ("User Manager"), new AbsoluteConstraints (iX, iY, LABELWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpProwler.add (new JLabel ("Database"), new AbsoluteConstraints (iX, iY, LABELWIDTH, BUTTONHEIGHT));
        
        iX = 2*GRIDSPACING + LABELWIDTH;
        iY = 10*GRIDSPACING;
        
        jpProwler.add (jtfProwlerName, new AbsoluteConstraints (iX, iY, 4*BUTTONWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpProwler.add (jcbProwlerRootAdapter, new AbsoluteConstraints (iX, iY, 4*BUTTONWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpProwler.add (jtfProwlerUserManager, new AbsoluteConstraints (iX, iY, 4*BUTTONWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpProwler.add (jcbProwlerResource, new AbsoluteConstraints (iX, iY, 4*BUTTONWIDTH, BUTTONHEIGHT));

        // The Adapter Panel 
        
        jpAdapter.setLayout (new AbsoluteLayout ());
        iX = 2*GRIDSPACING;
        iY = 10*GRIDSPACING;
        jpAdapter.add (new JLabel ("Adapters"), new AbsoluteConstraints (iX, iY, LABELWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpAdapter.add (new JLabel ("Adapter Class"), new AbsoluteConstraints (iX, iY, LABELWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpAdapter.add (new JLabel ("Adapter XML-Cache"), new AbsoluteConstraints (iX, iY, LABELWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpAdapter.add (new JLabel ("Adapter Resources"),  new AbsoluteConstraints (iX, iY, LABELWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpAdapter.add (new JLabel ("Adapter Properties"), new AbsoluteConstraints (iX, iY, LABELWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpAdapter.add (new JScrollPane (jtbAdapterProperties), new AbsoluteConstraints (iX, iY, LABELWIDTH + 4*BUTTONWIDTH, 4*BUTTONHEIGHT));
        
        iX = 2*GRIDSPACING + LABELWIDTH;
        iY = 10*GRIDSPACING;
        
        jpAdapter.add (jcbAdapterAliases, new AbsoluteConstraints (iX, iY, 4*BUTTONWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpAdapter.add (jtfAdapterClassName, new AbsoluteConstraints (iX, iY, 4*BUTTONWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpAdapter.add (jcbAdapterXMLCache, new AbsoluteConstraints (iX, iY, 4*BUTTONWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpAdapter.add (new JScrollPane (jlsAdapterResources), new AbsoluteConstraints (iX, iY, 4*BUTTONWIDTH, 2*BUTTONHEIGHT+GRIDSPACING));
        

        iX = 4*GRIDSPACING + 4*BUTTONWIDTH + LABELWIDTH;
        iY = 10*GRIDSPACING;

        jpAdapter.add (jbtAdapterNew, new AbsoluteConstraints (iX, iY, BUTTONWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpAdapter.add (jbtAdapterRename, new AbsoluteConstraints (iX, iY, BUTTONWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpAdapter.add (jbtAdapterRemove, new AbsoluteConstraints (iX, iY, BUTTONWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpAdapter.add (jbtAdapterNewResource, new AbsoluteConstraints (iX, iY, BUTTONWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpAdapter.add (jbtAdapterRemoveResource, new AbsoluteConstraints (iX, iY, BUTTONWIDTH, BUTTONHEIGHT));

        iY += 2*BUTTONHEIGHT + 2*GRIDSPACING;
        jpAdapter.add (jbtAdapterNewProperty, new AbsoluteConstraints (iX, iY, BUTTONWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpAdapter.add (jbtAdapterRemoveProperty, new AbsoluteConstraints (iX, iY, BUTTONWIDTH, BUTTONHEIGHT));
        
        // And the Resources Panel
        jpResource.setLayout (new AbsoluteLayout ());
        iX = 2*GRIDSPACING;
        iY = 10*GRIDSPACING;
        jpResource.add (new JLabel ("Resources"), new AbsoluteConstraints (iX, iY, LABELWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpResource.add (new JLabel ("Resource Class"), new AbsoluteConstraints (iX, iY, LABELWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpResource.add (new JLabel ("Resource Properties"), new AbsoluteConstraints (iX, iY, LABELWIDTH*2, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpResource.add (new JScrollPane (jtbResourceProperties), new AbsoluteConstraints (iX, iY, LABELWIDTH + 4*BUTTONWIDTH, 4*BUTTONHEIGHT));
        
        iX = 2*GRIDSPACING + LABELWIDTH;
        iY = 10*GRIDSPACING;
        
        jpResource.add (jcbResourceNames, new AbsoluteConstraints (iX, iY, 4 * BUTTONWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpResource.add (jtfResourceClassName, new AbsoluteConstraints (iX, iY, 4*BUTTONWIDTH, BUTTONHEIGHT));
        
        iX = 4*GRIDSPACING + 4*BUTTONWIDTH + LABELWIDTH;
        iY = 10*GRIDSPACING;
       
        jpResource.add (jbtResourceNew, new AbsoluteConstraints (iX, iY, BUTTONWIDTH, BUTTONHEIGHT));
        iY += GRIDSPACING + BUTTONHEIGHT;
        jpResource.add (jbtResourceRename, new AbsoluteConstraints (iX, iY, BUTTONWIDTH, BUTTONHEIGHT));
        iY += GRIDSPACING + BUTTONHEIGHT;
        jpResource.add (jbtResourceRemove, new AbsoluteConstraints (iX, iY, BUTTONWIDTH, BUTTONHEIGHT));
        iY += 2*BUTTONHEIGHT + 2*GRIDSPACING;
        jpResource.add (jbtResourceNewProperty, new AbsoluteConstraints (iX, iY, BUTTONWIDTH, BUTTONHEIGHT));
        iY += BUTTONHEIGHT + GRIDSPACING;
        jpResource.add (jbtResourceRemoveProperty, new AbsoluteConstraints (iX, iY, BUTTONWIDTH, BUTTONHEIGHT));
        
        // Now these JPanel will be added to the JTabbedPane        
        
        jtpMainPane.addTab ("Prowler", null, jpProwler, "Prowler-Settings");
        jtpMainPane.addTab ("Adapters", null, jpAdapter, "Adapter-Settings");
        jtpMainPane.addTab ("Resources", null, jpResource, "Resources-Settings");
        
       
        // Add the tooltips     
        jbtExit.setToolTipText ("Exit this configuration dialog.");
        jbtLoad.setToolTipText ("Load a configuration file.");
        jbtStore.setToolTipText ("Store this configuration.");

        jtfProwlerName.setToolTipText ("The name of this Prowler.");
        jcbProwlerRootAdapter.setToolTipText ("The full qualified classname of the Prowler's RootAdapter.");
        jtfProwlerUserManager.setToolTipText ("The full qualified classname of the Prowlers's UserManager.");
        jcbProwlerResource.setToolTipText ("The Database, the Prowler uses.");

        jtfAdapterClassName.setToolTipText ("The full qualified classname of this Adapter");
        jtbAdapterProperties.setToolTipText ("The properties of this Adapter and their values.");        
        jbtAdapterNew.setToolTipText ("Add a new Adapter.");
        jbtAdapterRemove.setToolTipText ("Remove this Adapter.");
        jbtAdapterNewProperty.setToolTipText ("Add a new Property.");
        jbtAdapterRemoveProperty.setToolTipText ("Remove this Property.");       
        jcbAdapterAliases.setToolTipText ("The names of all known Adapters.");
        jcbAdapterXMLCache.setToolTipText ("The XML-Cache of this Adapter.");
        jbtAdapterRename.setToolTipText ("Rename this Adapter.");
        jlsAdapterResources.setToolTipText ("All Resources used by this Adapter.");        
        jbtAdapterNewResource.setToolTipText ("Add a Resource to this Adapter.");
        jbtAdapterRemoveResource.setToolTipText ("Remove this Resource from this Adapter.");
        
        jbtResourceNew.setToolTipText ("Add a new Resource.");
        jbtResourceRemove.setToolTipText ("Remove this Resource.");
        jtfResourceClassName.setToolTipText ("The full qualified classname of this Resource.");
        jcbResourceNames.setToolTipText ("The names of all known Resources.");
        jbtResourceNewProperty.setToolTipText ("Add a new Property.");
        jbtResourceRemoveProperty.setToolTipText ("Remove this Property.");
        jtbResourceProperties.setToolTipText ("The properties of this Resource and their values.");
        jbtResourceRename.setToolTipText ("Rename this Resource.");
        
        // Here the Buttons are made. ...        
        JPanel jpButtons = new JPanel ();
        jpButtons.setLayout (new FlowLayout (FlowLayout.RIGHT));

        jcbAdapterAliases.addActionListener (this);
        jcbResourceNames.addActionListener (this);
        jcbAdapterXMLCache.addActionListener (this);
        jcbProwlerResource.addActionListener (this);
        jcbProwlerRootAdapter.addActionListener (this);
        jbtExit.addActionListener (this);
        jbtLoad.addActionListener (this);
        jbtStore.addActionListener (this);

        jbtAdapterNewProperty.addActionListener (this);
        jbtAdapterRemoveProperty.addActionListener (this);
        jbtAdapterNew.addActionListener (this);
        jbtAdapterRemove.addActionListener (this);
        jbtAdapterRename.addActionListener (this);
        jbtAdapterNewResource.addActionListener (this);
        jbtAdapterRemoveResource.addActionListener (this);
        
        jbtResourceNewProperty.addActionListener (this);
        jbtResourceRemoveProperty.addActionListener (this);
        jbtResourceNew.addActionListener (this);
        jbtResourceRemove.addActionListener (this);
        jbtResourceRename.addActionListener (this);
        
        jtfAdapterClassName.addFocusListener (this);
        jtfProwlerName.addFocusListener (this);
        jtfProwlerUserManager.addFocusListener (this);
        jtfResourceClassName.addFocusListener (this);
        
        jpButtons.add (jbtLoad);
        jpButtons.add (jbtStore);
        jpButtons.add (jbtExit);
        
        jtbAdapterProperties.addFocusListener (this);
        jtbResourceProperties.addFocusListener (this);
        
        pcddTheData = new ProwlerConfigDialogData (pp);
        pcddTheData.fillAdapterAliasesInto (jcbAdapterAliases);
        pcddTheData.fillAdapterAliasesInto (jcbProwlerRootAdapter);
        pcddTheData.fillResourceAliasesInto (jcbResourceNames);
        pcddTheData.fillResourceAliasesInto (jcbProwlerResource);
        pcddTheData.fillResourceAliasesInto (jcbAdapterXMLCache);
        
        
        szCurrentAdapter =  (String) jcbAdapterAliases.getSelectedItem ();
        szCurrentResource = (String) jcbResourceNames.getSelectedItem ();
        
        checkLock ();
        
        // Add the JTabbedPane to the MainFrame
        getContentPane ().add (jtpMainPane, BorderLayout.CENTER);
        // Add the ButtonPanel to the MainFrame
        getContentPane ().add (jpButtons, BorderLayout.SOUTH);
        pack ();
        }
    
    
//-----------------------------------------------------------------------------------------//
    
    /** */
    public void init (DemoFrame parent, Prowler prowler, ProwlerSession session) {
        _prowler = prowler;
        pp = _prowler.properties();
        createInsets ();
        update();
        
        super.init (parent, prowler, session);
        }

//-----------------------------------------------------------------------------------------//
        
    /** */
    private void update() {
        updateProwlerPanel ();
        updateAdapterPanel (szCurrentAdapter);
        updateResourcePanel (szCurrentResource);
        }
        
//-----------------------------------------------------------------------------------------//
    /** The FocusGained Method, which is part of the FocusListener-Interface
    @param FocusEvent event - a FocusEvent, that has been released by some GUI-Element
    */
    public void focusGained (FocusEvent event) {
        }
    
    /** The FocusLost Method, which is part of the FocusListener-Interface
    @param FocusEvent event - a FocusEvent, that has been released by some GUI-Element
    */
    public void focusLost (FocusEvent event) {
        Object src = event.getSource ();
        
        if (src == jtfAdapterClassName) {
            AdapterData ad = pcddTheData.getAdapter (szCurrentAdapter);
            ad.szClassName = jtfAdapterClassName.getText ();
            pcddTheData.setAdapter (ad);
            }
        else if (src == jtfProwlerName) {
            pcddTheData.setProwlerName (jtfProwlerName.getText ());
            }
        else if (src == jtfProwlerUserManager) {
            pcddTheData.setUserManager(jtfProwlerUserManager.getText ());
            }
        else if (src == jtfResourceClassName) {
            ResourceData rd = pcddTheData.getResource (szCurrentResource);
            rd.szClassName = jtfResourceClassName.getText ();
            pcddTheData.setResource (rd);
            }  
        }
    

    /** The actionPerformed Method, which is part of the ActionListener-Interface
    @param ActionEvent event - an ActionEvent, that has been released by some GUI-Element
    */
    public void actionPerformed (ActionEvent event) {
        Object src = event.getSource ();
        
        if (src == jbtExit) {
            setVisible (false);
            if (bnInStandaloneMode) {
                System.exit (0);
                }
            }
        else if (src == jbtLoad) {
            load ();
            }
        else if (src == jbtStore) {
            store ();    
            }
        else if (src == jcbAdapterAliases) {
            szCurrentAdapter = (String) jcbAdapterAliases.getSelectedItem();
            updateAdapterPanel (szCurrentAdapter);
            }
        else if (src == jcbAdapterXMLCache) {
            AdapterData ad = pcddTheData.getAdapter (szCurrentAdapter);
            ad.szXMLCache = (String) jcbAdapterXMLCache.getSelectedItem ();
            pcddTheData.setAdapter (ad);
            }
        else if (src == jcbProwlerResource) {
            pcddTheData.setUserManagerDB ((String) jcbProwlerResource.getSelectedItem ());
            }
        else if (src == jcbProwlerRootAdapter) {
            pcddTheData.setProwlerAdapter ((String) jcbProwlerRootAdapter.getSelectedItem ());
            }        
        else if (src == jcbResourceNames) {
            szCurrentResource = (String)jcbResourceNames.getSelectedItem();
            updateResourcePanel (szCurrentResource);
            }
        else if (src == jbtAdapterNewProperty) {
            pcddTheData.setAdapterProperty (szCurrentAdapter, "NewProperty", "-1");
            updateAdapterPanel (szCurrentAdapter);
            }
        else if (src == jbtResourceNewProperty) {
            pcddTheData.setResourceProperty (szCurrentResource, "NewProperty", "-1");
            updateResourcePanel (szCurrentResource);
            }
        else if (src == jbtAdapterRemoveProperty) {
            int iSelectedRow = jtbAdapterProperties.getSelectedRow ();
            if (jtbAdapterProperties.isRowSelected (iSelectedRow)) {
                String szAdapterProperty = (String) jtbAdapterProperties.getModel ().getValueAt (iSelectedRow, 0);
                pcddTheData.deleteAdapterProperty (szCurrentAdapter, szAdapterProperty);
                updateAdapterPanel (szCurrentAdapter);
                }
            }
        else if (src == jbtResourceRemoveProperty) {
            int iSelectedRow = jtbResourceProperties.getSelectedRow ();
            if (jtbResourceProperties.isRowSelected (iSelectedRow)) {
                String szResourceProperty = (String) jtbResourceProperties.getModel ().getValueAt (iSelectedRow, 0);
                pcddTheData.deleteResourceProperty (szCurrentResource, szResourceProperty);
                updateResourcePanel (szCurrentResource);
                }
            }
        else if (src == jbtAdapterNew) {
            String szResult = (String) JOptionPane.showInputDialog (this, "Please enter the alias of the new Adapter:", "Input", JOptionPane.QUESTION_MESSAGE, null,null,"");
            if (szResult != null && szResult != "") {
                szCurrentAdapter = szResult;
                pcddTheData.newAdapter (szCurrentAdapter, "[enter classname]",  "");
                pcddTheData.fillAdapterAliasesInto (jcbAdapterAliases);
                pcddTheData.fillAdapterAliasesInto (jcbProwlerRootAdapter);
                jcbAdapterAliases.setSelectedItem (szCurrentAdapter);
                updateAdapterPanel (szCurrentAdapter);
                checkLock ();
                }
            }
        else if (src == jbtAdapterRemove) {
            pcddTheData.deleteAdapter (szCurrentAdapter);
            pcddTheData.fillAdapterAliasesInto (jcbAdapterAliases);
            pcddTheData.fillAdapterAliasesInto (jcbProwlerRootAdapter);
            szCurrentAdapter = (String) jcbAdapterAliases.getSelectedItem ();
            updateAdapterPanel (szCurrentAdapter);        
            checkLock ();
            }
        else if (src == jbtResourceNew) {
            String szResult = (String) JOptionPane.showInputDialog (this, "Please the alias of the new Resource:", "Input", JOptionPane.QUESTION_MESSAGE, null,null,"");
            if (szResult != null && szResult != "") {
                szCurrentResource = szResult;
                pcddTheData.newResource (szCurrentResource, "[enter classname]");
                pcddTheData.fillResourceAliasesInto (jcbResourceNames);
                pcddTheData.fillResourceAliasesInto (jcbAdapterXMLCache);
                pcddTheData.fillResourceAliasesInto (jcbProwlerResource);
                jcbResourceNames.setSelectedItem (szCurrentResource);
                updateResourcePanel (szCurrentResource);
                checkLock ();
                }
            }
        else if (src == jbtResourceRemove) {
            pcddTheData.deleteResource (szCurrentResource);
            pcddTheData.fillResourceAliasesInto (jcbResourceNames);
            pcddTheData.fillResourceAliasesInto (jcbProwlerResource);
            pcddTheData.fillResourceAliasesInto (jcbAdapterXMLCache);
            szCurrentResource = (String) jcbResourceNames.getSelectedItem ();
            updateResourcePanel (szCurrentResource);        
            checkLock ();
            }
        else if (src == jbtResourceRename) {
            String szNewName = (String) JOptionPane.showInputDialog (this, "Please the new alias of the Resource "+szCurrentResource+" :", "Input", JOptionPane.QUESTION_MESSAGE, null,null,"");
            if (szNewName != null && szNewName != "") {
                pcddTheData.renameResource (szCurrentResource, szNewName);
                szCurrentResource = szNewName;
                pcddTheData.fillResourceAliasesInto (jcbResourceNames);
                pcddTheData.fillResourceAliasesInto (jcbAdapterXMLCache);
                pcddTheData.fillResourceAliasesInto (jcbProwlerResource);
                jcbResourceNames.setSelectedItem (szCurrentResource);
                updateResourcePanel (szCurrentResource);
                }
            }
        else if (src == jbtAdapterRename) {
            String szNewName = (String) JOptionPane.showInputDialog (this, "Please enter the new alias of the Adapter "+szCurrentAdapter+" :", "Input", JOptionPane.QUESTION_MESSAGE, null,null,"");
            if (szNewName != null && szNewName != "") {
                pcddTheData.renameAdapter (szCurrentAdapter, szNewName);
                szCurrentAdapter = szNewName;
                pcddTheData.fillAdapterAliasesInto (jcbAdapterAliases);
                pcddTheData.fillAdapterAliasesInto (jcbProwlerRootAdapter);
                jcbAdapterAliases.setSelectedItem (szCurrentAdapter);
                updateAdapterPanel (szCurrentAdapter);
                }
            }
        else if (src == jbtAdapterNewResource) {
            String szNewName = (String) JOptionPane.showInputDialog (this, "Please select the Resource to add to the Adapter "+szCurrentAdapter+" :", "Input",
                                        JOptionPane.QUESTION_MESSAGE, null,pcddTheData.getResourceAliases (), null);
            if (szNewName != null && szNewName != "") {
                pcddTheData.setAdapterResource (szCurrentAdapter, szNewName);
                updateAdapterPanel (szCurrentAdapter);
                }
            }
        else if (src == jbtAdapterRemoveResource) {
            int iIndex = jlsAdapterResources.getSelectedIndex ();
            String szAdapterResource = (String) jlsAdapterResources.getModel ().getElementAt (iIndex);
            pcddTheData.deleteAdapterResource (szCurrentAdapter, szAdapterResource);
            updateAdapterPanel (szCurrentAdapter);
            }
        }    
    /** The tableChangedMethod , which is part of the TableModelListener-Interface
    @param TableModelEvent event - the TableModelEvent that has been released by some Table
    */
    
   public void tableChanged (TableModelEvent event) {
        Object src = event.getSource ();
        if (src == jtbAdapterProperties.getModel ()) {
            DefaultTableModel dtm = (DefaultTableModel) jtbAdapterProperties.getModel ();
            for (int iCount = 0; iCount < dtm.getRowCount (); iCount ++) {
                String szPropertyName = (String) dtm.getValueAt (iCount, 0);
                String szPropertyValue = (String) dtm.getValueAt (iCount, 1);
                pcddTheData.setAdapterProperty (szCurrentAdapter, szPropertyName, szPropertyValue);
                }
            }
        else if (src == jtbResourceProperties.getModel ()) {
            DefaultTableModel dtm = (DefaultTableModel) jtbResourceProperties.getModel ();
            for (int iCount = 0; iCount < dtm.getRowCount (); iCount ++) {
                String szPropertyName = (String) dtm.getValueAt (iCount, 0);
                String szPropertyValue = (String) dtm.getValueAt (iCount, 1);
                pcddTheData.setResourceProperty (szCurrentResource,szPropertyName, szPropertyValue);
                }
            }
        }

//-----------------------------------------------------------------------------------------//

    /** */
    private void updateProwlerPanel() {
        jtfProwlerName.setText (pcddTheData.getProwlerName ());
        jcbProwlerResource.setSelectedItem (pcddTheData.getUserManagerDB ());
        jcbProwlerRootAdapter.setSelectedItem (pcddTheData.getProwlerAdapter ());
        jtfProwlerUserManager.setText (pcddTheData.getUserManager ());
        }
        
//-----------------------------------------------------------------------------------------//
    /** */
    private void updateAdapterPanel (String adapter) {
        if (adapter == null) return;
        jtfAdapterClassName.setText (pcddTheData.getAdapter (adapter).szClassName);
        jcbAdapterXMLCache.setSelectedItem (pcddTheData.getAdapter (adapter).szXMLCache);
        pcddTheData.fillAdapterPropertiesInto (adapter, jtbAdapterProperties, this);
        pcddTheData.fillAdapterResourcesInto (adapter, jlsAdapterResources);
        }

//-----------------------------------------------------------------------------------------//
    /** */
    private void updateResourcePanel (String szResource) {
        if (szResource == null) return;
        jtfResourceClassName.setText (pcddTheData.getResource (szResource).szClassName);
        pcddTheData.fillResourcePropertiesInto (szResource, jtbResourceProperties, this);
        }
//-----------------------------------------------------------------------------------------//
    /** */
    private void checkLock () {
        boolean bnAdapterPanelLocked = (szCurrentAdapter == null);
        boolean bnResourcePanelLocked = (szCurrentResource == null);
        
        jtfAdapterClassName.setEnabled (!bnAdapterPanelLocked);
        jcbAdapterAliases.setEnabled (!bnAdapterPanelLocked);
        jcbAdapterXMLCache.setEnabled (!bnAdapterPanelLocked);
        jbtAdapterNewProperty.setEnabled (!bnAdapterPanelLocked);
        jbtAdapterRemoveProperty.setEnabled (!bnAdapterPanelLocked);
        jbtAdapterRemove.setEnabled (!bnAdapterPanelLocked);
        jbtAdapterRename.setEnabled (!bnAdapterPanelLocked);
        jbtAdapterNewResource.setEnabled (!bnAdapterPanelLocked);
        jbtAdapterRemoveResource.setEnabled (!bnAdapterPanelLocked); 
        jlsAdapterResources.setEnabled (!bnAdapterPanelLocked); 
        
        jtfResourceClassName.setEnabled (!bnResourcePanelLocked);
        jcbResourceNames.setEnabled (!bnResourcePanelLocked);
        jbtResourceNewProperty.setEnabled (!bnResourcePanelLocked);
        jbtResourceRemoveProperty.setEnabled (!bnResourcePanelLocked);
        jbtResourceRemove.setEnabled (!bnResourcePanelLocked);
        jbtResourceRename.setEnabled (!bnResourcePanelLocked);
        
        jcbProwlerResource.setEnabled (!bnResourcePanelLocked);
        jcbProwlerRootAdapter.setEnabled (!bnAdapterPanelLocked);
        }
    
    private void store () {
        if (!pcddTheData.store ()) { 
            JOptionPane.showMessageDialog(this, "Save aborted.", "Information", JOptionPane.INFORMATION_MESSAGE);
            return;
            }
        
        if (bnInStandaloneMode) {
            JFileChooser chooser = new JFileChooser(); 
            FileFilter filter = new FileFilter() {
                public boolean accept (File file) {
                    return (file.getName ().endsWith ("xml") || file.isDirectory ());
                    }
                public String getDescription () {
                    return "XML-Files";
                    }
                };
            chooser.setFileFilter(filter); 
            int iReturnVal = chooser.showSaveDialog(this); 
            if (iReturnVal == JFileChooser.APPROVE_OPTION) { 
                try {
                    pp.savePropertyFile (chooser.getSelectedFile().getAbsolutePath ());
                    }
                catch (Exception e) {
                    JOptionPane.showMessageDialog(this, "Save was unsuccessful for the following reason:\n"+e.getMessage (), "Error", JOptionPane.ERROR_MESSAGE);
                    return;
                    }
                JOptionPane.showMessageDialog (this, "Save was successful.", "Information", JOptionPane.INFORMATION_MESSAGE);
                }
            }
        }
    
    private void load () {
        JFileChooser chooser = new JFileChooser(); 
        FileFilter filter = new FileFilter() {
            public boolean accept (File file) {
                return (file.getName ().endsWith ("xml") || file.isDirectory ());
                }
            public String getDescription () {
                return "XML-Files";
                }
            };
        chooser.setFileFilter(filter); 
        int iReturnVal = chooser.showOpenDialog(this); 
        if (iReturnVal == JFileChooser.APPROVE_OPTION) { 
            try {
                pp.refresh (chooser.getSelectedFile().getAbsolutePath ());
                }
            catch (Exception e) {
                JOptionPane.showMessageDialog(this, "Load was unsuccessful for the following reason:\n"+e.getMessage (), "Error", JOptionPane.ERROR_MESSAGE);
                return;
                }
            pcddTheData.load ();
    
            pcddTheData.fillAdapterAliasesInto (jcbAdapterAliases);
            pcddTheData.fillAdapterAliasesInto (jcbProwlerRootAdapter);
            pcddTheData.fillResourceAliasesInto (jcbResourceNames);
            pcddTheData.fillResourceAliasesInto (jcbProwlerResource);
            pcddTheData.fillResourceAliasesInto (jcbAdapterXMLCache);
            
            
            szCurrentAdapter =  (String) jcbAdapterAliases.getSelectedItem ();
            szCurrentResource = (String) jcbResourceNames.getSelectedItem ();
            updateProwlerPanel ();
            checkLock ();
            JOptionPane.showMessageDialog (this, "Load was successful.", "Information", JOptionPane.INFORMATION_MESSAGE);
            }
        }
        
//-----------------------------------------------------------------------------------------//
    /** */    
    public static void main (String args []) {
        bnInStandaloneMode = true;
        JFrame jfMainFrame = new JFrame (szTitle);
        new ProwlerConfigDialog (jfMainFrame);
        }
    }