Package net.sourceforge.squirrel_sql.plugins.mssql.util

Examples of net.sourceforge.squirrel_sql.plugins.mssql.util.DatabaseObjectInfoTableModel


        c.gridy = 10;
        gridBag.setConstraints(glue, c);
        panel.add(glue);*/
       
        _availableTable = new JTable(new DefaultTableModel(0,0));
        _availableTable.setModel(new DatabaseObjectInfoTableModel());
        _availableTable.getColumnModel().getColumn(0).setCellRenderer(new DatabaseObjectInfoRenderer());
        JScrollPane availablePane = new JScrollPane(_availableTable);
        c.gridx = 0;
        c.gridy = 7;
        c.gridheight = 3;
        gridBag.setConstraints(availablePane, c);
        panel.add(availablePane);
       
        populateAvailableTable(_availableTable);
       
        _selectedTable = new JTable(new DefaultTableModel(0,0));
        _selectedTable.setModel(new DatabaseObjectInfoTableModel());
        _selectedTable.getColumnModel().getColumn(0).setCellRenderer(new DatabaseObjectInfoRenderer());
        JScrollPane selectedPane = new JScrollPane(_selectedTable);
        c.gridx = 2;
        c.gridy = 7;
        c.gridheight = 3;
View Full Code Here


                i++;
        }
    }
   
    private void transferSelectedItems(JTable fromTable, JTable toTable) {
        DatabaseObjectInfoTableModel fromModel = (DatabaseObjectInfoTableModel) fromTable.getModel();
        DatabaseObjectInfoTableModel toModel = (DatabaseObjectInfoTableModel) toTable.getModel();
        int[] selectedRows = fromTable.getSelectedRows();
       
        /* we must iterate through this in descending order to avoid removing, say, item #2, making
         * item #4 into item #3, inadvertently removing item #5. */
        for (int i = selectedRows.length - 1; i >= 0 ; i--) {
            IDatabaseObjectInfo oi = (IDatabaseObjectInfo) fromModel.getValueAt(selectedRows[i],0);
            if (fromModel.removeElement(oi))
                toModel.addElement(oi);
        }
       
        /* TODO: sort the list. */
    }
View Full Code Here

       
        /* TODO: sort the list. */
    }
   
    private void populateAvailableTable(JTable table) {
        DatabaseObjectInfoTableModel model = (DatabaseObjectInfoTableModel) table.getModel();
       
        try {
            String catalog = _session.getSQLConnection().getCatalog();
            SQLDatabaseMetaData metaData = _session.getSQLConnection().getSQLMetaData();

            int i;

            /* add the tables. */
            ITableInfo[] tables = _session.getSchemaInfo().getITableInfos(catalog,null,new ObjFilterMatcher(),new String[] { "TABLE" });
            for (i = 0; i < tables.length; i++)
                model.addElement(tables[i]);
           
            /* add the views. */
            ITableInfo[] views = _session.getSchemaInfo().getITableInfos(catalog,null,new ObjFilterMatcher(),new String[] { "VIEW" });
            for (i = 0; i < views.length; i++)
                model.addElement(views[i]);
           
            /* add the procedures. */
            //IProcedureInfo[] procs = metaData.getProcedures(catalog,null,null);
            IProcedureInfo[] procs = _session.getSchemaInfo().getStoredProceduresInfos(catalog,null,new ObjFilterMatcher());
            for (i = 0; i < procs.length; i++)
                if (!procs[i].getSimpleName().startsWith("dt_"))
                    model.addElement(procs[i]);

            /* add the UDTs. */
            IUDTInfo[] udts = metaData.getUDTs(catalog,null,null,null);
            for (i = 0; i < udts.length; i++)
                model.addElement(udts[i]);
        }
        catch (SQLException ex) {
            _session.getApplication().showErrorDialog(ex.getMessage(),ex);
        }
    }
View Full Code Here

   
    public void preselectObjects(IDatabaseObjectInfo[] objs) {
        /* this works because all the IDatabaseObjectInfo objects come from the same source, so
         * their references are equal. */
       
        DatabaseObjectInfoTableModel fromModel = (DatabaseObjectInfoTableModel) _availableTable.getModel();
        DatabaseObjectInfoTableModel toModel = (DatabaseObjectInfoTableModel) _selectedTable.getModel();
       
        for (int i = 0; i < objs.length; i++) {
            if (fromModel.removeElement(objs[i]))
                toModel.addElement(objs[i]);
        }
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.plugins.mssql.util.DatabaseObjectInfoTableModel

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.