Java Code Examples for java.beans.PropertyVetoException#getMessage()

The following examples show how to use java.beans.PropertyVetoException#getMessage() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: openstock   File: Series.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the key for the series and sends a <code>VetoableChangeEvent</code>
 * (with the property name "Key") to all registered listeners.  For 
 * backwards compatibility, this method also fires a regular 
 * <code>PropertyChangeEvent</code>.  If the key change is vetoed this 
 * method will throw an IllegalArgumentException.
 *
 * @param key  the key (<code>null</code> not permitted).
 *
 * @see #getKey()
 */
public void setKey(Comparable key) {
    ParamChecks.nullNotPermitted(key, "key");
    Comparable old = this.key;
    try {
        // if this series belongs to a dataset, the dataset might veto the
        // change if it results in two series within the dataset having the
        // same key
        this.vetoableChangeSupport.fireVetoableChange("Key", old, key);
        this.key = key;
        // prior to 1.0.14, we just fired a PropertyChange - so we need to
        // keep doing this
        this.propertyChangeSupport.firePropertyChange("Key", old, key);
    } catch (PropertyVetoException e) {
        throw new IllegalArgumentException(e.getMessage());
    }
}
 
Example 2
Source Project: netbeans   File: XMLFileSystem.java    License: Apache License 2.0 6 votes vote down vote up
/** Initializes the root of FS.
*/
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
    //ois.defaultReadObject ();
    ObjectInputStream.GetField fields = ois.readFields();
    URL[] urls = (URL[]) fields.get("urlsToXml", null); // NOI18N

    if (urls == null) {
        urls = new URL[1];
        urls[0] = (URL) fields.get("uriId", null); // NOI18N
        if (urls[0] == null) {
            throw new IOException("missing uriId"); // NOI18N
        }
    }

    try {
        setXmlUrls(urls);
    } catch (PropertyVetoException ex) {
        IOException x = new IOException(ex.getMessage());
        ExternalUtil.copyAnnotation(x, ex);
        throw x;
    }
}
 
Example 3
Source Project: netbeans   File: JarFileSystem.java    License: Apache License 2.0 6 votes vote down vote up
/** Initializes the root of FS.
*/
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
    ois.defaultReadObject();
    closeSync = new Object();
    strongCache = null;
    softCache = new SoftReference<Cache>(null);
    aliveCount = 0;

    try {
        setJarFile(root);
    } catch (PropertyVetoException ex) {
        throw new IOException(ex.getMessage());
    } catch (IOException iex) {
        ExternalUtil.log(iex.getLocalizedMessage());
    }
}
 
Example 4
/**
 * Sets the key for the series and sends a <code>VetoableChangeEvent</code>
 * (with the property name "Key") to all registered listeners.  For 
 * backwards compatibility, this method also fires a regular 
 * <code>PropertyChangeEvent</code>.  If the key change is vetoed this 
 * method will throw an IllegalArgumentException.
 *
 * @param key  the key (<code>null</code> not permitted).
 *
 * @see #getKey()
 */
public void setKey(Comparable key) {
    ParamChecks.nullNotPermitted(key, "key");
    Comparable old = this.key;
    try {
        // if this series belongs to a dataset, the dataset might veto the
        // change if it results in two series within the dataset having the
        // same key
        this.vetoableChangeSupport.fireVetoableChange("Key", old, key);
        this.key = key;
        // prior to 1.0.14, we just fired a PropertyChange - so we need to
        // keep doing this
        this.propertyChangeSupport.firePropertyChange("Key", old, key);
    } catch (PropertyVetoException e) {
        throw new IllegalArgumentException(e.getMessage());
    }
}
 
Example 5
Source Project: SIMVA-SoS   File: Series.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Sets the key for the series and sends a <code>VetoableChangeEvent</code>
 * (with the property name "Key") to all registered listeners.  For 
 * backwards compatibility, this method also fires a regular 
 * <code>PropertyChangeEvent</code>.  If the key change is vetoed this 
 * method will throw an IllegalArgumentException.
 *
 * @param key  the key (<code>null</code> not permitted).
 *
 * @see #getKey()
 */
