Package prefuse.data

Examples of prefuse.data.Table


     * Removes the tuple from its source set if that source set is contained
     * within this composite.
     * @see prefuse.data.tuple.TupleSet#removeTuple(prefuse.data.Tuple)
     */
    public boolean removeTuple(Tuple t) {
        Table table = t.getTable();
        if ( m_sets.contains(table) ) {
            return table.removeTuple(t);
        } else {
            return false;
        }
    }
View Full Code Here


        }
       
        // create the table
        int nrows = dim[0];
        int ncols = dim[1];
        final Table table = new Table(nrows, ncols);
       
        // create the table columns
        for ( int i=0; i < ncols; ++i ) {
            String header;
            if ( m_hasHeader || i < headers.size() ) {
                header = (String)headers.get(i);
            } else {
                header = getDefaultHeader(i);
            }
            table.addColumn(header, di.getType(i));
            table.getColumn(i).setParser(di.getParser(i));
        }
       
        // reset dim array, will hold row/col indices
        dim[0] = dim[1] = -1;
       
        TableReadListener parser = new TableReadListener() {
            int prevLine = -1;
            public void readValue(int line, int col, String value)
                throws DataParseException
            {
                // early exit on header value
                if ( line == 1 && m_hasHeader )
                    return;
                if ( line != prevLine ) {
                    prevLine = line;
                    ++dim[0];
                }
                dim[1] = col-1;
               
                // XXX NOTE-2005.08.29-jheer
                // For now we use generic routines for filling column values.
                // This results in the autoboxing of primitive types, slowing
                // performance a bit and possibly triggering avoidable garbage
                // collections. If this proves to be a problem down the road,
                // we can add more nuance later.
                DataParser dp = di.getParser(dim[1]);
                table.set(dim[0], dim[1], dp.parse(value));
            }
        };
       
        // read the data into the table
        try {
View Full Code Here

                m_view.setGraph(g, label);
            }
        }
        public static String getLabel(Component c, Graph g) {
            // get the column names
            Table t = g.getNodeTable();
            int  cc = t.getColumnCount();
            String[] names = new String[cc];
            for ( int i=0; i<cc; ++i )
                names[i] = t.getColumnName(i);
           
            // where to store the result
            final String[] label = new String[1];

            // -- build the dialog -----
View Full Code Here

public class Congress extends JPrefuseApplet {

    public void init() {
        // load the data
        Table t = null;
        try {
            t = new DelimitedTextTableReader().readTable("/fec.txt");
        } catch ( Exception e ) {
            e.printStackTrace();
            System.exit(1);
View Full Code Here

public class ZipDecode extends JPrefuseApplet {

    public void init() {
        DelimitedTextTableReader tr = new DelimitedTextTableReader();
        Table t = null;
        try {
            t = tr.readTable("/zipcode.txt");       
        } catch ( DataIOException e ) {
            e.printStackTrace();
            System.exit(1);
View Full Code Here

    }
   
    public static ScatterPlot demo(String data, String xfield,
                                   String yfield, String sfield)
    {
        Table table = null;
        try {
            table = new DelimitedTextTableReader().readTable(data);
        } catch ( Exception e ) {
            e.printStackTrace();
            return null;
View Full Code Here

            final String xfield, final String yfield, final String sfield)
    {
        int spacing = 10;
       
        // create list of column names
        Table t = (Table)sp.getVisualization().getSourceData(group);
        String[] colnames = new String[t.getColumnCount()];
        for ( int i=0; i<colnames.length; ++i )
            colnames[i] = t.getColumnName(i);
       
        // create toolbar that allows visual mappings to be changed
        JToolBar toolbar = new JToolBar();
        toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.X_AXIS));
        toolbar.add(Box.createHorizontalStrut(spacing));
View Full Code Here

        }
    }
   
    public static JFrame demo(String table) throws DataIOException {
        DelimitedTextTableReader tr = new DelimitedTextTableReader();
        Table t = tr.readTable(table);       
        ZipDecode zd = new ZipDecode(t);
       
        JFrame frame = new JFrame("p r e f u s e  |  z i p d e c o d e");
        frame.getContentPane().add(zd);
        frame.pack();
View Full Code Here

        f.setVisible(true);
    }
   
    public static JFrame demo() {
        // load the data
        Table t = null;
        try {
            t = new DelimitedTextTableReader().readTable("/fec.txt");
        } catch ( Exception e ) {
            e.printStackTrace();
            System.exit(1);
View Full Code Here

        ts.addTuple(m_vt0);
        ts.addTuple(m_vn0);
    }
   
    public void testRepeatGroup() {
      Table t = new Table();
      Graph g = new Graph();
      try {
        m_vis.add("t", t);
        fail("Should not allow duplicate groups");
      } catch ( Exception e ) {
View Full Code Here

TOP

Related Classes of prefuse.data.Table

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.