FDS fill method problem

Hi,
I have a requirement in which i can able to search for data,
display on a grid check some rows, press delete button, it will get
deleted from DB and the remaining items are shown on screen. Since
its a soft delete function that happens in another DB schema, wat
am doing is to call ds.fill() on search, and to call an RPC like
ro.deleteItems(ArrayCollection). and then again ds.fill(). But its
throwing some error saying null object reference. But it works fine
if i click the search button again, which displays the remaining
record. Please help me to solve this issue. From console i came to
know that the data is returned to the Flex side, but its not
displaying in the grid. Please help me out in this issue... am
stuck now :( Thanks in Advance.

hello... anybody out ter to help me? my code segment goes lik
this...
// ds is the id for DataService and rpc is the id for
RemoteObject.
rpc.delete(deleteSE); //deleteSE is an ArrayCollection
ds.fill(AC,VO); // AC is the DP for Datagrid. VO is the
parameter passed to bring AC according to some conditions
this brings the contents back but an action script error is
thrown and the datagrid is not getting updated.
please help me...
TIA

Similar Messages

  • Problem accessing results from DataService fill method

    I've set up an application that gets data from a data service
    configured with a java-dao adapter. If I define a DataGrid
    with the
    array populated by the fill method I see the data in the
    grid. Cool.
    So I know I've configured and coded everything correctly.
    However, if I try to access the data with the following code,
    it
    appears my array is empty!
    ray = new ArrayCollection();
    ds = new DataService("assets");
    ds.fill(ray);
    var asset:Asset = ray[0];
    This gives me an index '0' out of bounds error. I've also
    tried
    ray.getItemAt(0) with the same results.
    How do I access and manipulate the results of a fill method
    via
    ActionScript? I'm currently using Beta3.

    Note that it takes time to actually make the dataservice call
    and retrieve the results. Your data won't be available right away.
    After calling fill(), you have to wait for the "result" event of
    the DataService object.

  • BufferedReader's readLine() method problem (REPOST)

    Hello,
    If anyone can help me out I would not have to struggle :)
    Here is the thing. I have a file like this:
    1 srjetnuaazcebsqfbzerhxfbdfcbxyvihswlygzsfvjleengcftwvxcjriwdohjisnzppipiwpnniui yjpeppaezftgjfviwxunu
    2 ekjghqflatrcdteurofahxoiyvrwhvaxjgcuvkkpondsqhedxylxyjizflfbgusoizogbffgwnswohe njixwufcdlbjlkoqevqdy
    3 stfhcbslgcrywwrgbsqdkcxfbizvniyookceonscwugixgrxvvkxiqezltsiwhhepqusjdlkhadvkzg iefgarenbxnxtxnqdqpfh
    4 dcuefkdrkoovjwdrqbpgoirruutphuiobqweknxhboyktxzcczgekrlbfsbfuygjpheydiwaasxifph tldawxsfepotkgqqsivur
    5 fpfrspbuhangkeugfuwexsgivetovkoyloddgofdcajwwlrocgjrhonsrfrfxozvgohwoytycfjoycr xdhnhxyitkeqynedrbroh
    6 hgzqqsfgnotfepywbpccrosxborslqtkanyffrwknjapnzjnesjlkbbsckbyvgrxujqyocpcpctsqyz apcinhjyysxsdwfjugndr
    7 pltzealtrklzrugxdcskndqyvsrzncitqvjcnndeqossyrifzvbqovtdzsixjlizsbxwutgqipuxfid xyoktwupsuqbqgnxdfbze
    8 avpxfjgwpxnzfsfosgsryhpyaezigrqsxsgdvwdbwovhcchrijbitvbcvltrgvadogokaennwpjjpku uttidlnqftdnzqpqafels
    9 oyvztgletdwdtibshpzeuqryvulnubrqtgxwizfsdzqlgxvsebhslnovphgehfigbjyyqsirqcwflbn bnrflotpqytqzbgnkeyrk
    10 unvryrnlqucuydrasyzyiclnjvospzdoviqchdhasxzffblwsewikzbznyegrqtjvxfxfjenvrboofb xfsynlxhyuvqprqbvoruk
    and my java programs is like this:
    public String searchForAString(String fileName, int lineNumber)
    File fileObject = new File(fileName);
    String finalString ="";
    String record = "";
    int line;
    try
    FileInputStream fileInputStreamObject = new FileInputStream(fileObject);
    BufferedInputStream bufferedInputStreamObject = new BufferedInputStream(fileInputStreamObject);
    //DataInputStream dataInputStreamObject = new DataInputStream(bufferedInputStreamObject);
    BufferedReader bufferedReaderObject = new BufferedReader(new InputStreamReader(bufferedInputStreamObject));
    //System.out.println(bufferedReaderObject.readLine());
    //System.out.println("_____________________");
    while((bufferedReaderObject.readLine()) != null)
    System.out.println(bufferedReaderObject.readLine());
    Last System.out.println statement only displays second, forth, sixth, eigth, tenth and null lines. Why not every line? Any ideas? Thanks!
    Re: BufferedReader's readLine() method problem.
    Author: EagleEye101 Feb 18, 2005 8:48 PM (reply 1 of 1)
    You do relize that when you call the in.readLine() in your loop conditional and in your loop body it reads in diffrent lines. Try this:
    public String searchForAString(String fileName, int lineNumber)
    File fileObject = new File(fileName);
    String finalString ="";
    String record = "";
    int line;
    try
    FileInputStream fileInputStreamObject = new FileInputStream(fileObject);
    BufferedInputStream bufferedInputStreamObject = new BufferedInputStream(fileInputStreamObject);
    //DataInputStream dataInputStreamObject = new DataInputStream(bufferedInputStreamObject);
    BufferedReader bufferedReaderObject = new BufferedReader(new InputStreamReader(bufferedInputStreamObject));
    //System.out.println(bufferedReaderObject.readLine());
    //System.out.println("_____________________");
    String s = bufferedReaderObject.readLine();
    while(s != null)
    System.out.println(bufferedReaderObject.readLine());
    s = bufferedReaderObject.readLine();
    Every time you call the readLine method, it does read a diffrent line. Java does not know you want to read the same line twice.
    Tried it, did not work. I need to go through each line of the file I have. Any ideas?

    solution should be in your other thread.
    Please do not repeat threads--it really bugs the people here, just some 'nettiquite' --I don't mean to be a grouch.
    --later.  : )                                                                                                                                                                                                                                                                                                                                                       

  • Fill method isn't working on arrays.

    I am trying to use(on JDK 1.4) the fill method of util.Arrays class to fill an array. It gives "cannot resolve symbol" error at the line with fill command. What am I doing wrong here ?
    import java.util.Arrays;
    public class arrtest {
    public static void main(String[] args)
    int arr[] = new int[20];
    fill(arr,0,7,1);
    }}

    The fill() method is a static member of the Arrays
    class and hence must be identified as such. Try
    substituting the following line for what you already
    have:
    Arrays.fill(arr, 0, 7, 1);ShaunYup.
    Thanks Shaun.

  • Disabling Quick Fill method menu items

    We are using Quick Fill functionality for Service Request Detail Applet.
    Enabled the 4 method menu items and those are working fine.
    1. ApplyTemplate
    2. SaveTemplate
    3. NewFromTemplate
    4. NewFromLastTemplate
    These methods are based on a vanilla business service 'Quick Fill Service'
    We have to disable(gray out) these method menu items for Cancelled SR.
    Tried to disable the corresponding command's method: 'LaunchNewFromTemplate' by config (CanInvokeMethod) and script, but it is not graying out method menu item.
    Did any one face this issue?
    How to disable (gray out) these Quick Fill method menu items? Please advice.
    Thanks,
    Ramana

    He should be able to use Spotlight to launch Parallels anytime he wants. Unless changed, command-space is the default command to get Spotlight to open. Typing in the name of the program and clicking the down arrow until you select the program and hitting Return will launch the program.

  • Using Calendar.set() method problem

    Hi all,
    First of all sorry to bother with such a trivial(?) matter but I cannot solve it by myself.
    I have a piece of code which I simply want to handle the current date with the GregorianCalendar object so that the date would be set to the Calendar.SUNDAY (of the current week). Simple enough?
    Code as follows:
    import java.util.*;
    import java.text.*;
    public class Foo
    public static void main(String[] args)
         Foo foo = new Foo();
         Date newdate = foo.bar();
    public Date bar()
         GregorianCalendar m_calendar = new GregorianCalendar(new Locale("fi","FI"));
         m_calendar.setFirstDayOfWeek(Calendar.MONDAY);
         Date newDate = null;
         try
              m_calendar.setTime(new Date());
              System.out.println("Calendar='" + m_calendar.toString() + "'");
              m_calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
              SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
              StringBuffer sb = new StringBuffer();
              sdf.format(m_calendar.getTime(), sb, new FieldPosition(0));
              System.out.println("Date in format (" + sdf.toPattern()          + ") = '" + sb.toString() + "'");
         catch(Exception e)
              e.printStackTrace();
         return m_calendar.getTime();
    This should work at least accoring to my understanding of the SDK documentation as follows with
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
    Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
    Calendar='java.util.GregorianCalendar[time=1054636838494,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Helsinki",offset=7200000,dstSavings=3600000,useDaylight=true,transitions=118,lastRule=java.util.SimpleTimeZone[id=Europe/Helsinki,offset=7200000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2003,MONTH=5,WEEK_OF_YEAR=23,WEEK_OF_MONTH=1,DAY_OF_MONTH=3,DAY_OF_YEAR=154,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=1,HOUR_OF_DAY=13,MINUTE=40,SECOND=38,MILLISECOND=494,ZONE_OFFSET=7200000,DST_OFFSET=3600000]'
    Date in format (yyyy.MM.dd) = '2003.06.08'
    Which is the sunday of this week. But as I run the same code with:
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1.06-020625-14:20)
    Java HotSpot(TM) Server VM (build 1.3.1 1.3.1.06-JPSE_1.3.1.06_20020625 PA2.0, mixed mode)
    Calendar='java.util.GregorianCalendar[time=1054636630703,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=java.util.SimpleTimeZone[id=Europe/Helsinki,offset=7200000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2003,MONTH=5,WEEK_OF_YEAR=23,WEEK_OF_MONTH=1,DAY_OF_MONTH=3,DAY_OF_YEAR=154,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=1,HOUR_OF_DAY=13,MINUTE=37,SECOND=10,MILLISECOND=703,ZONE_OFFSET=7200000,DST_OFFSET=3600000]'
    Date in format (yyyy.MM.dd) = '2003.06.01'
    Which is sunday of the previous week and incorrect in my opinion. The latter result is run on HP-UX B.11.11 U 9000/800 and first on NT.
    Any ideas why this is happening? Thanks in advance!
    Greets, Janne

    Thanks for your answer!
    The problem is that I have to work with this older SDK version. :) But I got it solved by using the roll method with the following syntax:
    int delta = [dayToSet] - m_calendar.get(Calendar.DAY_OF_WEEK);
    in which the delta is of course the difference (negative or positive to the current day of the week)
    and then using the roll call:
    m_calendar.roll(Calendar.DAY_OF_WEEK, delta);
    which doesn't alter the current week. So this works if someone else has a similar problem with the version 1.3.1
    Greets, Janne

  • Enhance Method Problem

    I try to enhance a Method like described in this Thread...
    Re: Sending Email using the Outlook Client
    What I did so far...
    1) In Transaction "bsp_WD_CMPWB"  I choosed Component "BP_ADDR" and created a copy in our "Z_CRM" EnhancementSet
    2) I used the right Mousebutton to Enhance the "BP_ADDR/StandardAddress" View
    Two things had been automatically generated/created...
    - Table Contents BSPWD_CMP_C_REPL
    - Object ZL_BP_ADDR_STANDARDADDRES_CTXT
    3) I doubleclick on the enhanced View "BP_ADDR/StandardAddress"
        (-> In the "View Layout" node the StandardAddress.html is still using the Super Classes / Implementation Class CL_BP_ADDR_STANDARDADDRES_CN01 )
    4) If I go to Implemetation Class CL_BP_ADDR_STANDARDADDRESS_CN01
    5) Select method "GET_P_E_MAILSMT" (and look into the coding)
       The enhancement Functions there are not working for meu2026
       I tried the Button with the (Sprial / helix)
       and the Menu "Edit"-> "Enhancement Operations"
    Where is my error?! (I think I have to create a ZClass for the CL_BP_ADDR_STANDARDADDRES_CN01?!?!? But how to???)
    I will give all possible points for good answers
    Thanks for helpingu2026

    hi,
    Some times I also faced problems to create Zclass for standard ones. But you can do one trick to create Zclass.
    Try to create one dummy attribute in your context node, then it will creates  automatically Zclass for that node. Later you can delete that attribute.
    If you get any problems to create P-getter method, then copy the IF_BSP_WD_MODEL_SETTER_GETTER~_GET_P_XYZ template method and rename to GET_P_E_MAILSMT.
    regards
    Ismail

  • Multiple Payment Methods problem in F110 - Parameters

    <b>Prob : Wehn I enter more than one payment method in Parameters in F110 only the 1st Payment method entered is saved. The other payment method gets deleted automatically.</b>
    Following is already done :
    1. All the payment methods entered in F110 Parameters is already maintained in
    the vendor master.
    2. In FBZP - Payment Method for Country & Payment Method for Company Code
    is configured for all the payment methods.
    3. Also Invoices in FI (FB60) are posted for all the payment methods without any
    errors.
    4. Ranking order is maintained for each payment method & for the house bank
    used.
    5. Account determination is also maintained for all the payment methods for the
    respective house bank.
    6. The maximum amount is also maintained for all the payment methods under "Payment Methods for Comapany Code".
    Pl help to resolve this problem.

    hi,
    My problem is in the parameter stage 1st Screen.
    Also you cannot assign more than one Payment Method in the Print Variant.
    Also this variant is used only for printing. Its not called at the stage when I am entering the Payment Method in the 1st screen in the Parameter.
    I have somewhat found out what the problem is.
    I guess there is some change done in the standard SAP program, becuase if i type more than one payment method in the Parameter 1st screen and try to save it, it returns with a warning message "Only one Payment Method can be entered". This is a unique msg which has been written through a Z Program.
    Thanks.
    Bye.

  • PaintComponent method problems...

    Hi, I am developing an game application ( just for fun ) and I have a huge problem with paintComponent method. I Have a class ImagePanel that extends JPanel class. The ImagePanel class overrides the paintComponent method and paintChildren method ( since i have added components inside the JPanel also these must be painted ). The ImagePanel is instantied in my main class IntroView which extends JFrame where it's added. Now when the IntroPanel is created i have noticed that the paintComponent and paintChildren method is called all over again . I Have a soundclip playing in background in it's own thread and this continously paintComponent method call causes the sound clip to break off in few seconds. I Have tried to use JLabel instead of JPanel, but then the image is not shown( alltougth the methods are called only once ). I Have also tried next code to get rid of continous paintComponent call
    ...from ImagePanel class
    ImagePanel extends JPanel.....
    public final void paintComponent( Graphics g )
    if( firstTime )
    super.paintComponent( g );
    g.drawImage( myImage, 0, 0, this );
    firstTime = false;
    public final void paintChildrens( Graphics g )
    if( paintChildren )
    super.paintChildren( g );
    add( startLabel );
    add( optionsLabel );
    paintChildren = false;
    public boolean isOpaque()
    return true;
    Now the paintComponent and paintChildren is called only once. There is still a "little problem" since the paintComponent doesen't paint the image, it paints only the background( I think g.drawImage(...) didint have time to paint the image? ). Also the labels added in paintChildren method are not shown. Sounds paly now just fine.This situation makes me grazy. Please consult me with this problem.....i can surely send also the whole source if needed. There is no effect if I change isOpaque to true or false.

    Hi,
    Thanks for advices, I solved the problem...it was simplier than i thought. When the g.drawImage(.... is called ) i just added Thread.sleep( time ) after that line. This gives the sound therad time to play the sound without interrput and time to main thread to handle the image. All works now pretty much as i thought, except when JFrame is overlapped the image is not drawn again...this can be corrected ( maybe?)by adding windoslistener and implement the methods in that inteface and make some repainting in different situations. But cause you gave me the magic work Thread priority I hox! the problem, so here goes 10 duke dollars.

  • APPLET'S STOP METHOD - PROBLEM!!

    I'm learning java on my own, and I have a problem. Could you help me.
    The stop()** method in my applet does not show on the appletviewer until I close the appletviewer.
    I open another program like notepad, but when I come back to the appletviewer it doesen't show!
    It only shows right before I close it.
    Why is that?
    Thanks
    stop() {
    showStatus("STOPPED");

    Dear JustAnotherProgramer,
    pillaged from the docs
    stop
    public void stop()
    Called by the browser or applet viewer to inform this applet that it should stop its execution. It is called when the Web page that contains this applet has been replaced by another page, and also just before the applet is to be destroyed.
    It seems that if you run it in a browser and you go to the other page(same browser) it will be called.
    I guess by changing focus between different application(notepad) it will not work.
    Thank
    Joey

  • ActiveX Server Method Problem

    LabView men help me!
    I have a problem with using ActiveX Server Method object.Run(async) with
    async = TRUE in MS Visual C++ program.
    I want to call ActiveX Server and continue program execution.
    I call this metod in program block.
    COleVariant No_Wait;
    No_Wait.boolVal = TRUE;
    pVI->Run(No_Wait);
    After this operator I can not return from VI, until VI does not close, inspite
    of parameter async = TRUE.
    I ask your send me example how to use this metod and wait for you recomendations.
    Gregory.

    I think I have exactly the example program both of you are looking for. Take a look and post to let us know if you have any questions. Thanks!
    Best Regards,
    Chris C
    Applications Engineering
    National Instruments
    Chris Cilino
    National Instruments
    LabVIEW Product Marketing Manager
    Certified LabVIEW Architect
    Attachments:
    Calling_LabVIEW_from_C++_Using_ActiveX.zip ‏4972 KB

  • Finder methods problem

    Hi
    I met a very funny problem. when I try to deploy a entity BMP.(compile was ok).
    The bean have a method called findSubElements(this is not a finder method). I
    got the a exception:
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ ejbFindXXX method
    for 'findSubElements(java.lang.String,jav
    a.lang.String,java.lang.String)' not found on class 'entity.XXXEntityBean_sgz73u_Impl'.
    what should I do to fix that ?
    Thanks for help.

    Hi
    It's working on WLS6.0 SP2 very well.
    Macsym
    PenFriend <[email protected]> wrote:
    Macsym,
    this isa known issue Cr06867. As a workaround chamge the name of the
    methods to not start with
    a find.
    macsym wrote:
    I've tried to re-run it. In my
    classpath=.;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;
    but the problem still here. I'v just changed examples under WLS totest it.
    BTW I using WLS6.1 SP1.
    Thanks any way.
    Macsym
    Rob Woollen <rob@trebor_nelloow.moc> wrote:
    It looks like you need to re-run weblogic.ejbc. Also make sure that
    your classes are only
    in the ejb-jar file and not the server's classpath.
    Finally, what version of WLS are you using? It shouldn't be throwing
    an AssertionError for
    this.
    -- Rob
    macsym wrote:
    Hi
    I met a very funny problem. when I try to deploy a entity BMP.(compilewas ok).
    The bean have a method called findSubElements(this is not a findermethod). I
    got the a exception:
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ ejbFindXXXmethod
    for 'findSubElements(java.lang.String,jav
    a.lang.String,java.lang.String)' not found on class 'entity.XXXEntityBean_sgz73u_Impl'.
    what should I do to fix that ?
    Thanks for help.

  • Edit method problem???

    Hi,forgive for all the code but i've asked this question before and people asked for more code.The problem is i get an error in publicationmain saying "undefined varible newpublication" so how do i fix this?and is my edit method goin to work?using the get and set method?can u show me how do do this please?feel free to make any other changes.thanxs a reply would be most heplful
    public class publication
    public int PublicationID;
    public String publicationname;
    public String publisher;
    public String PricePerIssue;
    public String pubstatus;
    public String publicationtype;
    public publication(int NewPublicationID, String Newpublicationname, String Newpublisher, String NewPricePerIssue, String Newpubstatus, String Newpublicationtype)
    PublicationID = NewPublicationID;
    publicationname = Newpublicationname;
    publisher = Newpublisher;
    PricePerIssue = NewPricePerIssue;
    pubstatus = Newpubstatus;
    publicationtype = Newpublicationtype;
    public String toString ()
    String pubreport = "---------------------------Publication-Information-----------------------------";
    pubreport += "Publication ID:" PublicationID"/n";
    pubreport += " Publication Title:" publicationname"/n";
    pubreport += " publisher: " publisher"/n";
    pubreport += " price Per Issue: " PricePerIssue"/n";
    pubreport += " publication Status: " pubstatus"/n";
    pubreport += " publication Type: " publicationtype"/n";
    return pubreport;
    public void SetPublicationID(int PubID)
    PublicationID = PubID;
    public int GetPublicationID()
    return PublicationID;
    public void Setpublicationname(String pubname)
    publicationname = pubname;
    public String Getpublicationname()
    return publicationname;
    public void Setpublisher(String Pub)
    publisher = Pub;
    public String Getpublisher()
    return publisher;
    public void SetPricePerIssue(String PPI)
    PricePerIssue = PPI;
    public String GetPricePerIssue()
    return PricePerIssue;
    public void Setpubstatus(String Status)
    pubstatus = Status;
    public String Getpubstatus()
    return pubstatus;
    public void Setpublicationtype(String Pubtype)
    publicationtype = Pubtype;
    public String Getpublicationtype()
    return publicationtype;
    import java.util.*;
    import publication;
    public class PublicationContainer
    LinkedList PubList;
    public PublicationContainer()
    PubList = new LinkedList();
    public int add (publication newpublication)
    PubList.addLast(newpublication);
    return PubList.size();
    private class PubNode
    public publication pubrecord;
    public PubNode next;
    public PubNode (publication thepublicationrecord)
    publication p = thepublicationrecord;
    next = null;
    public String toString()
    return PubList.toString();
    public void remove(int PubID)
    PubList.remove(PubID);
    public publication get(int PubID)
    return (publication)PubList.get(PubID);
    public void set(int PubID,publication newpublication)
    PubList.set(PubID, newpublication);
    import cs1.Keyboard;
    import publication;
    import java.util.*;
    public class publicationmain
    public static void main(String args[])
    PublicationContainer pubdatabase = new PublicationContainer();
    int userchoice;
    boolean flag = false;
    while (flag == false)
    System.out.println("------------------------------------Publications--------------------------------");
    System.out.println();
    System.out.println("please Make a Selection");
    System.out.println();
    System.out.println("1 to add publication");
    System.out.println("2 to delete publication");
    System.out.println("0 to quit");
    System.out.println("3 to View all publications");
    System.out.println("4 to Edit a publication");
    System.out.println("5 to select view of publication");
    System.out.println("6 to produce daily summary");
    System.out.println();
    userchoice = Keyboard.readInt();
    switch (userchoice)     
    case 1:
    String PubName;
    String PricePerIssue;
    String Publisher;
    String Pubstatus;
    String Pubtype;
    int PubID;
    System.out.println ("Enter Publication ID:");
    PubID = Keyboard.readInt();
    System.out.println("Enter Publication Name:");
    PubName = Keyboard.readString();
    System.out.println("Enter Publisher Name");
    Publisher = Keyboard.readString();
    System.out.println("Enter Price per Issue:");
    PricePerIssue = Keyboard.readString();
    System.out.println("Enter Publication status");
    Pubstatus = Keyboard.readString();
    System.out.println("Enter Publication type:");
    Pubtype = Keyboard.readString();
    pubdatabase.add (new publication(PubID, PubName, Publisher, PricePerIssue, Pubstatus, Pubtype));
    break;
    case 0:
    flag = true;
    case 2:
    System.out.println ("Enter Publication ID:");
    PubID = Keyboard.readInt();
    pubdatabase.remove (PubID);
    System.out.println ("publication: "+(PubID)+" removed");
    System.out.println();
    break;
    case 3:
    System.out.println (pubdatabase);
    break;
    case 4:
    System.out.println ("Enter Publication to be edited by Publication ID: ");
    PubID = Keyboard.readInt();
    pubdatabase.get(PubID);
    pubdatabase.set(PubID, newpublication);
    default:
    System.out.println("Incorrect Entry");
    }

    Whoops! Anyone spot the mistake?
    I (blush) forgot to re-instate the serial key for the publications after reading them in from disk.
    Works now ;)
    import javax.swing.JComponent;
    import javax.swing.JList;
    import javax.swing.DefaultListModel;
    import javax.swing.JPanel;
    import javax.swing.JOptionPane;
    import javax.swing.JButton;
    import javax.swing.JScrollPane;
    import javax.swing.JLabel;
    import javax.swing.JComboBox;
    import javax.swing.JTextField;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.Dimension;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.Serializable;
    class Publication
         implements Serializable
         private static final String sFileName= "Publications.ser";
         public static final byte UNKNOWN=     0;
         public static final byte HARDBACK=    1;
         public static final byte PAPERBACK=   2;
         public static final byte AUDIO=       3;
         public static final byte BRAIL=       4;
         public static final byte LARGE_PRINT= 5;
         public static final byte INSTOCK=      1;
         public static final byte BACK_ORDER=   2;
         public static final byte OUT_OF_PRINT= 3;
         private static final String[] sTypeNames=
              { "Unknown", "Hardback", "Paperback", "Audio", "Brail", "Large Print" };
         private static final String[] sStatusNames=
              { "Unknown", "In Stock", "Back Order", "Out of Print" };
         private int mId;
         private String mTitle;
         private String mAuthor;
         private String mPublisher;
         private float mPrice;
         private byte mStatus;
         private byte mType;
         private static Object sIdLock= new Object();
         static int sId;
         public Publication(
              String title, String author, String publisher,
              float price, byte status, byte type)
              setTitle(title);
              setPublisher(publisher);
              setAuthor(author);
              setPrice(price);
              setStatus(status);
              setType(type);
              synchronized (sIdLock) {
                   mId= ++sId;
         public int getId() { return mId; }
         public void setTitle(String title) { mTitle= title; }
         public String getTitle() { return mTitle; }
         public void setAuthor(String author) { mAuthor= author; }
         public String getAuthor() { return mAuthor; }
         public void setPublisher(String publisher) { mPublisher= publisher; }
         public String getPublisher() { return mPublisher; }
         public void setPrice(float price) { mPrice= price; }
         public float getPrice() { return mPrice; }
         public void setStatus(byte status)
              if (status >= INSTOCK && status <= OUT_OF_PRINT)
                   mStatus= status;
              else
                   mStatus= UNKNOWN;
         public byte getStatus() { return mStatus; }
         public String getStatusName() { return sStatusNames[mStatus]; }
         public void setType(byte type)
              if (type >= HARDBACK && type <= LARGE_PRINT)
                   mType= type;
              else
                   mType= UNKNOWN;
         public byte getType() { return mType; }
         public String getTypeName() { return sTypeNames[mType]; }
         public String toString ()
              return
                   " id= " +getId() +
                   ", title= " +getTitle() +
                   ", author= " +getAuthor() +
                   ", publisher= " +getPublisher() +
                   ", price= " +getPrice() +
                   ", status= " +getStatus() +
                   " (" +getStatusName() +")" +
                   ", type= " +getType() +
                   " (" +getTypeName() +")";
         private static void addPublication(DefaultListModel listModel) {
              editPublication(listModel, null);
         private static void editPublication(
              DefaultListModel listModel, Publication publication)
              JPanel panel= new JPanel(new BorderLayout());
              JPanel titlePanel= new JPanel(new GridLayout(0,1));
              JPanel fieldPanel= new JPanel(new GridLayout(0,1));
              JTextField fTitle= new JTextField(20);
              JTextField fAuthor= new JTextField();
              JTextField fPublisher= new JTextField();
              JTextField fPrice= new JTextField();
              JComboBox cbStatus= new JComboBox(sStatusNames);
              JComboBox cbType= new JComboBox(sTypeNames);
              fieldPanel.add(fTitle);
              fieldPanel.add(fAuthor);
              fieldPanel.add(fPublisher);
              fieldPanel.add(fPrice);
              fieldPanel.add(cbStatus);
              fieldPanel.add(cbType);
              titlePanel.add(new JLabel("Title:"));
              titlePanel.add(new JLabel("Author:"));
              titlePanel.add(new JLabel("Publisher: "));
              titlePanel.add(new JLabel("Price:"));
              titlePanel.add(new JLabel("Status:"));
              titlePanel.add(new JLabel("Type:"));
              panel.add(titlePanel, BorderLayout.WEST);
              panel.add(fieldPanel, BorderLayout.EAST);
              if (publication != null) {
                   fTitle.setText(publication.getTitle());
                   fTitle.setEditable(false);
                   fAuthor.setText(publication.getAuthor());
                   fPublisher.setText(publication.getPublisher());
                   fPrice.setText("" +publication.getPrice());
                   cbStatus.setSelectedIndex((int) publication.getStatus());
                   cbType.setSelectedIndex((int) publication.getType());
              int option= JOptionPane.showOptionDialog(
                   null, panel, "New Publication",
                   JOptionPane.OK_CANCEL_OPTION,
                   JOptionPane.PLAIN_MESSAGE,
                   null, null, null
              if (option != JOptionPane.OK_OPTION)
                   return;
              String title=
                   fTitle.getText().length() < 1 ? "Unknown" : fTitle.getText();
              String author=
                   fAuthor.getText().length() < 1 ? "Unknown" : fAuthor.getText();
              String publisher=
                   fPublisher.getText().length() < 1 ? "Unknown" : fPublisher.getText();
              float price= 0.0f;
              try { price= Float.parseFloat(fPrice.getText()); }
              catch (NumberFormatException nfe) { }
              byte status= (byte) cbStatus.getSelectedIndex();
              byte type= (byte) cbType.getSelectedIndex();
              if (publication != null) {
                   publication.setAuthor(author);
                   publication.setPublisher(publisher);
                   publication.setPrice(price);
                   publication.setStatus(status);
                   publication.setType(type);
              else {
                   listModel.addElement(
                        new Publication(title, author, publisher, price, status, type));
         private static void deletePublications(JList list, DefaultListModel listModel)
              if (list.getSelectedIndex() >= 0) {
                   Object[] values= list.getSelectedValues();
                   for (int i= 0; i< values.length; i++)
                        listModel.removeElement(values);
         private static DefaultListModel getListModel()
              DefaultListModel listModel;
              try {
                   ObjectInputStream is=
                        new ObjectInputStream(new FileInputStream(sFileName));
                   listModel= (DefaultListModel) is.readObject();
                   is.close();
                   if (listModel.getSize() > 0) {
                        Publication.sId=
                             ((Publication)
                                  listModel.get(listModel.getSize() -1)).getId();
              catch (Exception e) {
                   JOptionPane.showMessageDialog(
                        null, "Could not find saved Publications, creating new list.",
                        "Error", JOptionPane.ERROR_MESSAGE);
                   listModel= new DefaultListModel();
                   // add a known book to the list (I'm pretty sure this one exists ;)
                   listModel.addElement(
                        new Publication("The Bible", "Various", "God", 12.95f,
                             Publication.INSTOCK, Publication.HARDBACK));
              // add a shutdown hook to save the list model to disk when we exit
              final DefaultListModel model= listModel;
              Runtime.getRuntime().addShutdownHook(new Thread() {
                   public void run() {
                        saveListModel(model);
              return listModel;
         private static void saveListModel(DefaultListModel listModel)
              try {
                   ObjectOutputStream os=
                        new ObjectOutputStream(new FileOutputStream(sFileName));
                   os.writeObject(listModel);
                   os.close();
              catch (IOException ioe) {
                   System.err.println("Failed to save Publications!");
                   ioe.printStackTrace();
         public static void main(String args[])
              // store all the publications in a list model which drives the JList
              // the user will see - we save it on exit, so see if there's one on disk.
              final DefaultListModel listModel= getListModel();
              final JList list= new JList(listModel);
              // two panels, the main one for the dialog and one for buttons
              JPanel panel= new JPanel(new BorderLayout());
              JPanel btnPanel= new JPanel(new GridLayout(1,0));
              // an add button, when pressed brings up a dialog where the user can
              // enter details of a new publication
              JButton btnAdd= new JButton("Add");
              btnAdd.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        addPublication(listModel);
              btnPanel.add(btnAdd);
              // a delete button, when pressed it will delete all the selected list
              // items (if any) and then disable itself
              final JButton btnDelete= new JButton("Delete");
              btnDelete.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        deletePublications(list, listModel);
              btnDelete.setEnabled(false);
              btnPanel.add(btnDelete);
              // hook into the list selection model so we can de-activate the delete
              // button if no list items are selected.
              list.getSelectionModel().addListSelectionListener(
                   new ListSelectionListener() {
                        public void valueChanged(ListSelectionEvent e) {
                             if (list.getSelectedIndices().length > 0)
                                  btnDelete.setEnabled(true);
                             else
                                  btnDelete.setEnabled(false);
              // Watch out for double clicks in the list and edit the document
              // selected
              list.addMouseListener(new MouseListener() {
                   public void mouseClicked(MouseEvent e) {
                        if (e.getClickCount() == 2) {
                             editPublication(
                                  listModel, (Publication) list.getSelectedValue());
                   public void mousePressed(MouseEvent e) { }
                   public void mouseReleased(MouseEvent e) { }
                   public void mouseEntered(MouseEvent e) { }
                   public void mouseExited(MouseEvent e) { }
              // Now keep an eye out for the user hitting return (will edit the selected
              // publication) or delete (will delete it)
              // Note: we have do the ugly "pressed" flag because JOptionPane closes
              // on keyPressed and we end up getting keyReleased. Can't use keyTypes
              // because it does not contain the virtual key code 8(
              list.addKeyListener(new KeyListener() {
                   boolean pressed= false;
                   public void keyTyped(KeyEvent e) { }
                   public void keyPressed(KeyEvent e) {
                        pressed= true;
                   public void keyReleased(KeyEvent e) {
                        if (pressed && e.getKeyCode() == e.VK_ENTER) {
                             editPublication(
                                  listModel, (Publication) list.getSelectedValue());
                        else if (pressed && e.getKeyCode() == e.VK_DELETE)
                             deletePublications(list, listModel);
                        pressed= false;
              // Put the list in a scroll pane so we can see it all. Make it resonably
              // wide so we don't have top scroll horizonatly to see most publications
              JScrollPane listScrollPane= new JScrollPane(list);
              listScrollPane.setPreferredSize(new Dimension(640, 300));
              // layout the list and button panel
              panel.add(listScrollPane, BorderLayout.CENTER);
              panel.add(btnPanel, BorderLayout.SOUTH);
              // ok, ready to rumble, lets show the user what we've got
              JOptionPane.showOptionDialog(
                   null, panel, "Publications",
                   JOptionPane.DEFAULT_OPTION,
                   JOptionPane.PLAIN_MESSAGE,
                   null, new String[0], null
              // leg it
              System.exit(0);

  • Urgent!!! select methods problem!!!

    hi,all
    dose anybody have encounter such problem : if the xml nodes have prefix that the select methods can not work as well, the select result is null,but the xml nodes do not have prefix that the result will be right.
    i use the oracle xdk10.0 ,and parse is DOMParse.
    if the xdk do not support prefix ???
    i don't believe it.
    appreciate for your answers!!!!

    If the xml elements are not in a namespace (do not have a prefix) the select methods retrieve the element values.
    http://www.oracle.com/technology/pub/notes/technote_domparser.html
    If the elements are in a namespace (have a prefix) use a NSResolver with select methods.

  • Add a Data Action to Execute a Method - Problem

    Hi,
    I'm working with JDeveloper 10.1.3 - JSP,Struts and ADF BC.
    I have a method that retruns 2 values (audit(Number,Number)) and exposed the Service Metod, but now I need to add a Data Action to Execute that method.
    I already add an Data Action icon to my Page Flow Diagram but what do I need to do next?
    Can anyone help me? Any ideias?
    Thanks,
    Micaela

    Hi Shay,
    I have one problem because how can I create a JSP Page to display Method Results in JDeveloper10.1.3???
    I already created another page and tried to Drag and Drop my Method from Data Control Palette, but I only have the choice to create a button and I would like to see the result.
    Adding a c:out tag to the JSP page.
    Can you help me with this problem??
    Thanks,
    Micaela

Maybe you are looking for