How to refresh the ListView

I have try change item in the ListView. But ListView refreshed only after add a new point.
How can I refresh the ListView?
My code:
     @Override
     public void start(Stage stage) throws Exception
     {
          buildForm(stage);
          stage.show();
     }
     //--------------------------------------------
     void buildForm(Stage stage)
     {
          BorderPane root = new BorderPane();
          Scene scene = new Scene(root, 800, 650);
          stage.setScene(scene);
          
          items.add(new SimpleStringProperty("1"));
          i++;
          items.add(new SimpleStringProperty("Line" + i));
          i++;
          list.setItems(items);
          root.setCenter(list);
          
          HBox buttons = new HBox();
          root.setBottom(buttons);
          
          Button buttonChange = new Button("Change");
          buttonChange.setOnAction(new EventHandler<ActionEvent>()
                    {
                         public void handle(ActionEvent event)
                         {
                              String value = items.get(0).get();
                              if(value.length() == 1)
                                   items.get(0).setValue("-1");
                              else
                                   items.get(0).setValue("1");
                              //not refresh
                         }
                    });
          
          Button buttonAdd = new Button("Add item");
          buttonAdd.setOnAction(new EventHandler<ActionEvent>()
                    {
                         public void handle(ActionEvent event)
                         {
                              items.add(new SimpleStringProperty("Line" + i));
                              i++;
                              //refresh
                              
                         }
                    });
          buttons.getChildren().addAll(buttonChange, buttonAdd);
          
     }

?

Tags: Java