public void setKey(Comparable key) {
    ParamChecks.nullNotPermitted(key, "key");
    Comparable old = this.key;
    try {
        // if this series belongs to a dataset, the dataset might veto the
        // change if it results in two series within the dataset having the
        // same key
        this.vetoableChangeSupport.fireVetoableChange("Key", old, key);
        this.key = key;
        // prior to 1.0.14, we just fired a PropertyChange - so we need to
        // keep doing this
        this.propertyChangeSupport.firePropertyChange("Key", old, key);
    } catch (PropertyVetoException e) {
        throw new IllegalArgumentException(e.getMessage());
    }
}
 
Example 6
Source Project: ECG-Viewer   File: Series.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets the key for the series and sends a <code>VetoableChangeEvent</code>
 * (with the property name "Key") to all registered listeners.  For 
 * backwards compatibility, this method also fires a regular 
 * <code>PropertyChangeEvent</code>.  If the key change is vetoed this 
 * method will throw an IllegalArgumentException.
 *
 * @param key  the key (<code>null</code> not permitted).
 *
 * @see #getKey()
 */
public void setKey(Comparable key) {
    ParamChecks.nullNotPermitted(key, "key");
    Comparable old = this.key;
    try {
        // if this series belongs to a dataset, the dataset might veto the
        // change if it results in two series within the dataset having the
        // same key
        this.vetoableChangeSupport.fireVetoableChange("Key", old, key);
        this.key = key;
        // prior to 1.0.14, we just fired a PropertyChange - so we need to
        // keep doing this
        this.propertyChangeSupport.firePropertyChange("Key", old, key);
    } catch (PropertyVetoException e) {
        throw new IllegalArgumentException(e.getMessage());
    }
}
 
Example 7
Source Project: buffer_bci   File: Series.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the key for the series and sends a <code>VetoableChangeEvent</code>
 * (with the property name "Key") to all registered listeners.  For 
 * backwards compatibility, this method also fires a regular 
 * <code>PropertyChangeEvent</code>.  If the key change is vetoed this 
 * method will throw an IllegalArgumentException.
 *
 * @param key  the key (<code>null</code> not permitted).
 *
 * @see #getKey()
 */
public void setKey(Comparable key) {
    ParamChecks.nullNotPermitted(key, "key");
    Comparable old = this.key;
    try {
        // if this series belongs to a dataset, the dataset might veto the
        // change if it results in two series within the dataset having the
        // same key
        this.vetoableChangeSupport.fireVetoableChange("Key", old, key);
        this.key = key;
        // prior to 1.0.14, we just fired a PropertyChange - so we need to
        // keep doing this
        this.propertyChangeSupport.firePropertyChange("Key", old, key);
    } catch (PropertyVetoException e) {
        throw new IllegalArgumentException(e.getMessage());
    }
}
 
Example 8
Source Project: buffer_bci   File: Series.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the key for the series and sends a <code>VetoableChangeEvent</code>
 * (with the property name "Key") to all registered listeners.  For 
 * backwards compatibility, this method also fires a regular 
 * <code>PropertyChangeEvent</code>.  If the key change is vetoed this 
 * method will throw an IllegalArgumentException.
 *
 * @param key  the key (<code>null</code> not permitted).
 *
 * @see #getKey()
 */
public void setKey(Comparable key) {
    ParamChecks.nullNotPermitted(key, "key");
    Comparable old = this.key;
    try {
        // if this series belongs to a dataset, the dataset might veto the
        // change if it results in two series within the dataset having the
        // same key
        this.vetoableChangeSupport.fireVetoableChange("Key", old, key);
        this.key = key;
        // prior to 1.0.14, we just fired a PropertyChange - so we need to
        // keep doing this
        this.propertyChangeSupport.firePropertyChange("Key", old, key);
    } catch (PropertyVetoException e) {
        throw new IllegalArgumentException(e.getMessage());
    }
}
 
