SimpleTableModel Refresh and Clear Values

View: New views
7 Messages — Rating Filter:   Alert me  

SimpleTableModel Refresh and Clear Values

by Arturo Caballero :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there!

I have a little problem with SimpleTableModel.

I need to delete the values previously set to the table model. I tryied with setting a empty String[][] then invoke fireTableModelChanged but it keeps the same data.

Code:
    empty = new String[0][3];
    tdDetalle = new SimpleTableModel(empty, columns);
    tdDetalle.fireTableModelChanged();


How can I clear the rows of the TableModel?

Thanks in advance for your time.

Regards,

AC Very Happy


--
Ing. Arturo Caballero
jacaballero@...
http://www.linkedin.com/in/jacaballero

Re: SimpleTableModel Refresh and Clear Values

by atom83 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hello!

i have the same problem.

actually it changes the table when I scroll the screen.

how can I make it that it changes the table right away??

thx
thomas

Re: SimpleTableModel Refresh and Clear Values

by Arturo Caballero :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Thomas,

I understand by the docs that the metod fireTableModelChanged  of the table model will update the model and the table related will be repainted too.

Hope it helps.

Regards!



On Wed, Dec 3, 2008 at 4:19 AM, atom83 <Thomas.Horvatits@...> wrote:

hello!

i have the same problem.

actually it changes the table when I scroll the screen.

how can I make it that it changes the table right away??

thx
thomas

--
View this message in context: http://www.nabble.com/SimpleTableModel-Refresh-and-Clear-Values-tp20778181p20810211.html
Sent from the Netbeans Java Mobile Edition/ME Users (Mobility) mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...




--
Ing. Arturo Caballero
jacaballero@...
http://www.linkedin.com/in/jacaballero

Re: SimpleTableModel Refresh and Clear Values

by atom83 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Arturo Caballero wrote:
the metod fireTableModelChanged  of the table
model will update the model and the table related will be repainted too.
thanks for your reply!

I have tried with fireTableModelChanged. without calling this method, changes arent affected, but with, it makes the changes but doesnt update the screen till I scroll.
 here my code:

tableItem = new TableItem(Display.getDisplay(this), "DeviceTable")
tableModel1 =    new SimpleTableModel(controlUnit.showDevices(),
                      new java.lang.String[]{"IP","GPS","Energy"});
         tableItem.setModel (tableModel1 );
         tableModel1.addTableModelListener(tableItem);  


// changing the values
tableModel1.setValues(controlUnit.showDevices());
           tableModel1.fireTableModelChanged();
does anyone has an idea?

thx
thomas


Re: SimpleTableModel Refresh and Clear Values

by Arturo Caballero :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Have you tried refreshing the Form with some method? I think there is a hierachy, where you have to refresh first the control that encapsulates other controls.



On Wed, Dec 3, 2008 at 9:49 AM, atom83 <Thomas.Horvatits@...> wrote:


Arturo Caballero wrote:
>
>
> the metod fireTableModelChanged  of the table
> model will update the model and the table related will be repainted too.
>
>

thanks for your reply!

I have tried with fireTableModelChanged. without calling this method,
changes arent affected, but with, it makes the changes but doesnt update the
screen till I scroll.
 here my code:



> tableItem = new TableItem(Display.getDisplay(this), "DeviceTable")
> tableModel1 =    new SimpleTableModel(controlUnit.showDevices(),
>                       new java.lang.String[]{"IP","GPS","Energy"});
>          tableItem.setModel (tableModel1 );
>          tableModel1.addTableModelListener(tableItem);
>
>
> // changing the values
> tableModel1.setValues(controlUnit.showDevices());
>            tableModel1.fireTableModelChanged();
>

does anyone has an idea?

thx
thomas


--
View this message in context: http://www.nabble.com/SimpleTableModel-Refresh-and-Clear-Values-tp20778181p20815533.html
Sent from the Netbeans Java Mobile Edition/ME Users (Mobility) mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...




--
Ing. Arturo Caballero
jacaballero@...
http://www.linkedin.com/in/jacaballero

Re: SimpleTableModel Refresh and Clear Values

by atom83 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Arturo Caballero wrote:
Have you tried refreshing the Form with some method? I think there is a
hierachy, where you have to refresh first the control that encapsulates
other controls.
I was looking for a refresh or repaint method either in the Form class or the Display, but couldn't find some??

thx

Re: SimpleTableModel Refresh and Clear Values

by hoochie_coochie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

experienced the same problem with changing tablemodel dynamically. Finally opened the source code of tableItem class and found that in fireTableModelChanged method there is repaint(); string and it is commented!! Found in the web that somebody had copied the class into project folder and deleted the // in front of repaint(); You can leave everything as is and try that stupid solution:
tableItem.setColorSchema(tableItem.getColorSchema);
cause in this method of TableItem class repaint() left uncommented by the author.
that worked with me.
PS. neither of recommended in the web works but only this variant.

Arturo Caballero wrote:
Hi there!

I have a little problem with SimpleTableModel.

I need to delete the values previously set to the table model. I tryied with
setting a empty String[][] then invoke fireTableModelChanged but it keeps
the same data.

 *Code:*      empty = new String[0][3];
    tdDetalle = new SimpleTableModel(empty, columns);
    tdDetalle.fireTableModelChanged();

How can I clear the rows of the TableModel?

Thanks in advance for your time.

Regards,

AC [image: Very Happy]

--
Ing. Arturo Caballero
jacaballero@gmail.com
http://www.linkedin.com/in/jacaballero