Similar Questions

  • How to refresh the Listview after adding a new item

    Hello

    I have the following list:

     ListView {
                                        id: channelsList
    
                                        dataModel: categoryModel
    
                                        listItemComponents: [
                                            ListItemComponent {
                                                type: "item"
                                                StandardListItem {
                                                    title: ListItemData.name // Channel name
                                                    imageSource: ListItemData.imageFile
                                                    status: ListItemData.id
    
                                                    id: channelItemId
    
                                                    contextActions: [
                                                        ActionSet {
                                                            //title: contentView.title
                                                            ActionItem {
                                                                title: "Add to Favorites"
    
                                                                onTriggered: {
                                                                    console.log(ListItemData.id + " will be added to the Favorites");
                                                                    //categoryModel.addFavorite(ListItemData.name, ListItemData.imageFile, ListItemData.id);
                                                                    channelItemId.ListItem.view.viewTriggered(ListItemData.name, ListItemData.imageFile, ListItemData.id);
                                                                }
    
                                                            }
    
                                                        }
                                                    ]
                                                }
                                            }
                                        ]
    
                                        onTriggered: {
                                                var chosenChannel = dataModel.data(indexPath);
                                                console.log("indexPath: " + indexPath);
    
                                                var playingPage = playpagedef.createObject();
    
                                                playingPage.chname = chosenChannel.name;
                                                playingPage.cid = chosenChannel.id;
                                                playingPage.init();
    
                                                Qt.nav.push(playingPage);
    
                                        }
    
                                        attachedObjects: [
                                            // The bucket categoryModel is a non visible object so it is set up as an attached object.
                                            // The categoryModel itself is a QListDataModel defined in categorymodel.h and registered
                                            // as a type in the creation of the application.
                                            CategoryModel {
                                                id: categoryModel
                                                // The path to the JSON file with initial data, this file will be moved to
                                                // the data folder on the first launch of the application (in order to
                                                // be able to get write access).
                                                jsonAssetPath: "models/channels.json"
    
                                                // The filtering is initially set to "Category 1" to show category channels
                                                filter: label.text
                                            },
    
                                            ComponentDefinition {
                                                id: playpagedef
                                                source: "PlayingPage.qml"
                                            }
                                        ]
    
                                        function viewTriggered(name, imageFile, id)
                                        {
                                            categoryModel.addFavorite(name, imageFile, id);
                                            categoryModel.clear();
                                        }
    
                                    }
    

    and the categoeymodel.h is as follows:

    #ifndef _CATEGORYMODEL_H
    #define _CATEGORYMODEL_H
    
    #include 
    #include 
    #include 
    #include 
    
    using namespace bb::data;
    
    // The category categoryModel is based on the QListDataModel template, which in turn
    // implements the abstract DataModel class.
    typedef bb::cascades::QListDataModel CategoryListModel;
    
    /* CategoryModel Description:
     *
     * CategoryModel class for the Category List application, the data categoryModel
     * reads and write from a JSON file that keeps all item data
     * for the list.
     */
    class CategoryModel: public CategoryListModel
    {
    Q_OBJECT
    
    Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged)
    
    Q_PROPERTY(QString jsonAssetPath READ jsonAssetPath WRITE setJsonAssetPath NOTIFY jsonAssetPathChanged)
    
    public:
        /**
         * Constructor that sets up the recipe
         * @param parent The parent Container, if not specified, 0 is used
         */
        CategoryModel(QObject *parent = 0);
        ~CategoryModel();
    
        QString filter();
    
        void setFilter(const QString filter);
    
        QString jsonAssetPath();
    
        void setJsonAssetPath(const QString jsonAssetPath);
    
    signals:
    
        void filterChanged(QString filter);
    
        void jsonAssetPathChanged(QString jsonAssetPath);
    
    public slots:
        void addFavorite(QString channelName, QString channelImageFile, int channelId);
    
    private:
        bool jsonToDataFolder();
    
        // Property variables
        QString mFilter;
        QString mJsonAssetsPath;
        QString mJsonDataPath;
    
        // A list containing all data read from the JSON file
        QVariantList mData;
    
        //Invocation variables
        bb::cascades::Invocation* mInvocation;
    };
    
    #endif // ifndef _CATEGORYMODEL_H
    

    My problem is that the listview is not get automatically updated when a new item is added to the datamodel (a favorite channel is added). I have to exit the application and restart to see the updated list.

    categoryModel.addFavorite(name, imageFile, id);
    categoryModel.clear();
    

    categoryModel.clear ();

    does not work. I get:

    Asset: / / / hand. QML:180: TypeError: result of expression 'categoryModel.clear' [undefined] is not a function.

    I would like to know how to achieve using approach "more correct".

    QListDataModel does not expose its internal storage directly. It is possible to reconstruct the map by performing an iteration in a loop (with the help of data() and size() methods), the dataModel entries:

    http://developer.BlackBerry.com/Cascades/reference/bb__cascades__qlistdatamodel.html

    but I don't see how this could help. If the filtered data is changed, it must be merged with the original sort data.

    Why the original approach has not worked?

    I could not understand from the description appearance of the interface user, please post a screenshot if possible.

  • How to refresh the listview that is in another function

    Hi all,
    I have a problem with a refreshing of the listview.

    I have 3 features in the application, let's say 'feature A' 'feature B' and 'C'.

    I also have 2 tables and sqlite db (local) .and 1 view their names are 'A table', 'table B' and 'see C.

    View C is like this:

    create view C as

    Select a.oneColumn

    Table has a

    Union

    Select b.oneColumn

    Table B b;

    Each function has the main amx.page and each of them has listview values from the (local) sqlite DB.


    According to A, I can add new row to the database (line update or delete) and the list is updated with the help of the "ProviderChangeSupport".

    Same thing happens in the function (B) everything is ok so far. But according to C, there also listview. When I delete operation or update functionality or B.

    the listview in C function is not updated.


    I hope you all can easily understand the problem and help me with the solution. Oracle Mobile Application Framework.

    Hello

    you need to reset a feature - navigating it--you want to ensure the functionality and so refreshes the view. The change of supplier support works in the ClassLoader (feature film) it is issued to. You can use a listener to refresh the controls collection of data used by a list, but it does not work automatically.

    Frank

  • How to refresh the entire screen?

    Hello

    Please can someone tell me how to refresh the entire screen?

    Refresh here means clear all fields and show empty fields.

    Thank you

    Afonso Tyagi

    Hey,.

    as I usually do, is to create a separate function that manually assigns to each field and property reverts to its original state. There is not a function that does it for you. You must create your own. hope that helps good luck!

  • How to refresh the contents of a SimpleList?

    Hello

    I want to refresh the contents of a SimpleList. Unfortunately there is no method of clearAll() and no size() method. So no idea on how to do it?

    OK, you use 6.0...

    Well, if you are using SimpleList, you only display string, right? So, you can use remove() to remove an item from your list. This code allows to clear your list:

    int row = 0;
    try {
      your_list.remove(index);
      index++;
    } catch (IllegalArgumentException ex) {
    }
    

    Or you can use the set() method to update an existing line...

  • BSOD and how to refresh the computer

    I have a gateway to window computer 8 I've had for a year now and never restarts time I try to put on my computer it won't let me because it goes to the home page and comes up with a message with different types of BSOD errors and then force, then whenever the computer load it keeps then me on reviews and it never let's me back to my original account and I need a way of doing things to normal or if someone can tell me how to reset the computer that would also be very useful.

    Original title: my computer problems

    Hey Nasir,

    I understand that your computer gives error BSOD and your user account is signing you as a guest user and you also want to know about reset.

    Sorry to hear about the embarrassment caused and thank you for the detailed description.

    To help you better please answer the following questions:

    1. What is the brand of computer?
    2. You have a third-party security program installed on the computer?
    3. You recently made any changes to the computer?

    This issue could be due to the following issues:

    • Drivers are corrupt.
    • Damaged user account.
    • Problems of virus and malware.

    Learn more about BSOD please refer to the article:

    http://answers.Microsoft.com/en-us/Windows/wiki/windows_other-system/blue-screen-of-death-BSOD/1939df35-283f-4830-A4DD-e95ee5d8669d

    Follow the suggestions below and check if this can help:

    Method 1: Safe Mode

    Follow the bottom of the article which will help you to start the computer in safe mode and check if it works fine in safe mode:

    http://Windows.Microsoft.com/en-us/Windows-8/Windows-startup-settings-safe-mode

    Search your computer in safe mode, all the third-party program installed on the computer are disabled in this mode.

    Method 2: steps can be followed to BSOD

    This article will help you solve the BSOD errors on the computer:

    http://Windows.Microsoft.com/en-us/Windows-8/resolve-Windows-blue-screen-errors

    System Restore warning: When you use system restore to restore the computer to a previous state, the programs and updates that you have installed are removed.

    How to reset the computer

    Please follow the article below and this will give you the procedure step by step to start the reset of the computer:

    http://Windows.Microsoft.com/en-us/Windows-8/restore-refresh-reset-PC

    Refer to: refresh your PC without affecting your files.

    Hope this information helps. For any other corresponding Windows help, do not hesitate to contact us and we will be happy to help you.

  • How to refresh the arraylist on MAF UI

    Hello

    I'm developing an application of MAF with Jdev 12.1.3.0.0.

    I have a listView on my page of amx. This is value bound to an arraylist (ArrayList < String >) in the bean support. There is an event of action on the page, which adds items to the ArrayList instance.

    My problem is, I'm not able to update the display of the list on my user interface.

    Newspapers, I am able to see the event method called as well as a list of Board action is changed.

    But that updated the arraylist reflects not on my user interface.

    Here is my code snippets:

    ---------------------------

    the amx page:

    < amx:listView var = value ' row' = "#{TripsBacking.refreshtimelist}" showMoreStrategy = 'autoScroll' bufferStrategy "viewport" id = "listView1" = > "

    < amx:listItem id = "SDp" showLinkIcon = "false" >

    < amx:outputText value = "#{line}" id = "ot1" / >

    < amx:actionListener id = binding = "#{TripsBacking.pullToRefresh"al1"}" type = "swipeDown" / > "

    < / amx:listItem >

    < / amx:listView >

    ---------------------------

    Backing bean:

    public class TripsBacking {}

    ArrayList < String > refreshtimelist;

    Transitional public PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport (this);

    Transitional public ProviderChangeSupport providerChangeSupport = new ProviderChangeSupport (this);

    {} public void setRefreshtimelist (ArrayList < String > refreshtimelist)

    ArrayList < String > old_value = this.refreshtimelist;

    This.refreshtimelist = refreshtimelist;

    propertyChangeSupport.firePropertyChange (old_value, "refreshtimelist", refreshtimelist);

    providerChangeSupport.fireProviderRefresh ("refreshtimelist");

    }

    public ArrayList < String > getRefreshtimelist() {}

    Return refreshtimelist;

    }

    public TripsBacking() {}

    refreshtimelist = new ArrayList < String > ();

    refreshtimelist. Add (Calendar.GetInstance () .getTime (). ToString());

    }

    {} public void pullToRefresh (ActionEvent actionEvent)

    Calendar c = Calendar.GetInstance ();

    Date d = c.getTime ();

    ArrayList < String > templist = getRefreshtimelist ();

    System.out.println ("date:" + d);

    templist. Add (d.ToString ());

    setRefreshtimelist (templist);

    }

    {} public void addPropertyChangeListener (PropertyChangeListener l)

    propertyChangeSupport.addPropertyChangeListener (l);

    }

    {} public void removePropertyChangeListener (PropertyChangeListener l)

    propertyChangeSupport.removePropertyChangeListener (l);

    }

    }

    ------------------------------

    I will surely provide more information if necessary.

    Ask for your help to solve this problem. Thank you.

    Thank you

    Tejas desrousseaux

    Hi Tejas,

    you declare a variable of providerChangeSupport, but you need to add public methods to support:

        public void addProviderChangeListener(ProviderChangeListener l) {
            providerChangeSupport.addProviderChangeListener(l);
        }
    
        public void removeProviderChangeListener(ProviderChangeListener l) {
            providerChangeSupport.removeProviderChangeListener(l);
        }
    

    You must move the providerChangeSupport.fireProviderRefresh ("refreshtimelist"); calling the method "pullToRefresh" (after the call to the set method).

    If you trigger the refresh, the entire list is reloaded. If you want to refresh only new posts, you must use the method providerChangeSupport.fireProviderCreate (Oracle Fusion Middleware Java QAnywhere for Oracle Mobile Application Framework).

  • How to refresh the Parent page after closing the window pop up (Dailog)

    Hello

    My Version of JDEV is 11.1.1.7.0

    I open the POP-UP (Dailog) using goLink

    Now how can I use property return Action Listener to refresh the parent page.

    Thank you

    Venkatn

    Hello

    Is there a reason why you using a goLink erq? Could replace you it with a commandLink? You will be able to refresh the page in the earphone of return.

    Kind regards.

    Ruben

  • How to refresh the region after inserting data by dynamic Action?

    Hi friends

    I use APEX 4.1. I created a form master detail and wrote an insert command in dynamic Action through which the data is inserted into the secondary table. I want to refresh the detail region as data is inserted and data must demonstrate in the detail area.

    How can I do this? Help, please. I will be grateful.

    Kind regards.

    Hi Kam_oracle_apex,

    Add real action to the existing dynamic action

    Action: update

    selection type: region

    Region: Detail (the region that you want to refresh).

    Kind regards

    Jitendra

  • How to refresh the report region change which column of report selection list

    Hello
    I worked with apex 4.2 and I create a classic report with list (named loved) select a column in the list change in report, update the table with the new value via JavaScript (change) call and woke up very well, and I change the color of the line was updated to make it different from the other lines now I want to update to the report after doing update without submitting the page to show the new color of line update.
    I called javascript:apex.submit() in the update function, but

    My Question
    1. How do I refresh the report after change report column list without sending page
    2-can we enter column name selection list report to submit the Page to refresh the report area


    Thank you
    Ahmed

    See my answer above!

    Here's what I did:

    • Created two hidden page items

    • Created a dynamic action on the page with three real actions. (1) set the item values page. (2) to execute code to update the plsql table. (3) update the region report

    Thank you
    Vikram

  • How to refresh the current screen? Thank you

    I want to get the screen like this: the screen has an EditField and ListField. After that I have enter a word editfield and click enter, then the listfield will be updated, refresh the screen. The code below:

    public class malls extends screen implements {FocusChangeListener}
    private CustomeManager cManager;
    private LabelField titalField;
    find the EditField private;
    Private TreeField neayby;
    LabelField MDD;
    private ListField mallList;
    Private ListCallback listCallback;
    Private TreeCallback treeCallback;
    Private VerticalFieldManager gird;
    public Malls()
    {
    Super (new CustomeManager (0), DEFAULT_MENU |) DEFAULT_CLOSE);
    cManager = (CustomeManager) getDelegate ();
    titalField = new LabelField ("SGMalls");
    find = new EditField("","Find:");
    find.setFocusListener (this);
    girdles you = new VerticalFieldManager (Manager.VERTICAL_SCROLL |) Manager.VERTICAL_SCROLLBAR);
    GIRD. Add (titalField);
    GIRD. Add (Find);
    treeCallback = new TreeCallback();
    neayby = new TreeField (treeCallback, TreeField.FOCUSABLE);
    int nod = neayby.addChildNode (0, "NeayBy");
    neayby.addChildNode (nod, "Northpoint");
    label is new LabelField ("list of shopping malls");.
    listCallback = new ListCallback();
    mallList = new ListField() {}
    protected boolean touchEvent (TouchEvent message)
    {

    If (message.getEvent () == TouchEvent.Click & message.getEvent ()! = TouchEvent.Down)
    {
    String mallName = listCallback.get (mallList, getSelectedIndex()) m:System.NET.SocketAddress.ToString ();
    UiApplication.getUiApplication () .pushScreen (new MallContent (mallName));
    }
    Return super.touchEvent (message);
    }
    };
    mallList.setCallback (listCallback);
    VerticalFieldManager gridmanager = new VerticalFieldManager (Manager.VERTICAL_SCROLL |) Manager.VERTICAL_SCROLLBAR);
    for (int i = 0; i)<>
    {mallList.insert (i);
    Mall of chain = "Mall" + i;
    listCallback.Insert (mall, i);
    }
    GridManager.Add (mallList);
    cManager.setfirstField (gird);
    cManager.setsecondField (neayby);
    cManager.setthirdField (label);
    cManager.setlastField (gridmanager);
    }
    protected void sublayout (int width, int height) {}
    setPositionDelegate (0, 0);
    layoutDelegate (width, height);
    setPosition (0, 0);
    setExtent (width, height);
    }
    storeItem private MenuItem = new MenuItem ("Search Store", 100, 10)
    {public void run() {}
    UiApplication.getUiApplication () .pushScreen (new store());
    onClose();
    }
    };
    protected void makeMenu (menu Menu, for example int)
    {
    menu. Add (storeItem);
    }

    I hope the focusChanged method can get to the screen
    ' Public Sub focusChanged (field field, int eventType)
    {V VirtualKeyboard = getVirtualKeyboard();}
    Field f = getFieldWithFocus ();
    if(f==Find)
    {
    v.setVisibility (VirtualKeyboard.SHOW);
    String text = find.getText ();
    If (text.length > 0 () & text.charAt (text.length () - 1) == '\n') {}
    listCallback.erase ();
    mallList.insert (5);
    listCallback.Insert ("New", 5);
         
    cManager.invalidate ();
    }
    }
    else {}
    v.setVisibility (VirtualKeyboard.HIDE);
    }
    }
    }

    Instead of using FocusChangeListener, you can use FieldChangeListener or manage the click on the trackball by substituting invokeAction()

    Etienne

  • How to refresh the result iterator to uncommitted changes

    Hello

    JDev 11.1.2.4

    I have a VO with a VC. In my AM I exposed 2 VO:

    VO1 = VO without the VC

    VO2 = VO with the VC

    I have in my user interface:

    VO1-based array in which I can add, update, or delete rows.

    a button that shows a popup that contains a table based on VO2

    Scenario: update

    I make a modification on an existing line. The change is made on automatic transmission of true - field.

    I click on the button

    The table on the shortcut menu shows the changed value

    Ok

    Scenario 1: create

    I have create a new line. Fields to create the new line are all send auto = true

    I click on the button

    The table on the shortcut menu does not show the new line. It shows only the last State (original + changed lines lines)

    KO

    Scenario 1: remove

    I delete an existing line.

    I click on the button

    The table on the shortcut menu does not show the deleted row. It shows only the last State (original + changed lines lines)

    KO

    Q: what can I do, for the table on the shortcut menu shows the current status (non-validated data). I tried to refresh the iterator after a creation or deletion, but I still get the old data?

    DCIteratorBinding myIterator = ADFUtils.findIterator (iterator);
    myIterator.executeQuery ();
    myIterator.refresh (DCIteratorBinding.RANGESIZE_UNLIMITED);

    Thank you

    It depends on the vo and the Victoria Cross. The two vo must rest on the same area of occurrence. The Victoria Cross should have mode query so (memory and db) and the Victoria Cross on the second vo should be in a way that the new line would be part of the result set if given th could be read from db.

    Timo

  • How to refresh the items in selectOneChoice after change of database items

    WWW the JPA and ADF application, but without BC.
    In the present draft of the table T1 (long tid, tNom string) model. Current methods of JPA for work with the table. They are built automatically from table.
    His presentations via block EJB and data controls.
    In the project view this page where is used.
    ....
    < af:popup id = "idDlgAddType" >
    < af:dialog title = "New type" id = "d3" dialogListener = "#{TypeBean.handleAddDialog}" >
    < af:inputText label = "Type" id = "idDlgInputTypeName" value = "#{TypeBean.typename}" / >
    < / af:dialog >
    < / af:popup >
    < af:selectOneChoice id = value = "#{bindings.t1FindAll.inputValue"idTypeList"} ' simple 'true' shortDesc = 'Type' = >"
    < f: selectItems value = "#{bindings.t1FindAll.items}" id = "idTypesNames" / > "
    < / af:selectOneChoice >
    < af:spacer width = "5" id = "sp2" / >
    < af:commandButton immediate = "true" text = "Adding a type" clientComponent = "true" id = "idBtnAddType" >
    < af:showPopupBehavior popupId = "idDlgAddType" alignId = "idBtnAddType" align = "afterStart" / >
    < / af:commandButton >
    ......

    This supported beans class CType synonymous TypeBean. In this class this method handleAddDialog.
    Bean saved:
    public class CType {}
    private String typename;
    ....
    {} public void handleAddDialog (DialogEvent event)
    If (event.getOutcome () .equals (DialogEvent.Outcome.ok)) {}
    AdfFacesContext.getCurrentInstance () .getViewScope () .put ("T1", new T1 (null, this.typename));
    BindingContainer bc is BindingContext.getCurrent () .getCurrentBindingsEntry ();.
    Method JUCtrlActionBinding = (JUCtrlActionBinding) bc.getOperationBinding ("persistT1");
    Method.Execute ();

    RichSelectOneChoice cid = (RichSelectOneChoice) FacesContext.getCurrentInstance () .getViewRoot () .findComponent ("idTypeList");
    AdfFacesContext.getCurrentInstance () .addPartialTarget (cid);

    }
    }
    }

    Question:
    How to force the object selectOneChoice to read items from a database?
    The selected channels do not lead to the necessary result. New record in the table is displayed. But it is not displayed in the list on the screen.
    Moreover, the regeneration of the page through a browser control also does not lead to the appearance of the record added in the list.

    Hello

    Re-run the iterator, which depends on the list of selectOneChoice. You can do so after completing the update. The reason why you don't see a change in your current implementation is that you do not change the collection of the iterator that fills the list

    Frank

  • How to refresh the entire page in the Managedbean code:

    I need to refresh the entire page using the MB .can someone give me the code for this.


    Sanchez

    Hi Catherine,

    Try this

    http://Electrotek.WordPress.com/2008/05/30/Refresh-current-JSF-page/

    Arun-

  • How to refresh the playlist on Android app

    There is a setting in iTunes/Windows to update the library to the cloud, it sends recent changes, but how do update you the library on the Android app so it pulls down the updates pending in the cloud? I saw him run updates from time to time, but it seems to do it randomly.

    Android app 0.9.9 version (245)

    LG V10 performer Marshmallow 6.0

    I noticed most sync of things more in a few minutes, but things like play counts can take about 24 hours to synchronize with devices.

    Also in the music of Apple on Android, when you're in the high level view of playlists you can drag and pull down to refresh.

Maybe you are looking for