Adding the same Vector object into a JTable acts weird

I'm using a JTable with a DefaultTableModel as the model. When I try to add rows in a loop using the same Vector object (clearing it out beforehand), the result is that every row in the table is identical to the last one. Is that because the DefaultTableModel stores a reference to my Vector object for each row? And by clearing and changing the vector this effectively changes very row in the table? That's the only rationale I can come up with...
Here's the loop...
Iterator itr = directorySet.iterator();
Vector rowVector = new Vector(getColumnCount());
while (itr.hasNext()) {
File file = (File) itr.next();
rowVector.clear()
rowVector.add(file.getName());
rowVector.add("<Directory>");
rowVector.add("");
addRow(rowVector);
Any comments appreciated. Thanks,
-nick

By having a single vector object and making your all your rows refer to that would only populate all the rows with the latest data the vector has. This is the right behaviour, since all you rows effectively have a reference to your single vector object. To avoid this, do something like this....
Iterator itr = directorySet.iterator();
Vector rowVector = new Vector(getColumnCount());
while (itr.hasNext()) {
File file = (File) itr.next();
//Instead of clearing your rowVector here, allocate a new vector object to your rowVector reference.
//This would solve your problem effectively.
rowVector = new Vector(getColumnCount());
//rowVector.clear()
rowVector.add(file.getName());
rowVector.add("<Directory>");
rowVector.add("");
addRow(rowVector);
}

Similar Messages

  • BAM Combo Chart showing data in 2 graphics for the same data object

    Hi all,
    I’m trying to show 2 views of the same data object in a Combo Chart (e.g. orders created today as a bar chart and orders created yesterday as line chart grouping by hour of day). It was pretty easy adding the same data object twice but the data type of the horizontal axis seems to be lost and it gets sorted as a simple string, leading to strange grouping of the hours with 05:00 representing 5 AM sided with 05:00 representing 5 PM. Also, I’m not able to format such fields using the format values tab.
    Is using the same data object two times in the same report an unsupported scenario?
    Thanks,
    Daniel

    why you want to add the same data object twice? Your use case can be achieved with single data object only.
    1) Create combo chart and select the data object.
    2) On "Choose data fields" page group by datetime field.
    3) You will see UI changed to 3 sections - left one with "Group by" section, middle with "Chart values" and right one with "Time Groups".
    4) In the right "Time Group" section, uncheck checkbox for continuous time series. Time Unit as hour, quantity as 1.
    5) In middle "Chart values" section ,select the fields that you want to display as chart values and respective chart types , in your case orders created today as a bar chart and orders created yesterday as line chart.
    5) Click Next and Finish.
    6) Then you can go to Value format tab, and change the format for the datetime field as timeunit and required format.

  • Adding an Array of Objects into an external Web-Service

    Hi all,
    I want to populate an Array of Objects into an external Web-Service which I have introspected into BPM. But I am finding it difficult to do so which should be very easy I guess.
    When i use the EXTEND keyword for adding the array of objects, it gives me the following parameters which are not required:-
    testArray.records.extend(name : "", attributes : null, value : "", children : {  }, tagName : "", namespace : "", isNil : false);
    I only need to populate the name and value pairs and do not need to populate others. But there is no way for me to do this.. How do I populate other parameters or skip them especially
    children which is a Fuego.Xml.XMLObject[].. How do I populate that? How do I populate attributes which is an associative array and not required..
    Is there a proper documentation of consuming external Web-Services into BPM?

    Very interesting, I am going to have to really break this down and see if I can make sense out of it with my 300 lines of code LOL.
    I think this may jsut work at first glance and will let you know!
    It works. We all use it all of the time. The old Add-Member was a big pain in the neck.  InPowerShell V2 New-Object -Property ws added to take a hash of name/value pairs and convert them into an object in one step.  It is faster and more reliable.
    $myprops=@{
        Name='joe'
        Birthdate=[datetime]'02-12-1965'
        Weight=[int]130
        Married=$false
        Flags=[byte]0x3F
    # we can change a value on the fly
    $myprops.Weight+=5  # adjust weight for liars
    New-Object PsObject -Property $myprops
    OR get name=value pairs from a file and make into an object
    $fileprops=Get-Content mydata.txt | ConvertFrom-StringData
    New-Object PsObject -Property $fileProps
    There are more than a dozen other variations of how to levcerage this to create objects out of other things like results from old DOS commands.
    ¯\_(ツ)_/¯

  • ADF table and ADF form on the same view object

    Hi,
    As per the ADF demos available on ADF site, I created a jsf page with 2 panels. One panel is an ADF table based on a view object. And the other panel is and ADF form based on the same view object. My requirement is that as I scroll through the records in the ADF table, the ADF Form should dynamically display the details of the record in the ADF table. My understanding is that this should be automatic. However, its not working as expected. What have I missed?

    Hi,
    Apply PPR for form that displays details.
    Like :
    <af:table id="t3">
    </af:table>
    <af:panelFormLayout id="pfl2" partialTriggers="t3">
    </af:panelFormLayout >

  • Can two frames use the same SessionInfo object?

    Hi,
    I have some questions on using InfoBus Frame.
    Do parent frame and child frame HAVE TO make use the same
    SessionInfo object?
    I tried to show Master table and Detailed table in seperate
    frame without login twice. I am lucky it works since I happened
    to make two frames have the same SessionInfo object which is
    sessionInfo1 and conmment out sessionInfo1.publishSession()in
    Detailed frame.
    But when I tried to pass Master frame SessionInfo object to
    Detailed frame there is nothing showing up in the detailed frame
    it is just blank frame.
    So two frames have to use the same SessionInfo object . Dose it
    make sense?
    I would really appreciate anyone who can enlighten me on this
    subject.
    Thanks you so much for the attention.
    Julie Chi
    null

    Gopal (guest) wrote:
    : HI,
    : Julie Chi (guest) wrote:
    : : So two frames have to use the same SessionInfo object . Dose
    it
    : : make sense?
    : Yes, if you are working with a master details relation, data
    for
    : both need to be fetched from the same oracle session. So both
    ur
    : frames need to refer the same session. If u refer the detail
    : frame to a different session, u will not see any data, because
    : the information comes from a different oracle session which is
    : not aware of the master data that is fetched. I think it is
    : clear.
    : regards,
    : --Gopal
    1.Use wizard and test the frame
    2.pass the sessioninfo object in parent to child(put method in
    child, call from parent e.g ..getsessionInfo(SessionInfo ss)
    3.pass the sessioninfo object to rowsetinfo in child
    4.add Database authentication (username/password is sufficient)
    methods right before publish method
    *publish activates RowSetInfo and connects to db
    5.add methods in parent to call child
    That should work though depending on how you have set up your
    wizard generated java form, might tweak
    Thanks
    iggy de iguana
    null

  • [solved] inserting the same rows again into that table

    i have a table with some rows now i want to insert the same rows again into that table
    please tell me how to do it?
    not using export please only sql query please
    Message was edited by:
    littlemaster

    i m expecting that u commented on me (may be i m wrong). Only once, which we had already dealt with further up. My comment was continuing along another 'off topic' re: code graffitti. Sorry I you felt I was continuing to get at you.
    (If you look at the 'In Response to' part of ant post you can see which post any p[ost is intended to reply to)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Null and empty string not being the same in object?

    Hello,
    I know that null and empty string are interpreted the same in oracle.
    However I discovered the strange behaviour concerning user defined objects:
    create or replace
    TYPE object AS OBJECT (
    value VARCHAR2(2000)
    declare
    xml xmltype;
    obj object;
    begin
    obj := object('abcd');
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    obj.value := '';
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    obj.value := null;
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    end;
    When creating xml from object, all not-null fields are transformed into xml tag.
    I supposed that obj.value being either '' or null will lead to the same result.
    However this is output from Oracle 9i:
    <OBJECT_ID><VALUE>abcd</VALUE></OBJECT_ID>
    <OBJECT_ID><VALUE></VALUE></OBJECT_ID>
    <OBJECT_ID/>
    Oracle 10g behaves as expected:
    <OBJECT><VALUE>abcd</VALUE></OBJECT>
    <OBJECT/>
    <OBJECT/>
    However Oracle 9i behaviour leads me to the conclusion that oracle
    must somehow distinguish between empty string and null in user defined objects...
    Can someone clarify this behaviour?
    Thus is it possible to test if object's field is empty or null?

    However Oracle 9i behaviour leads me to the conclusion that oracle
    must somehow distinguish between empty string and null in user defined objects...
    Can someone clarify this behaviour?
    Thus is it possible to test if object's field is empty or null?A lot of "fixes" were done, relating to XML in 10g and the XML functionality of 9i was known to be buggy.
    I think you can safely assume that null and empty strings are treated the same by Oracle regardless. If you're using anything less than 10g, it's not supported any more anyway, so upgrade. Don't rely on any assumptions that may appear due to bugs.

  • Instead of creating new resource, recon is updating the same resource object for a user

    Hi,
    I created a DB target recon in OIM 11g. I ran recon and it created resource object. Resource is visible in Accounts tab.Now, I added one more entry with different description in DB. I ran the recon again. This time, instead of creating new resource object, recon linked it the same user with same resource object.
    My requirement is to create as many resource object as there are entries in DB table. The recon should not link all DB entries with same resource object in IDM. For every entry in DB, recon should create that many resource objects in accounts tab of user.
    Please let me know how to achieve the same.
    Regards,
    Kalpana.

    Hint is : Verify Reconciliation Key field mapping in Process definition
    Thanks,
    Pallavi

  • Interfaces of different SCVs are always assigned to the same proxy object

    Hi,
    for clean versioning and maintenance of development branches we use different versions of a software component in the ESR. It looks like this:
    SC_NAME 1.1 of namespace.com
    +- http://namespace.com/project/a
       +- Service Interfaces
          +- Interface1
          +- Interface2
          +- Interface3
    SC_NAME 1.2 of namespace.com
    +- http://namespace.com/project/a
       +- Service Interfaces
          +- Interface1
          +- Interface2
          +- Interface3
    SC_NAME 1.3 of namespace.com
    +- http://namespace.com/project/a
       +- Service Interfaces
          +- Interface1
          +- Interface2
          +- Interface3
    Here is the problem:
    Service interfaces are assigned to proxy objects by using the key type/name/namespace of the repository object (refer SAP note [886682|https://service.sap.com/sap/support/notes/886682]). That means that the software component version of the repository objects is ignored when generating ABAP proxy objects.
    Since in our case (see above) all service interfaces have the same type/name/namespace combination, all services interfaces get assigned automatically to the same ABAP proxy object. That makes it impossible to maintain different versions of ABAP proxies for the corresponding service interfaces!
    As a workaround we only have two opportunities:
    Either we add the version number of the SCV to the namespace (e.g. http://namespace.com/project/a/v1, http://namespace.com/project/a/v2, ...) or we add the version number to the interface name (e.g. Interface1_v1, Interface1_v2, ...) in order to distinguish the service interfaces for the proxy generation.
    Both solutions are very ugly in my opinion, since they make our clean versioning with SAP's software component model useless.
    Are these solutions the only way to seperate the generated ABAP proxies for each version of a SVC? If yes, then I can hardly believe, that nobody else in the SDN ever mentioned this - in my opinion - huge flaw in the ABAP proxy generation.
    Please correct me, if I missed something.
    Regards,
    Adam
    Edited by: Adam Sosnowski on Dec 3, 2009 11:25 AM

    Hi Stefan,
    thank you for the quick response. It really looks like a bug, since it undermines the versioning with the software component model.
    Inside an SAP system, there is only one valid SWCV. So when you decide to use version 1.1 for one system, you cannot use 1.2 for the same system.
    I don't exactly know, what you mean with "inside an SAP system". We connect different versions of a client application to different versions of service applications. Newer version may contain an enhanced data model (new fields in the messages, etc.). For that reason, we split the development into branches using different SWCVs in order to handle e.g. change requests for older versions seperately. This approach is a common pattern and it is also the purpose of using software component versions.
    Regards,
    Adam

  • Load another sound in the same sound object

    Hi,
    I am loading a sound like this:
    public var smallSound:Sound = new Sound();
    public var trans1:SoundTransform = new SoundTransform(1, 0);
    public var channel:SoundChannel = new SoundChannel();
    smallSound.load(new URLRequest("firsttrack.mp3"));
    channel=smallSound.play(0,1,trans1);
    When an event occurs (button click actually) I would like to stop playing the first sound and playing another sound in the same object. So I try doing this:
    smallSound.load(new URLRequest("secondtrack.mp3"));
    channel=smallSound.play(0,1,trans1);
    but it does not work. The first sound keeps playing. I havent understood something probably.. Can someone help me ??

    ok, i solved my problem. It works like:
    channel.stop();
    smallSound = new Sound;
    smallSound.load(new URLRequest("secondtrack.mp3"));
    channel = new SoundChannel;
    channel=smallSound.play(0,1,trans1);

  • Can you have the same smart object in two files?

    The situation:
    I have a 'base' file A, with two (different) smart objects B and C. Now I want B and C to both contain a third smart object D, and I can't get that to work.
    I can place the same file as a smart object in B and C, but it becomes two different smart objects, which are seperately editable. I would like to be able to edit smart object D and the changes to be visible in both B and C and in turn in A.
    Is this at all possible?
    and please, I'm not looking for workarounds. I have plenty of those, but it would save me a lot of time time if this were possible.
    thanks
    btw working in photoshop CS5

    @PECourtejoie
    That's exactly what I need,
    but,
    some technical issues prevent it from working in Windows Vista or Windows 7
    , I'm on win7
    @c.pfaffenbichler
    That's no problem. just 2 times a ctrl-s. Takes no time at all

  • How to get the window.opener object into a model window

    Hi,
    I m opening a new popup window with the help of window.showModalDialog(url,self,''). Now i want to access the opner window inside this popup window. Since this showModalDialog does not support window.opener so i passed 'self' as parameter and if i want to access the parent window i can access it with the help of window.dialogArguments . But the problem is window.dialogArguments is not an object .
    for e.g.
    var caller = window.opener
    then caller can be used as object but if i do like this
    var caller = window.dialogArguments
    then i can't use caller as an object.
    Can anybody tell me the correct way.
    manish

    Hi Manish,
    I'm trying to use as well showModalDialog in IE and in the same time have a similar experience in other browsers (like Firefox) - similar to the Hotmail Empty Junk mail button, so here is a piece of code you might be interested in:
      Caller page
      // showModalDialog for Non-IE browsers
      if (!window.showModalDialog) {
        window.showModalDialog = function(sUrl, vArguments, sFeatures) {
          var wFeatures   = sFeatures.replace(/dialog/gi,"").replace(/:/gi,"=").replace(/;/gi,",");  // plus a little more replacement
          var modalWindow = window.open (sUrl, "_blank", wFeatures);
          modalWindow.setFocusToWindow = function () {
            modalWindow.focus();
          modalWindow.setInterval ("setFocusToWindow()", 100);
      // Show modal dialog...
      window.showModalDialog ("modal_dialog.html", self, "dialogHeight: 300px; dialogWidth: 400px; center: yes; help: no; status: no")
      modal_dialog.html
      // IE only - other browsers will be fine
      if (window.dialogArguments) {
        window.opener = window.dialogArguments;
      // Write something back in the opener window
      window.opener.document.write ("here you go...");

  • Copying queries between multicubes without having the same info objects

    Hello all,
    I have heard that it should be possible to use the debugger in order to copy a report between two multiproviders without having the exact same info objects in both multiproviders. All the info objects in the report are off course available in both multiproviders.
    Could anyone explain to me how this should be done?
    Best regards,
    Fredrik

    Hi Fredrik.
    Take a look at this thread:
    https://forums.sdn.sap.com/click.jspa?searchID=224199&messageID=1193434
    Hope it helps.
    BR
    Stefan

  • How will I be able to make the TestStand UI objects into XP theme?

    Hi, I am using TestStand UI in .net, How will I be able to make the UI objecys of TestStand to adapt the XP theme?
    Is there any example code that you can give me? Thanks!
    Solved!
    Go to Solution.

    The shipped TestStand  .NET Operator Interface  has a manifest file included in the project. This manifest file includes the Micrsoft.Windows.Common-Controls which is needed to identify the XP theme that has been configured on the operating system. In the shipped .NET Operator interface, this .manifest file is being embedded into the executable and formats the TestStand Operator Interface to display the XP theme that has been configured on the operating system. in the shipped TestStand 4.1.1 Operator Interface, the manifest file is embedded into the executable in a Project post-build event.
    There are three things that the manifest file is required to have in order to allow the TestStand Operator Interface executable to adapt to the XP theme. They are as follows:
    The manifest file must have the same name as the executable. For example, if your executable is named MyExecutable.exe, your manifest file is required to have the name MyExecutable.exe.manifest.
    The manifest file must include the Micrsoft.Windows.Common-Controls in order to identify the XP theme that has been configured on the operating system.
    The manifest file must reside in the same directory as the executable.
    If you are building on an existing Operator interface that ships with TestStand 4.1.1, make sure that the manifest file meets these two requirements. If it does you can test that the theme is properly adapting by selecting Debug»Start Without Debugging.
    If this works properly, you can rest assured that when building a release version of the TestStand Operator Interface, it will adapt to the XP theme that has been configured on the operating system.
    NOTE:  that you can only test this feature if you launch the executable without debugging because this allows the executable to run its own process. If you run the executable with debugging, the Visual Studio environment will host the process and will not allow the manifest file to be embedded into the executable.
    -Adri
    Message Edited by Adri K. on 03-04-2009 04:15 PM
    Adri Kruger
    National Instruments
    LabVIEW Product Marketing
    Attachments:
    matching names.jpg ‏27 KB
    debug.jpg ‏20 KB
    manifest.jpg ‏65 KB

  • Combine multiple web services with the same SQL query into one

    Hello,
    I would like to ask a question regarding combine multiple similar web services into one. Can you please tell me if it is possible to combine 4-5 web services into one since they built on the same SQL query with 5 different criterias or condition so that the user can enter any of the 5 criterias to populate the data on the form instead of having 5 different web services?
    e.g Query: Select appName, permit#, address, phone, description, type, section, from table where appName = can be 'appName, permit#, address, phone, or description' to populate the rest of the data to the form.
    Does any one have ever done some thing like this in Workbench ES? If so please assist. I know it can be easier to build it in Visual Basic, C#, or dot.net but the requirement is to build it in workbench ES.
    Thanks in advance,
    Han Dao

    If you are querying for Name, PhoneNumber, and SSN, and you queried for all people with a phone number that started with 867, you would have a potentially long list of people.  So to keep track of all of the people, we store each record in XML complex elements.  The root node is just any name you want, and the repeating element is the complex element name. 
    So using the example from above, I'm going to specify the following:
         Root Node: Result
         Repeating Element: Person
    So now when I do a query, my resultXML will look like:
    <Result>
          <Person>
                 <Name>Alex</Name>
                 <PhoneNumber>867-5309</PhoneNumber>
                 <SSN>111-11-1111</SSN>
          </Person>
    </Result>
    If your query returned multiple results (like ours would probably), it would look like:
    <Result>
          <Person>
                 <Name>Alex</Name>
                 <PhoneNumber>867-5309</PhoneNumber>
                 <SSN>111-11-1111</SSN>
          </Person>
          <Person>
                 <Name>Han</Name>
                 <PhoneNumber>867-2169</PhoneNumber>
                 <SSN>222-22-2222</SSN>
          </Person>
    </Result>
    So Result and Person is just to give a little bit of structure to the xml result (containers really).  So you can name them whatever is helpful for you.
    The column name mappings map the query columns (Name, PhoneNumber, SSN) to some node in the XML (Name, PhoneNumber, SSN).  So you don't need to specify which field maps to what in the form.  Just copy the column names to the element name so you have a 1-to-1 naming.  If you want to manipulate the XML a bit though, you could do:
    Column Name               Element
    Name                            YourName
    PhoneNumber                Phone
    SSN                              Secret
    which would then make your xml look like:
    <Result>
          <Person>
                 <YourName>Alex</YourName>
                 <Phone>867-5309</Phone>
                 <Secret>111-11-1111</Secret>
          </Person>
    </Result>
    It lets you change the XML element names to whatever you want. Otherwise by default they take on their column names.
    In your form, you could bind to the WSDL through the Data Connections pane and point it to your web service.  This will then create form elements that you can just drag and drop allowing you to have the information available when the service gets ran.  Once the service is called, you can modify the field's data to get whatever information you need in order to populate other form fields. 
    If that is too confusing, feel free to send me your form (e-mail is on profile page) and I'll add comments to it to show you how to set up the form for the web service call (and also give me the link to your webservice)

Maybe you are looking for