1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    1
    Vote Rating
    0
    pascal.m. is on a distinguished road

      0  

    Default Unanswered: Newly added Widget not visible and setVisible, layout(), repaint() not working

    Unanswered: Newly added Widget not visible and setVisible, layout(), repaint() not working


    Hi everyone,
    i am experiencing some strange problems. I have a created a window by extending the Window-class of gxt and added a vertical panel which holds two ContentPanels. One of the ContentPanels holds buttons and other controls and the other is used für displaying widgets, in this case some Charts, but only one of them at a time.

    Everything works fine, i load my data and the first chart is displayed automatically, as intended. The problem occurs when i try to switch to another chart: The previous chart is removed as desired, but the new chart is not displayed. I checked the forum and google before posting and found that calling the containers layout()-function might help, but it doesn't.

    I even tried repaint() and even setting setVisible(true) explicitly, but again no success.
    After that i inserted some Window.alert() messages into my code to see if the other charts exist and which chart was removed and if it was setVisible(true).

    The alerts clarified that most of it works fine, the right chart was removed, a new chart added, but the newly added chart is not setVisible(true) (isVisible returns false) even though i set it after it was added.

    Here some examples:
    Removing the old Chart:

    Code:
    if (lineChartBla.isAttached()) {            removed = lineChartBla;
                lineChartBla.removeFromParent();
                //center.remove(lineChartBla);
                
            } else if (barChartBla.isAttached()) {
                removed = barChartBla;
                barChartBla.removeFromParent();
                //center.remove(barChartBla);
                
            }
    Adding a new one:

    Code:
    if (aggregation.equals("day")) {                    center.add(lineChartBla);
                        lineChartBla.setVisible(true);
                        center.layout();
                        com.google.gwt.user.client.Window.alert(String.valueOf(lineChartBla.isVisible()));
    
    
                    } else {
                        center.add(monthBlaLine);
                        monthBlaLine.setVisible(true);
                        center.layout();
                        com.google.gwt.user.client.Window.alert(String.valueOf(monthBlaLine.isVisible()));
                    }
    I hope someone can help.

    Regards Pascal

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    Russian federation, Smolensk
    Posts
    38
    Answers
    5
    Vote Rating
    0
    Mike_javaJunior is on a distinguished road

      0  

    Default


    maybe it's too simple, but I had such problem when trying to run my project withou recompiling.(I use maven). when I packaged it, everything appeared.

Thread Participants: 1