Example 9
Source Project: netbeans   File: FileSelector.java    License: Apache License 2.0 4 votes vote down vote up
/**
     * @param title is a title of the dialog
     * @param rootLabel label for the root node
     * @param root the base object to start browsing from
     * @param acceptor decides whether we have valid selection or not
     * @param top is a <code>Component</code> we just place on the top of the dialog
     * it can be <code>null</code>
     */
    public FileSelector ( String rootLabel, Node root, final NodeAcceptor acceptor, Component top) {
        super ();

        this.acceptor = acceptor;
        
        ResourceBundle bundle = NbBundle.getBundle(FileSelector.class);


        okButton = new JButton(bundle.getString("CTL_FileSelectorOkButton"));
        cancelButton = new JButton(bundle.getString("CTL_FileSelectorCancelButton"));
        okButton.getAccessibleContext().setAccessibleDescription(bundle.getString ("ACSD_FileSelectorOkButton"));
        cancelButton.getAccessibleContext().setAccessibleDescription(bundle.getString ("ACSD_FileSelectorCancelButton"));
        buttons = new JButton[] { okButton, cancelButton };
        

        manager.setRootContext (root);//s[0]);
        
        // Center
        tree = new BeanTreeView () {
            {
                tree.setCellEditor(null);
                tree.setEditable(false);
            }
        };
        tree.setPopupAllowed (false);
        tree.setDefaultActionAllowed (false);
        // install proper border for tree
        tree.setBorder((Border)UIManager.get("Nb.ScrollPane.border")); // NOI18N
        tree.getAccessibleContext().setAccessibleName(NbBundle.getBundle(FileSelector.class).getString("ACSN_FileSelectorTreeView"));
        tree.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(FileSelector.class).getString("ACSD_FileSelectorTreeView"));
        this.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(FileSelector.class).getString("ACSD_FileSelectorDialog"));
        setLayout(new BorderLayout());
        add(tree, BorderLayout.CENTER);

        // component to place at the top
        try {
                manager.setSelectedNodes (new Node[] { root });
                JLabel label = new JLabel();
                Mnemonics.setLocalizedText(label, rootLabel);
                label.setLabelFor(tree.getViewport().getView());
                add(label, BorderLayout.NORTH);
        } catch(PropertyVetoException pve) {
            throw new IllegalStateException(pve.getMessage());
        }



        // South
        if (top != null) {
            add(top, BorderLayout.SOUTH);
        }

        manager.addPropertyChangeListener (this);

//        if (top != null) top.requestFocus ();

        if (acceptor.acceptNodes (manager.getSelectedNodes())) {
            enableButton ();
        } else {
            disableButton ();
        }

    }
 
Example 10
/**
 * Create the underlying C3PO ComboPooledDataSource with the 
 * default supported properties.
 * @throws SchedulerException 
 */
private void initialize(
    String dbDriver, 
    String dbURL, 
    String dbUser,
    String dbPassword, 
    int maxConnections, 
    int maxStatementsPerConnection, 
    String dbValidationQuery,
    boolean validateOnCheckout,
    int idleValidationSeconds,
    int maxIdleSeconds) throws SQLException, SchedulerException {
    if (dbURL == null) {
        throw new SQLException(
            "DBPool could not be created: DB URL cannot be null");
    }
    
    if (dbDriver == null) {
        throw new SQLException(
            "DBPool '" + dbURL + "' could not be created: " +
            "DB driver class name cannot be null!");
    }
    
    if (maxConnections < 0) {
        throw new SQLException(
            "DBPool '" + dbURL + "' could not be created: " + 
            "Max connections must be greater than zero!");
    }

    
    datasource = new ComboPooledDataSource(); 
    try {
        datasource.setDriverClass(dbDriver);
    } catch (PropertyVetoException e) {
        throw new SchedulerException("Problem setting driver class name on datasource: " + e.getMessage(), e);
    }  
    datasource.setJdbcUrl(dbURL); 
    datasource.setUser(dbUser); 
    datasource.setPassword(dbPassword);
    datasource.setMaxPoolSize(maxConnections);
    datasource.setMinPoolSize(1);
    datasource.setMaxIdleTime(maxIdleSeconds);
    datasource.setMaxStatementsPerConnection(maxStatementsPerConnection);
    
    if (dbValidationQuery != null) {
        datasource.setPreferredTestQuery(dbValidationQuery);
        if(!validateOnCheckout)
            datasource.setTestConnectionOnCheckin(true);
        else
            datasource.setTestConnectionOnCheckout(true);
        datasource.setIdleConnectionTestPeriod(idleValidationSeconds);
    }
}