How to update ArrayCollection at runtime?

Am facing some problem with arraycollection..
am having an arraycolelction like this...
var dpHierarchy:ArrayCollection = new ArrayCollection([
{Region:"Demand1"},
{Region:"Demand2"},
{Region:"Demand3"},
{Region:"Demand4"}]
now what am looking for is.. how to update this
arraycollection at runtime using actions script?
i need to update this array colelction something like this...
var dpHierarchy:ArrayCollection = new ArrayCollection([
{Region:"Demand1", Year:"2008"},
{Region:"Demand2", Year:"2008"},
{Region:"Demand3", Year:"2008"},
{Region:"Demand4", Year:"2008"}]
How to add Year field in to existing arraycollection like
shown in about example..
thanks in advance
Pratap

There are two ways you can do this. One would be setting it
straight like this.
private function updateDP():void {
dpHierarchy[0].Year = "2008";
This will also make it so that every other item in your
ArrayCollection has the Year identifier however nothing will be
filled in for the values. The other way you could do this would be
to user setItemAt which would look like this.
dpHierarchy.setItemAt({Region:"Demand1", Year:"2008"}, 0);
which essentially does the exact same thing except your
setting all the properties of that item instead of just adding the
identifier Year.

Similar Messages

  • How to update stylesheets at runtime?

    Strangely the style does'nt change if i manually change the css class rules in one of the css document and switch between the 2 files.
      @Override
      public void initialize(URL url, ResourceBundle rb) {
        final String cssUrl1 = getClass().getResource("/tracker/view/fxmlgui1.css").toExternalForm();
        final String cssUrl2 = getClass().getResource("/tracker/view/fxmlgui2.css").toExternalForm();
        rootPane.getStylesheets().add(cssUrl1);
        rootPane.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
          @Override
          public void handle(KeyEvent keyEvent) {
            if (keyEvent.getCode().equals(KeyCode.DIGIT1)) {
              rootPane.getStylesheets().clear();
              rootPane.getStylesheets().add(cssUrl1);
              msgLabel.setText("Css1 selected.");
            } else if (keyEvent.getCode().equals(KeyCode.DIGIT2)) {
              rootPane.getStylesheets().clear();
              rootPane.getStylesheets().add(cssUrl2);
              msgLabel.setText("Css2 selected.");
    The event occurs and the style change from css1 and css2 as they was at the time of stage rendering, but if then i change one of the rules in the sylesheets after the stage is layed out, the style does'nt change anymore.
    So wich is the general way to change the style of nodes changing the css document at runtime?
    It's as the initial stylesheets in the css documents are someway cached and does'nt update at any switch.

    The controller's initialize() method is invoked during the call to FXMLLoader.load(...). Your application almost certainly has a structure like this:
    Parent root = FXMLLoader.load(...);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    So at the point the initialize(...) method is called the root pane hasn't actually been attached to a Scene; thus the call to getScene() returns null.
    However, when your handler methods are called, the root will have been attached to a Scene and the Scene placed in a Stage, so at that point it is safe to call getScene() and getWindow() on the result.
    I would actually manipulate the stylesheets on the Scene, rather than the Stage, so the call to getWindow() is probably not needed.
    So I would try:
      @Override
      public void initialize(URL url, ResourceBundle rb) {
        final String cssUrl1 = getClass().getResource("/tracker/view/fxmlgui1.css").toExternalForm();
        final String cssUrl2 = getClass().getResource("/tracker/view/fxmlgui2.css").toExternalForm();
        rootPane.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
          @Override
          public void handle(KeyEvent keyEvent) {
            if (keyEvent.getCode().equals(KeyCode.DIGIT1)) {
              rootPane.getScene().getStylesheets().clear();
              rootPane.getScene().getStylesheets().add(cssUrl1);
              msgLabel.setText("Css1 selected.");
            } else if (keyEvent.getCode().equals(KeyCode.DIGIT2)) {
              rootPane.getScene().getStylesheets().clear();
              rootPane.getScene().getStylesheets().add(cssUrl2);
              msgLabel.setText("Css2 selected.");
    The only issue now is that the initial stylesheet isn't set on the Scene. If you really want to do this from the controller, you need to listen for changes to the sceneProperty on the root pane. This gets a little ugly, but you can do something like this in your initialize method:
    rootPane.sceneProperty().addListener(new ChangeListener<Scene>() {
         @Override
         public void changed(ObservableVale<? extends Scene> observable, Scene oldScene, Scene newScene) {
              if (newScene != null) {
                   newScene.getStylesheets().add(cssUrl1);
                   rootPane.sceneProperty().removeListener(this);
    If you wanted to hold a reference to the Scene in the controller, you could use this same ChangeListener to do so, but there's no real benefit to doing that and the code is less readable, imo.
    Do you think i can use jdk8 as a stable jvm or it's yet for testing only as it's an early release?
    It depends to a certain extent what you're doing, but generally I would recommend using it for testing only. I was just suggesting trying your code against it to see if the issues were caused by a bug that had been fixed, which would rule out the possibility that there was something still wrong in your code that we weren't seeing. I can see two use cases for using JavaFX 8 right now other than just for testing. One (which I'm actually doing in one project right now) is if you have a release date suitably far ahead (ours is summer 2014) that you can reasonably expect JDK8 to be in a stable public release at that time. (You'd also probably want either to be able to control the JRE version for your client machines or be planning on a "native bundle" release.) The other is if you had a non-critical application that was going to be deployed in-house for a very limited number of users, and you wanted to take advantage of some new JDK/JavaFX 8 features.

  • How to update query at runtime

    I have one input page in which i display only some fields from a table (some are hide through to model -> attributes --> properties). i have a mandatory field in one of hidden fields and i need to set some default value to that field after user clicks on Commit button. How to do that. Can some body helps me.

    Hi,
    Thank you Duncan and Scott. I set it through entity object properties and it is working fine.
    One more help,
    I want to display two table fields in one insert form (JSP) and after the values are entered it has to be insert in to two tables. Do you have any document or help manual on that.
    Thanks,

  • How to update the ItemRenderer at runtime..?

    Hi....
    am facing a hectic problem with ITemRenderes..
    My requirement is like i need to insert a Label and Image in
    each item of Horizontal List.
    For this i created a ArrayCollection with Lable and
    ImagePath. And assigning array as a Dataprovider to HorizontalList.
    and am attaching itemrenderer to it (which hold the lable and
    image).
    code:
    var data:ArrayCollection=new ArrayCollection({label:'A',
    path:'a.jpg'}, {label:'B', path:'b.jpg'}{label:'C', path:'c.jpg'});
    var hList:HorizontalList=new HorizontalList();
    hList.dataProvider=data;
    hList.itemRenderer=new ClassFactory(rendererObj);
    rendererObj holds the Lable Component and Image Componnet..
    Now the porblem is am trying to change the horizontal list at
    runtime. Like i want to change the lable of selected item in
    Horizontal list. Am able to update the arraycollection values. But
    its not getting effected in ItemRenderer.
    How to update the itemerenderer at runtime...?
    Thanks in Advance...
    Pratap

    Hi Pratap,
    I was playing with some sample code for this...
    Here is the main.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import mx.utils.ArrayUtil;
    import mx.collections.ArrayCollection;
    import mx.collections.IViewCursor;
    import mx.controls.Alert;
    import mx.events.*;
    import mx.controls.dataGridClasses.DataGridListData;
    import mx.controls.listClasses.BaseListData;
    import mx.controls.HorizontalList;
    import mx.controls.dataGridClasses.DataGridColumn;
    import mx.containers.TitleWindow;
    [Bindable] private var myItemRenderer:ClassFactory;
    private function doit()
    myItemRenderer = new ClassFactory(rendererObj);
    var mydata:ArrayCollection=new
    ArrayCollection([{mylabel:'A', path:'a.jpg'}, {mylabel:'B',
    path:'b.jpg'},{mylabel:'C', path:'c.jpg'}]);
    var myList:HorizontalList = new HorizontalList();
    myList.dataProvider = mydata;
    this.addChild(myList);
    myList.itemRenderer=myItemRenderer;
    ]]>
    </mx:Script>
    <mx:Button x="204" y="191" label="Button"
    click="doit()"/>
    </mx:Application>
    Here is the rendererObj.mxml (component/itemrenderer)
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="110" height="76"
    implements="mx.core.IFactory,mx.controls.listClasses.IDropInListItemRenderer"
    backgroundColor="#BAB3B3" borderStyle="solid" borderThickness="3"
    borderColor="#000000">
    <mx:Script>
    <![CDATA[
    import mx.collections.IViewCursor;
    import mx.controls.listClasses.BaseListData;
    import mx.controls.Label;
    private var _listData:BaseListData;
    public function newInstance():*
    return new rendererObj();
    public function get listData() : BaseListData
    return _listData;
    public function set listData( value:BaseListData ) : void
    _listData = value;
    override public function set data(value:Object):void {
    if (value != null)
    var r:Label = new Label();
    r.text = value.mylabel;
    this.addChild(r);
    ]]>
    </mx:Script>
    </mx:VBox>
    See how that works..you press the button and the itemrenderer
    gets drawn into the horiz. list with the values from the
    arraycollection.
    I didnt implement the picture, but you get the idea on how to
    get
    the values into the hlist..
    hope this helps...

  • How to update cgicmd.dat file during runtime?

    I'd like to know how do update cgicmd.dat file during runtime. For example, I run a report one.jsp as
    http://<machine>:<port>/reports/rwservlet?one.jsp&USERID=uid/pwd@db&DESTYPE=cache&mode=bitmap&desformat=htmlcss
    within this report there is a hyperlink to open another report named two.jsp.
    before creating this hyperlink, I'd like to update cgicmd.dat file with passed in userID, pwd, and connection, so two.jsp can use this key for userinfo
    so I can create hyperlink as follows
    srw.set_hyperlink('/reports/rwservlet?report=two.jsp'||
    '&cmdkey=userinfo&DESTYPE=cache&mode=bitmap&desformat=htmlcss');
    Thanks

    To my knowledge the cgicmd.dat is only read when the OC4J starts, so you would have to come up with another solution. Using Single-Sign-On (SSO) is quite a good idea, and it's there for cases like this.
    Regards,
    Martin Malmstrom

  • How can update my class instance at runtime?

    What would happen if at runtime I update a class file?
    Will the JVM know to use that instead?
    How can I use the updated class at runtime?
    Who can give me an example?
    thanks all!

    yes,I write it like these:
    //MyClassLoader.java
    import java.io.*;
    public class MyClassLoader extends ClassLoader
         public Class loadClass(String name,boolean resolve)
              throws ClassNotFoundException{
              //return super.loadClass(name,resolve);
              Class c=findClass(name);
              resolveClass(c);
              return c;
         public Class loadClass(String name)
              throws ClassNotFoundException{
              return loadClass(name,true);
    public Class findClass(String name) {
    byte[] b = loadClassData(name+".class");
    //return defineClass(name, b, 0, b.length);
              Class c=null;
              System.out.println("load--class--data--success!");
              c=defineClass(name,b,0,b.length);
              System.out.println("define class success!");
              return c;
    private byte[] loadClassData(String name) {
    // load the class data from the connection
         byte[] b=null;
         try{
              //DataInputStream in =
    //new DataInputStream(
              BufferedInputStream in=
    new BufferedInputStream(
    new FileInputStream(name));
              int len=in.available();
              b=new byte[len];
              in.read(b,0,len);
              System.out.println("load "+name+" is success!\n"+name+"'s length is"+len);
         }catch(Exception e){System.out.println("load--"+name+"--data error:"+e);}
         return b;
    //Client.java
    import java.io.*;
    public class Client
         public static void main(String[] args)
         try{
              System.out.println("����������Load��������������");
              DataInputStream input=new DataInputStream(System.in);//��������������Load��������������
              MyClassLoader loader=new MyClassLoader();
              Load load=(Load)loader.loadClass(input.readLine()).newInstance();
              while(true){
                   load.print(); //print a sentence here! I will modify it when Client is runing!
                   input=new DataInputStream(System.in);
                   String inStr=input.readLine();
                   if(inStr!=null && inStr.trim()!=null)
                        load = (Load)loader.loadClass(inStr).newInstance();
         }catch(Exception e){System.out.println("main error:"+e);}
    I skip the Load interface and it's sub class,it's easy.
    MyClassLoader can load my class from the disk!
    why?

  • HT1338 how do i update to java runtime environment? Sun JavaVM (Virtual Machine)

    I need to update/install Java Runtime in order to update my Brother Printer. How do I install this program?

    See Using Java in Mac OS X.

  • How can I fix the Runtime Error R6034 so that I can correctly install iTunes on my PC ? I get a notice that states ' An application has made an attempt to load the C runtime library incorrectly - Please contact the application's support team for more info

    How can I fix the Runtime Error R6034 so that I can correctly install iTunes on my PC ? I get a notice that states ' An application has made an attempt to load the C runtime library incorrectly - Please contact the application's support team for more info

    Hey Debbiered1,
    Follow the steps in this link to resolve the issue:
    iTunes 11.1.4 for Windows: Unable to install or open
    http://support.apple.com/kb/TS5376
    When you uninstall, the items you uninstall and the order in which you do so are particularly important:
    Use the Control Panel to uninstall iTunes and related software components in the following order and then restart your computer:
    iTunes
    Apple Software Update
    Apple Mobile Device Support
    Bonjour
    Apple Application Support (iTunes 9 or later)
    Important: Uninstalling these components in a different order, or only uninstalling some of these components may have unintended affects.
    Let us know if following that article and uninstalling those components in that order helped the situation.
    Welcome to Apple Support Communities!
    Take care,
    Delgadoh

  • How to update link and import data of relocated incx file into inca file?

    Subject : <br />how to update link and import data of relocated incx file into inca file.?<br />The incx file was originally part of the inca file and it has been relocated.<br />-------------------<br /><br />Hello All,<br /><br />I am working on InDesignCS2 and InCopyCS2.<br />From indesign I am creating an assignment file as well as incopy files.(.inca and .incx file created through exporing).<br />Now indesign hardcodes the path of the incx files in inca file.So if I put the incx files in different folder then after opening the inca file in InCopy , I am getting the alert stating that " The document doesn't consists of any incopy story" and all the linked story will flag a red question mark icon.<br />So I tried to recreate and update the links.<br />Below is my code for that<br /><br />//code start*****************************<br />//creating kDataLinkHelperBoss<br />InterfacePtr<IDataLinkHelper> dataLinkHelper(static_cast<IDataLinkHelper*><br />(CreateObject2<IDataLinkHelper>(kDataLinkHelperBoss)));<br /><br />/**<br />The newFileToBeLinkedPath is the path of the incx file which is relocated.<br />And it was previously part of the inca file.<br />eg. earlier it was c:\\test.incx now it is d:\\test.incx<br />*/<br />IDFile newIDFileToBeLinked(newFileToBeLinkedPath);<br /><br />//create the datelink<br />IDataLink * dlk = dataLinkHelper->CreateDataLink(newIDFileToBeLinked);<br /><br />NameInfo name;<br />PMString type;<br />uint32 fileType;<br /><br />dlk->GetNameInfo(&name,&type,&fileType);<br /><br />//relink the story     <br />InterfacePtr<ICommand> relinkCmd(CmdUtils::CreateCommand(kRestoreLinkCmdBoss)); <br /><br />InterfacePtr<IRestoreLinkCmdData> relinkCmdData(relinkCmd, IID_IRESTORELINKCMDDATA);<br /><br />relinkCmdData->Set(database, dataLinkUID, &name, &type, fileType, IDataLink::kLinkNormal); <br /><br />ErrorCode err = CmdUtils::ProcessCommand(relinkCmd); <br /><br />//Update the link now                         <br />InterfacePtr<IUpdateLink> updateLink(dataLinkHelper, UseDefaultIID()); <br />UID newLinkUID; <br />err = updateLink->DoUpdateLink(dl, &newLinkUID, kFullUI); <br />//code end*********************<br /><br />I am able to create the proper link.But the data which is there in the incx file is not getting imported in the linked story.But if I modify the newlinked story from the inca file,the incx file will be getting update.(all its previous content will be deleted.)<br />I tried using <br />Utils<IInCopyWorkflow>()->ImportStory()<br /> ,But its import the incx file in xml format.<br /><br />What is the solution of this then?<br />Kindly help me as I am terribly stuck since last few days.<br /><br />Thanks and Regards,<br />Yopangjo

    >
    I can say that anybody with
    no experience could easily do an export/import in
    MSSQLServer 2000.
    Anybody with no experience should not mess up my Oracle Databases !

  • How to update ADF VO object to refresh the data in ADF Pivot table

    I need to know how to update the View object so that the date in pivot table is refreshed/updated/filtered.
    here are the steps I performed to create ADF pivot table application using VO at design time.
    1) created a collection in a Data Control (ViewObject in an ApplicationModule) that provides the values I wanted to use for row and column labels as well the cell values (Used the SQL query)
    2) Dragged this collection to the page in which wanted to create the pivot table
    3) In the pivot table data binding editor specified the characteristics of the rows (which attribute(s) should be displayed in header), the columns (likewise) and the cells.
    Now, I have a requirement to update/filter the data in pivot table on click of check box and my question is how to I update the View object so that the date in pivot table is refreshed/updated/filtered.
    I have got this solution from one of the contact in which a WHERE clause on an underlying VO is updated based upon input from a Slider control. In essence, the value of the control is sent to a backing bean, and then the backing bean uses this input to call the "filterVO" method on the corresponding AppModule:
    but, I'm getting "operationBinding" object as NULL in following code. Please let me know what's wrong.
    here is the code
    Our slider component will look like
    <af:selectBooleanCheckbox label="Unit" value="#{PivotTableBean.dataValue}"
    autoSubmit="true" />
    The setDataValue() method in the backing bean will get a handle to AM and will execute the "filterVO" method in that, which takes the NumberRange as the input parameter.
    public void setDataValue(boolean value) {
    DataValue = value;
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = (OperationBinding)bindings.getOperationBinding("filterVO");
    Object result = operationBinding.execute();
    The filterVO method in the AMImpl.java will get the true or false and set the where Clause for the VO query to show values.
    public void filterVO(boolean value) {
    if (value != null) {
    ViewObjectImpl ibVO = getVO1();
    ibVO.setWhereClause("PRODUCT_TOTAL_REVENUE(+) where rownum < 10");
    ibVO.executeQuery();
    }

    Did you define a filterVO action in your pagedef.xml file?
    You might want to read on how to access service method from a JSF Web Application in the ADF Developer Guide for 10.1.3 chapter 8.5

  • I have downloaded the latest pages  update on my iPad, but my iMac still has version 4.3 and I cannot find out how to update it only desktop. When I try to send something from my iPad pages to via email to be opened on my desktop in Pages, it won't open P

    I have downloaded the latest pages update on my iPad, but my iMac still has Pages version 4.3, and I cannot find out how to update it on my desktop. When I try to send something from my iPad pages via email to be opened on my desktop in Pages, it won't open in Pages. I get a message that it can't be opened because the version is too old. I sent the document as a PDF and it worked. But I want to be able to use Pages back and forth. HOw do I update the Pages version on my desktop iMac?

    The file format used by the iOS versions of the iWork apps can only be read by the new iWork apps on your Mac - i.e. Keynote 6, Pages 5 & Numbers 3. Those versions for the Mac require Mavericks, OS X 10.9. The "too old" error on a Mac comes if you are trying to open an iWork '08 or earlier file in the newest apps. If you do have the newest apps you can open the files from your iPad.
    If you can't or don't want to upgrade to Mavericks & the newest iWork apps your best option would be to export/share the files from the iPad to a type an older version of iWork can read such as Word, text, Excel, etc.
    Or contact AppleCare. They made this mess, let them fix it.

  • How to update an existing item in a sharepoint list using the WSS adapter for Biztalk

    Is there a way that a record in SP list be updated using WSS adapter in biztalk ?
    BizTalk 2013 and SP 2013 ..
    Regards
    Ritu Raj
    When you see answers and helpful posts,
    please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

    A ListItem has its own unique row id so in all likelihood, an insert with the same data will result in a new list entry. The Lists Web Service however, has an UpdateListItem method which will take an update request. [refer
    http://msdn.microsoft.com/en-us/library/office/websvclists.lists.updatelistitems(v=office.15).aspx ]
    There is another note in the conference (marked answered) to your List Item Update problem. Probably worth a try too. [refer
    http://social.msdn.microsoft.com/Forums/en-US/bee8f6c6-3259-4764-bafa-6689f5fd6ec9/how-to-update-an-existing-item-in-a-sharepoint-list-using-the-wss-adapter-for-biztalk?forum=biztalkgeneral ]
    Regards.

  • How to update the table available in BADI method

    Hi Friends,
    I have to implement one badi ME_REQ_POSTED for purchase requistion, in this badi  I have to read first line item and do
    some check...if that check is true i need to update subsequent line item (line 20, 30, 40 or so) with purchase group and MRP controller.
    In this BADI i have method POSTED, in this method parameter IM_EBAN is a table which i need to modify with my different
    values for purchase group and MRP controller.
    Kindly let me know how to update this table, so the changes can be reflected in purchase requistion.
    Since when I tried to directly modify the table in a loop, system throw one error stating IM_EBAN can not be modified.
    kindly help.
    pradeep

    hi
    I have implemented this exit but it does not stop at it while saving Purchase requistion. But my previous BADI stops at it when saving.
    Kindly guide.

  • How to update the table value in the valuechange event?

    I have an input field in the datatable with the valueChangeListener
    <rich:dataTable id="cart" value="#{cart.cartList}" var="item">
    <h:inputText value="#{item.cost}" id="qty" valueChangeListener="#{items.updateCost}" onchange="submit()">
    <h:outputText value="#{item.errorMsg}"> </h:outputText>
    in the backing bean
         Item item = (Item) model.getRowData();
    // do some update, if the cost too larger, change to max_cost
         item.setCost(max_cost);
         item.setErrorMsg("Error Msg");
    After calling the valuechange method, the screen output doesn't update the cost.
    How to update the table value in the valuechange event?

    As you're misusing the valueChangeListener to set another input field, you need to skip the update model values phase. Otherwise the value set in the valueChangeListener will be overridden by the submitted value. You can do this by calling the FacesContext#renderResponse() inside the valueChangeListener method. This will shift the current phase immediately to the render response phase, hereby skipping the update model values and invoke application phases.

  • Has anyone been able to contact Adobe to learn why their Flash Player does not work on Mac OS 10.6.8, no matter how many updates you install?  This seems like a big error by Adobe.

    I have thee Mac computers with Mac OS 10.6.8, one of which is a Mac Pro.  No matter how many updates I install from Adobe, their Flash Player does not work on any of these 3 computers.  I don't know how to contact Adobe Systems about this problem, but I think it is their responsibility to make sure that their so-called "universal" software works proplerly on a relatively recent operating system like OS 10.6.8 that is still in widespread use.  When you install the updates, nothing happens -- not even an error message.  What is the point of a universal player that is not universal?  It works fine on my MacBook Pro with OS 9 Mavericks, but it does not work at all -- indeed, has never worked -- on my 3 Macs with OS 10.6.8.  Has anyone contacted Adobe Systems to find out why the Flash Player does not work with OS 10.6.8 and what they plan to do about it?

    Where are you getting Flash from?
    Get the appropriate dmg installer here and then run it.
    http://www.adobe.com/products/flashplayer/distribution3.html
    If it still won't install, do these two things: First uninstall any Flash by going into the second level Hard Drive Library>Internet Plug-ins, and trash the Flash Player.plugin and flashplayer.xpt. Then boot into Safe Boot, Shift at the startup chime (give it much longer than a usual boot) and run the installer while booted in Safe Boot.

Maybe you are looking for