Search in sources :

Example 46 with PropertyVetoException

use of java.beans.PropertyVetoException in project sic by belluccifranco.

the class FacturasVentaGUI method formInternalFrameOpened.

//GEN-LAST:event_chk_NumFacturaItemStateChanged
private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
    //GEN-FIRST:event_formInternalFrameOpened
    try {
        this.setSize(sizeInternalFrame);
        this.setColumnas();
        this.setMaximum(true);
        rb_soloImpagas.setSelected(true);
        dc_FechaDesde.setDate(new Date());
        dc_FechaHasta.setDate(new Date());
    } catch (PropertyVetoException ex) {
        String mensaje = "Se produjo un error al intentar maximizar la ventana.";
        LOGGER.error(mensaje + " - " + ex.getMessage());
        JOptionPane.showInternalMessageDialog(this, mensaje, "Error", JOptionPane.ERROR_MESSAGE);
        this.dispose();
    }
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) Date(java.util.Date)

Example 47 with PropertyVetoException

use of java.beans.PropertyVetoException in project sic by belluccifranco.

the class CajasGUI method internalFrameOpened.

//GEN-LAST:event_btn_AbrirCajaActionPerformed
private void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
    //GEN-FIRST:event_internalFrameOpened
    this.setSize(sizeInternalFrame);
    this.setColumnasCaja();
    cmb_Usuarios.addItem(usuarioParaMostrar);
    cmb_Usuarios.setEnabled(false);
    dc_FechaDesde.setDate(new Date());
    dc_FechaHasta.setDate(new Date());
    try {
        this.setMaximum(true);
    } catch (PropertyVetoException ex) {
        String mensaje = "Se produjo un error al intentar maximizar la ventana.";
        LOGGER.error(mensaje + " - " + ex.getMessage());
        JOptionPane.showInternalMessageDialog(this, mensaje, "Error", JOptionPane.ERROR_MESSAGE);
        this.dispose();
    }
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) Date(java.util.Date)

Example 48 with PropertyVetoException

use of java.beans.PropertyVetoException in project sic by belluccifranco.

the class CajasGUI method verDetalle.

private void verDetalle(Caja caja) {
    JInternalFrame iFrameCaja = Utilidades.estaEnDesktop(getDesktopPane(), CajaGUI.class);
    if (iFrameCaja != null) {
        iFrameCaja.dispose();
    }
    iFrameCaja = new CajaGUI(caja);
    iFrameCaja.setLocation(getDesktopPane().getWidth() / 2 - iFrameCaja.getWidth() / 2, getDesktopPane().getHeight() / 2 - iFrameCaja.getHeight() / 2);
    getDesktopPane().add(iFrameCaja);
    iFrameCaja.setVisible(true);
    try {
        iFrameCaja.setSelected(true);
    } catch (PropertyVetoException ex) {
        String msjError = "No se pudo seleccionar la ventana requerida.";
        LOGGER.error(msjError + " - " + ex.getMessage());
        JOptionPane.showInternalMessageDialog(this.getDesktopPane(), msjError, "Error", JOptionPane.ERROR_MESSAGE);
    }
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) JInternalFrame(javax.swing.JInternalFrame)

Example 49 with PropertyVetoException

use of java.beans.PropertyVetoException in project dhis2-core by dhis2.

the class DefaultDataSourceManager method getReadOnlyDataSources.

// -------------------------------------------------------------------------
// Supportive methods
// -------------------------------------------------------------------------
private List<DataSource> getReadOnlyDataSources() {
    String mainUser = config.getProperty(ConfigurationKey.CONNECTION_USERNAME);
    String mainPassword = config.getProperty(ConfigurationKey.CONNECTION_PASSWORD);
    String driverClass = config.getProperty(CONNECTION_DRIVER_CLASS);
    String maxPoolSize = config.getPropertyOrDefault(CONNECTION_POOL_MAX_SIZE, DEFAULT_POOL_SIZE);
    Properties props = config.getProperties();
    List<DataSource> dataSources = new ArrayList<>();
    for (int i = 1; i <= MAX_READ_REPLICAS; i++) {
        String jdbcUrl = props.getProperty(String.format(FORMAT_CONNECTION_URL, i));
        String user = props.getProperty(String.format(FORMAT_CONNECTION_USERNAME, i));
        String password = props.getProperty(String.format(FORMAT_CONNECTION_PASSWORD, i));
        user = StringUtils.defaultIfEmpty(user, mainUser);
        password = StringUtils.defaultIfEmpty(password, mainPassword);
        if (ObjectUtils.allNonNull(jdbcUrl, user, password)) {
            try {
                ComboPooledDataSource ds = new ComboPooledDataSource();
                ds.setDriverClass(driverClass);
                ds.setJdbcUrl(jdbcUrl);
                ds.setUser(user);
                ds.setPassword(password);
                ds.setMaxPoolSize(Integer.valueOf(maxPoolSize));
                ds.setAcquireIncrement(VAL_ACQUIRE_INCREMENT);
                ds.setMaxIdleTime(VAL_MAX_IDLE_TIME);
                dataSources.add(ds);
                log.info("Found read replica, connection URL: " + jdbcUrl);
            } catch (PropertyVetoException ex) {
                throw new IllegalArgumentException("Invalid configuration of read replica: " + jdbcUrl, ex);
            }
        }
    }
    log.info("Read only configuration initialized, read replicas found: " + dataSources.size());
    return dataSources;
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) ComboPooledDataSource(com.mchange.v2.c3p0.ComboPooledDataSource) ArrayList(java.util.ArrayList) Properties(java.util.Properties) ComboPooledDataSource(com.mchange.v2.c3p0.ComboPooledDataSource) DataSource(javax.sql.DataSource)

Aggregations

PropertyVetoException (java.beans.PropertyVetoException)49 JInternalFrame (javax.swing.JInternalFrame)12 Date (java.util.Date)7 ComboPooledDataSource (com.mchange.v2.c3p0.ComboPooledDataSource)4 PropertyChangeEvent (java.beans.PropertyChangeEvent)4 Point (java.awt.Point)3 VetoableChangeListener (java.beans.VetoableChangeListener)3 SQLException (java.sql.SQLException)3 OBlock (jmri.jmrit.logix.OBlock)3 OBlockManager (jmri.jmrit.logix.OBlockManager)3 ActionEvent (java.awt.event.ActionEvent)2 IndexedPropertyChangeEvent (java.beans.IndexedPropertyChangeEvent)2 VetoableChangeSupport (java.beans.VetoableChangeSupport)2 File (java.io.File)2 IOException (java.io.IOException)2 BigDecimal (java.math.BigDecimal)2 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 Timestamp (java.sql.Timestamp)2 ArrayList (java.util.ArrayList)2