How to modify the data with dynamic TableView with dynamic columns in JAVAFX

Today, it is the demo to display the data from the CSV to the custom class without doing DAT file on tableView in JavaFX 2.0. I call this TableView as dynamic TableView because the tableview automatically manages the columns and rows.
My research on the editable on tableView, we have a custom of the class and apply it to tableView to show that this demo is > http://docs.oracle.com/javafx/2/ui_controls/table-view.htm

But in this case I can't do that because we don't know how many example of column with the csv file or .dat file... I want to make editable on this tableView in this case add TextField in the TableCell. How do custom class (because you don't have how column...) and so to do custom class then what thedesign of a custom for this case class?

Could you please help me?

It's the demo of code to display your csv or dat file in TableView

private void getDataDetailWithDynamic() {
  tblView
.getItems().clear();
  tblView
.getColumns().clear();
  tblView
.setPlaceholder(new Label("Loading..."));
  
// @Override



  
try {
       
File aFile = new File(txtFilePath.getText());
       
InputStream is = new BufferedInputStream(new FileInputStream(aFile));
       
Reader reader = new InputStreamReader(is, "UTF-8");

       
BufferedReader in = new BufferedReader(reader);

       
final String headerLine = in.readLine();
       
final String[] headerValues = headerLine.split("\t");
       
for (int column = 0; column < headerValues.length; column++) {
             tblView
.getColumns().add(
             createColumn
(column, headerValues[column]));
       
}

       
// Data:

       
String dataLine;
       
while ((dataLine = in.readLine()) != null) {
            
final String[] dataValues = dataLine.split("\t");
            
// Add additional columns if necessary:
            
for (int columnIndex = tblView.getColumns().size(); columnIndex < dataValues.length; columnIndex++) {
                  tblView
.getColumns().add(createColumn(columnIndex, ""));
            
}
            
// Add data to table:
            
ObservableList<StringProperty> data = FXCollections.observableArrayList();
            
for (String value : dataValues) {
                 data
.add(new SimpleStringProperty(value));
            
}
             tblView
.getItems().add(data);
       
}
  
} catch (Exception ex) {
       
System.out.println("ex: " + ex.toString());
  
}


  
for(int i=0; i<tblView.getColumns().size(); i++) {
       
TableColumn col = (TableColumn)tblView.getColumns().get(i);
       col
.setPrefWidth(70);
  
}
}

private TableColumn createColumn(
  
final int columnIndex, String columnTitle) {
       
TableColumn column = new TableColumn(DefaultVars.BLANK_CHARACTER);
       
String title;
       
if (columnTitle == null || columnTitle.trim().length() == 0) {
            title
= "Column " + (columnIndex + 1);
       
} else {
            title
= columnTitle;
       
}


       
Callback<TableColumn, TableCell> cellFactory = new Callback<TableColumn, TableCell>() {
       
@Override
       
public TableCell call(TableColumn p) {

            
System.out.println("event cell");
            
EditingCellData cellExtend = new EditingCellData();
            
return cellExtend;
       
}
  
};

  column
.setText(title);
  column
.setCellValueFactory(cellFactory);
  
return column;
}


Thanks for your reading.

See this thread: Re: dynamically create columns

This example is not editable, but to do so, simply add something like

    column.setCellFactory(TextFieldTableCell.>forTableColumn());

the createTableColumn (...) method.

Either said by the way, where did you code that you pasted in your post? It looks like in my previous post.

Post edited by: James_D

Tags: Java

Similar Questions

  • all my data is all save on the local disk c, how to share the data with the other drive, local drive d.

    all my data records on the local disk c, how to share the data with the other drive, local drive d.

    Hi Jasonbichard,

    1. what type of drive is D? Is - this another partition on the same disk?

    2 Windows operating system you are using?

    You can change the location of the disk to save the data in the d: instead of C: and check if it helps.

    a. navigate to the location (username) C:\Users\.
    b. right click on the folder that you want to change the location, and then select Properties.
    c. click on the location tab and change the location to D: drive.

    d. click on apply and Ok.

  • How to adjust the data in dynamic data?

    Hello

    I have problems when I want to convert the data that I have gained by using VISA to dynamic data. The data group consist of a row/column with relative timestamps (time measurement) and up to 30 channels of data. How can I do this?

    Thank you for the help

    Hello Thiago Bach,

    If you look at your code, the best way to proceed is to create a data type of waveform of your data. You can do this by using the generation 'Waveform.vi '. Here you will find the help file says of this feature. The format of data T0 is the regular Timestamp data format (for example generated by the 'get DateTime in Seconds.vi'.

    The type of waveform data can be entered directly on the waveform graphs.

    If you have questions and / or remarks, let me know.

    Best regards

    Peter S

  • How to read the data with different XML schemas within the unique connection?

    • I have Oracle database 11g
    • I access it via JDBC: Slim, version 11.2.0.3, same as xdb.
    • I have several tables, each has an XMLType column, all based on patterns.
    • There are three XML schemas different registered in the DB
    • Maybe I need to read the XML data in multiple tables.
    • If all the XMLTypes have the same XML schema, there is no problem,
    • If patterns are different, the second reading will throw BindXMLException.
    • If I reset the connection between the readings of the XMLType column with different schemas, it works.

    The question is: How can I configure the driver, or the connection to be able to read the data with different XML schemas without resetting the connection (which is expensive).

    Code to get data from XMLType is the implementation of case study:

     1   ResultSet resultSet = statement.executeQuery( sql ) ; 
    2   String result = null ;
    3    while(resultSet.next()) {
    4   SQLXML sqlxml = resultSet.getSQLXML(1) ;
    5   result = sqlxml.getString() ;
    6   sqlxml.free();
    7   }
    8   resultSet.close();
    9    return result ;

    It turns out, that I needed to serialize the XML on the server and read it as BLOB. Like this:

     1    final Statement statement = connection.createStatement() ;  2    final String sql = String.format("select xmlserialize(content xml_content_column as blob encoding 'UTF-8') from %s where key='%s'", table, key ) ;  3   ResultSet resultSet = statement.executeQuery( sql ) ;  4   String result = null ;  5    while(resultSet.next()) {  6   Blob blob = resultSet.getBlob( 1 );  7   InputStream inputStream = blob.getBinaryStream();  8   result = new Scanner( inputStream ).useDelimiter( "\\A" ).next();  9   inputStream.close(); 10   blob.free(); 11   } 12   resultSet.close(); 13   statement.close(); 14  15   System.out.println( result ); 16    return result ; 17
    

    Then it works. Still, can't get it work with XMLType in resultset. On the customer XML unwrapping explodes trying to pass to another XML schema. JDBC/XDB problem?

  • How to use the date with the report parameter format

    Hi all

    How to use the date format with this tag function,

    <? param@begin:P_FROM_DATE? > <? $P_FROM_DATE? >

    This date of form source of report and setting is coming as this 2012/11/01 00:00:00.

    So now I need this in MY-DD-YYYY marker. I tried like this..? param@begin:P_FROM_DATE? > <? $format - date: P_FROM_DATE; ' DD-MON-YYYY '? >

    but its giving error. Can someone pls how to convert to the format of date custom.

    Thanks and greetings
    Srikkanth.M

    Problem solved.

    REF this link

    Date Format of XML

  • See the date with timestamp column column

    Hello

    In the table have am capture the creation_date as date data type column. I prepare a report to display the date. Is it possible to display the date with creation of time stamp

    I use oracle 10g Enterprise Edition

    The table name is LICENSING name column is CREATION_DATE

    Please suggest me

    Thank you
    Sudhir

    Which indicates that the data currently stored in the table always have an hour of midnight. Whatever the application / process that inserts the data is, apparently, not the component "time" DATE in the desired way. You will need to set the insertion process to spend time in your report.

    Justin

  • How always display the date with taskbar buttons activated in widows 8?

    It's got to be average, just to be there. Even using the buttons small taskbar, it is actually enough space to have always the date and stacked. I would be well with them, next to each other also. I don't really understand why the date masks even as it would fit really well. I'm fine with the help of a third party program if necessary. I already have the classic interface installed because microsoft somehow forgot to add the menu start Windows 8.

    There are several strange suggestions and wonderful here for you to play with.  Make sure that you first create a system restore point.

    Windows 7 - display date using small icons
    http://superuser.com/questions/89628/Windows-7-display-date-using-small-icons

    http://www.Google.com.au/search?q=use+small+taskbar+but+have+date+and+time&SourceID=IE7&RLS=com.Microsoft:-to THE: IE-address & ie = & oe = & gws_rd = cr & redir_esc = & ei = 4L7sUaPiKKWSiQe2_IFQ

  • SQL Developer: How to copy the data with the output grid column headers?

    Hello

    I use the 2.1.1.64 Version.

    I run a SQL query, down the results grid in the "Query result" window below. Say that I get 10 rows returned, with 5 columns.

    I want to copy this whole grid, as well as the names/column headers to the Clipboard. If I can stick under the original query to document the results of this query.

    I can't find any way to do this. I can copy/paste the results grid, but it does not copy the headers.

    The only way I think to do is to go through many steps to export in a TXT file, then paste that. Unfortunately, that's a lot of steps wasted if I need to do it again and again, and more, the output is pasted in an ugly format with double quotes, etc..

    It seems that the easiest feature is copy and paste the entire grid of the results, and of course, you could the headers. Why is it so difficult/impossible to do?

    (I think that the toad has the same problem. DBArtisan lets you copy and paste the results together, as well as headers, however.)

    Any help would be appreciated!

    Thank you
    John

    Shift-Ctrl-C will copy the headers of columns as well as the selected data.

  • How to insert the date with timestamp in the table values

    Jin
    I have a table

    create the table abc1 (dob date);

    insert into abc1 values (to_date (sysdate, "HH24:MI:SS RRRR/MM/DD))

    but when I see in the database, it shows that the normal date without time stamp.

    Is it possible to insert in the back-end with time stamp.

    Thank you...

    Firstly, SYSDATE is a DATE already, no need to convert a DATE using the TO_DATE() function.

    The date ALWAYS was a component "hour", if it is displayed until your NLS settings. for example:

    SQL> CREATE TABLE ABC1(DOB DATE);
    
    Table created.
    
    SQL> ALTER SESSION SET NLS_DATE_FORMAT='MM/DD/YYYY';
    
    Session altered.
    
    SQL> INSERT INTO ABC1 VALUES(SYSDATE);
    
    1 row created.
    
    SQL> SELECT * FROM ABC1;
    
    DOB
    ----------
    02/04/2010
    
    SQL> ALTER SESSION SET NLS_DATE_FORMAT='MM/DD/YYYY HH24:MI:SS';
    
    Session altered.
    
    SQL> SELECT * FROM ABC1;
    
    DOB
    -------------------
    02/04/2010 12:54:57
    
    SQL> DROP TABLE ABC1;
    
    Table dropped.
    
  • How to synchronize the data with the existing database maker?

    Hello

    is it possible to synchronize data with an existing database maker in data as Oracle designer maker
    -Connect to existing database
    -Generate a script (change if the object exist create if exists or not,...)
    -Run the script

    Thank you

    I created a quick demo and hung in [my blog: http://sueharper.blogspot.com/2009/08/updating-database-using-detail-from.html] or directly from [here: http://www.screentoaster.com/watch/stVEpWRUBIR11WRVlbXFpZVlRX/update_the_database_using_oracle_sql_developer_data_modeler]

    Sue

  • Oracle SQL Developer - how to display the date with TIME

    OK I change the setting of the NLS to DD-MON-RR HH.MI. SS
    (Tools-> Preferences-> database-> parameter NLS)

    BTW - what is changing the format of the database or just my client side? I don't want to change the database and other users would be affected by my change.


    I check the date time poster by practice
    SELECT double TO_CHAR(SYSDATE + 1, 'DD-MON-YYYY HH:MI:SS');

    Returns
    JUNE 24, 2009 10:32:55

    OK, here is my problem or question...
    but I wan't do in East... I have a column in a table that stores a number of minutes from a given date...
    the given date is 12/30/1899 00:00:00

    If I want to display the minutes in a format of date and time... but when I do
    Select To_TIMESTAMP (30 December 1899 00:00:00 "," mm/dd/yyyy HH24:MI:SS) + (Start_Moment) / 1440.
    To_Date (30 December 1899 00:00:00 "," mm/dd/yyyy HH24:MI:SS) + (Stop_Moment) / 1440
    from tableA

    RESULTS
    22 JUNE 09 23 JUNE 09

    I tried the function TO_CHAR but don't have time to be like
    Select TO_CHAR (to_date('12/30/1899 00:00:00', 'mm/dd/yyyy HH24:MI:SS') + 57580140 / 1440) double

    RESULTS
    22 JUNE 09

    I don't know that it's the simple convert function that I do not know...

    Mark as answer?

  • Can someone show me how to get the data of this vi in four columns in a spreadsheet file.

    I'm trying to get the data into four columns on a worksheet. The data consists of two channels and two measures, a maximum voltage and a voltage after x seconds. I enclose the code. Any help would be great. Thank you.


  • How to set the "data repetition" as default for all columns property

    Hello
    I have a report of existing response that has 260 columns. I want to put all the columns on the report for data "repeat" I can dump the data in excel. Y at - it a shortcut to do this, or do I have to manually update each column?

    Thank you
    Ankur

    No, if you don't have that, you should ask your administrator. Other that, you must do it manually. I'm sorry.

    Don't forget to close this thread. You can grant some points as well. Thank you.

  • update change the date with sysdate column

    Hello
    I want to add a new column, modify_date, to an existing table.

    This column must have sysdate when ever a record is updated.

    Please let me know the best way to do this same thing.

    Trigger? I think that some problem of mutation?

    Thanks and greetings

    Use a before update trigger and set the: new.modify_date such as SYSDATE.

    SQL> create table t(no number, last_updated date)
      2  /
    
    Table created.
    
    SQL> insert into t values(1,'')
      2  /
    
    1 row created.
    
    SQL> commit
      2  /
    
    Commit complete.
    
    SQL> edit
    Wrote file afiedt.buf
    
      1  create or replace trigger t_trig before update on t for each row
      2  begin
      3     :new.last_updated := sysdate;
      4* end;
    SQL> /
    
    Trigger created.
    
    SQL> update t set no = 2 where no = 1
      2  /
    
    1 row updated.
    
    SQL> select * from t
      2  /
    
            NO LAST_UPDA
    ---------- ---------
             2 04-DEC-08
    
  • How to capture the data of type string with agent script and then compared to an alarm

    Hello...

    How to capture the string with agent of script data and then create a rule to compare the string data to generate alarm?

    Thank you!...

    Start here:

    http://en.community.Dell.com/TechCenter/performance-monitoring/Foglight-administrators/w/Admins-wiki/6155.custom-script-agent-1-leverage-an-existing-monitoring-script-to-push-data-into-Foglight

Maybe you are looking for

  • KB2446708 - appears in the taskbar even when it has been installed

    original title: KB2446708 The download icon keep appearing on my task bar, even if the download has been downloaded and installed, and every time I stopped it keeps the installation and is always present on the taskbar, how can I fix it

  • XPS 13 not installed drive

    Hello Just got a XPS13 9350 and when I try to start the computer, I get an error Hard drive not installed Any suggestions Concerning [Note from the Admin, photo showing the service deleted in accordance with the TOU strategy number.] TD

  • Cisco Aironet 1830 disable broadcasting of the SSID

    I recently bought a Cisco Aironet 1830 with the mobility Express version. installed 8.2.100.0. This unit is my controller and my only AP. I configured the device, but I can't seem to find a setting in the GUI or the CLI of the controller or AP disabl

  • Cloning three-tiered process

    Hello members of Lenovo. Recently, I have damaged my x220t that was more repairable... so I just bought another x230t. Unfortunately I do not have the means the SSD lenovo stock, but I absolutely loved on my x220t. My x220t is still in working order,

  • Yolu editable in Photoshop CS6 arrow heads

    I know how to draw a line with an arrowhead in CS6... My question is: can I change an existing arrow in CS ^ (length, line width, proportions of arrowhead)?  I don't see where it allows me to do this.Thank you