|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.db.explorer.dlg; import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.table.*; import javax.swing.text.DefaultCaret; import java.io.InputStream; import org.netbeans.lib.ddl.impl.Specification; import org.netbeans.lib.ddl.impl.CreateTable; import org.netbeans.lib.ddl.util.CommandBuffer; import org.netbeans.lib.ddl.impl.CreateIndex; import org.netbeans.lib.ddl.util.PListReader; import javax.swing.event.TableModelEvent; import org.openide.util.NbBundle; import org.netbeans.modules.db.explorer.*; import org.netbeans.modules.db.util.*; import org.netbeans.modules.db.explorer.infos.DatabaseNodeInfo; /** * Table data model * Uses a vector of objects to store the data */ public class DataModel extends AbstractTableModel { /** Column data */ private Vector data; transient private Vector primaryKeys = new Vector(); transient private Vector uniqueKeys = new Vector(); static final long serialVersionUID =4162743695966976536L; private static ResourceBundle bundle = NbBundle.getBundle("org.netbeans.modules.db.resources.Bundle"); // NOI18N public DataModel() { super(); data = new Vector(1); } public Vector getData() { return data; } public int getColumnCount() { return ColumnItem.getProperties().size(); } public int getRowCount() { return data.size(); } public Object getValue(String pname, int row) { ColumnItem xcol = (ColumnItem)data.elementAt(row); return xcol.getProperty(pname); } public Object getValueAt(int row, int col) { return getValue((String)ColumnItem.getColumnNames().elementAt(col), row); } public void setValue(Object val, String pname, int row) { if( row < getRowCount() ) { int srow = row, erow = row; ColumnItem xcol = (ColumnItem)data.elementAt(row); xcol.setProperty(pname, val); if (pname.equals(ColumnItem.PRIMARY_KEY) && val.equals(Boolean.TRUE)) { if (xcol.allowsNull()) xcol.setProperty(ColumnItem.NULLABLE, Boolean.FALSE); if (!xcol.isIndexed()) xcol.setProperty(ColumnItem.INDEX, Boolean.TRUE); if (!xcol.isUnique()) xcol.setProperty(ColumnItem.UNIQUE, Boolean.TRUE); /*for (int i=0; i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.