Results 1 to 6 of 6

Hybrid View

  1. #1
    Member
    Join Date
    Dec 2009
    Location
    athens
    Posts
    6
    Hi , my approach was wrong , now i create a table and i pass static values to the cells ,
    then i create two Maps holding the positions [item=index] and [fields = index]
    so onUpdate i get the indexes and i know which cell to update on my model table

    but actually now i have stack , what i want is on updated_cell to change the background foreground colors depends the old and new value

    with DefaultTableCellRenderer i have only the new value of the cell on class
    how i can get to DefaultTableCellRenderer the old and the new value of the item_field so to change the colors depends the prices !!??

    i have try to change the
    getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    to
    getTableCellRendererComponent(table, OLDvalue,NEWvalue, isSelected, hasFocus, row, column);

    but looks not working right

    in demos the java client change the colors to yellow only for o while and its not depends by the old and new values

    Thanks

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi metero,

    I think that you just need to customize a little the UpdateString class in order to store also the old value of a cell or replace the method isHot with a method that return the background color in accordance with your comparison of old and new values.

    Hope That helps.

  3. #3
    Member
    Join Date
    Dec 2009
    Location
    athens
    Posts
    6
    Hi ,
    i have change the UpdateString to

    protected LSUpdateString(String newValue, String oldValue, boolean isHot)

    and i have add the following checks

    you have the first , i have add the second, is for date
    if (newValue.indexOf(":") > -1 || newValue.indexOf("/") > -1)

    and here the second check is for string of negative numbers
    if (Character.isDigit(newValue.charAt(0)) || ((String) newValue).startsWith("-"))

    what i am trying and i canot understand is how i can close the connection,
    what i mean , i use the Swing_StockListDemo on my project ,
    i have make some changes for compare new and old values and update the colors depends the prices
    i have add static values for some columns ,like QTY portfolio ,

    but i cant understand witch is the best way when i close the form to stop the feed , i have try the unsubscribe
    SubscribedTableKey tableRef;
    tableRef = client.subscribeTable(tInfo, this.table.getTableListener(), false);
    client.unsubscribeTable(tableRef);

    but as i can understand this only remove the items when i use client.closeConnection(); i get exception error



    thanks

  4. #4
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi metero,

    To stop receiving feed from Lightstreamer server the unsubscribeTable/s is/are the correct methods to call, after that your client application will no longer receive any data from the server. I did not understand if you had different expectations.

    Instead, closeConnection() method closes the network connection with the server if one is open, stopping any subscriptions still open. That you got an exception calling this method is not normal so, please can you post here the exception StackTrace?

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 07:19 AM.