Need a pattern to update a table's contents

The goal here is to update a table's data when new data is imported into my application.
I was looking thru the Swing trail and see that the TabelModelListener is more appropriate for when the data in the table itself changes -- I cannot find a good trail to base my codes off of.
more details:
1. the import is fired off via a button press.
2. On that button defined a listener, in which I call a service that handles the import.
3. The import gathers data from a text file and updates a DB.
It seems to me that after the import, I would want to fire an event, for which the table (or tablemodel) is listening, so it can update itself. I can't find out how to do this. Help is appreciated.

I think I might be on the correct track.
1. I am using Factory pattern to serve out gui elements.
2. In that factory I have created a static Observable object.
3. I have created a subclass that implements observer. In the update method I can reset the tablemodel. In the factory I create and instance of my table class and register it on the Observable.
4. After I import some data, i simply call the appropriate method on observable, and my table should do its update.
I think this solution is pretty clean. If anybody has a better suggestion please let me know. I am always interested in writing the cleanest/most elegant code possible.

Similar Messages

  • What is the code for updating a table of content?

    I'm looking online and not finding a command list or something helpful. I'm also on a government computer so a bunch of sites are blocked for security or something. I am making a script that does a few things and one needs to be updating the TOC but I cant find the command.
    I wish this software had something simular to a program called MAYA has. "echo all commands" in the script editor so anything you do shows all code being exicuted.

    Theoretically, if you are using Adobe's own ESTK to write your scripts, all commands can be found in the Help menu. Then again, searching in there is needlessly made difficult (i.e., you have to know exactly what you are searching for before you can find it). So (modest cough) ... Adobe InDesign CS6 (8.0) Object Model JS: Table of Contents
    The command you are looking for is not in the "Table of Content Suite" since that only describes the format of the contents. It is a Document method: Adobe InDesign CS6 (8.0) Object Model JS: Document -- look for createTOC (this stupid editor doesn't show it but the link already points to the correct place -- perhaps this editor was written by "We Also Brought You The ESTK").
    Searching through the thousands of pages is easier if you download the CHM version and use a good CHM viewer. Check out
    http://www.jongware.com/idjshelp.html

  • How to update a table of contents when the feature "update table of contents" is unavailable?

    Hello folks,
    I've been struggling all morning with this issue and am completely desperate.
    First, some info:
    - I am making a spanish versions of an english documents: everything in the original doc was then edited, including TOCs. What I got at first, was a first spanish document already filled with spanish content.
    - I was not the primary creative of the document I'm workin on and am unable to get in touch with whoever that can be.
    - My document is a 200 pages text only document, with 12 chapters and, at the beginning of each chapter, a specific TOC for that very chapter.
    - Inside each chapter, there are only Sections and Subsections, no other style. Those are the two levels in the TOCs.
    - There is also a General TOC at the beginning of the document: that one only shows the Chapter names and the page number where to locate them.
    My problem:
    - Somewhere along the way, from one doc to another, the TOCs stopped to update the page numbers automatically.
    - Now I have sections and subsections that are shown in one page (for instance 204) but they actually are on page 135.
    - When I try to update the TOCs, I stand on the TOC itself as I was told in many tutorials, but the "update table of contents" feature is unavailable, even in the main TOC at the very beginning of the doc.
    It is like if I wasn't standing in the actual TOC, but there is no actual TOC anywhere that I could refer to.
    What can I do? I am changing the wrong page numbers manually but, of course, that is not ideal... and it may become more and more tricky while I keep producing new documents each based on the previous one.
    Any help will be much appreciated.
    Warm regard from sunny Paris, France!
    Sasha

    You've just confused me.
    My understanding of how this is set up is that either:
    This is a book, and there is a master TOC that includes all book documents and a document-specific TOC in each component file, or
    This is a single file and there is one master TOC that includes all sections and a section-specific TOC that includes only the individual section.
    In the first case, I think you would want two TOC styles set up, one that includes the chapter heads (if I understood how you said this worked) for the for the master, and you would include all docs in the book when you generate it, and a second style for the individual chapters, with the subheadings you want to include.
    In the second case, it would be similar, but instead of only one style to cover the section TOCS, I think you would need to create a unique set of pargraph styles for the headings in each section (they can all be the same format, based one section, just with unique names), and then make a TOC style for each section that includes only the styles from that section.
    OK,  wait a sec. I just reread what you said: "Another thing: when the numbers are "linked" and updating well, they  display indide a little box. Not a text box, but a kind of little frame  around the numbers. That frame makes it imposible to delete just one  number: when the TOC says that Section 6.1 is in page 135, for example,  you cannot delete just the 5, it deletes, not just the 3 numbers, but  also the doted tab."
    I think these are NOT normal TOCs created by using Layout > TOC (but you could replace them with ones that are, if you set up your styles properly and the text you want to include is appearing on the pages). Those little boxes you mention sound like cross-references, which should update automatically without any intervention at all. Unfortunately, cross-refs can be flakey, especially if they point to another document. I'd open the cross-refs panel and see if you need to recreate a bunch of links.

  • Why can't I update a table of contents in Windows InDesign CS 5.5?

    I have clicked in a table of contents frame, but on my layout menu, "udpate table of contents" is grayed out.
    I have "moved" my table of contents from an InDesign doc I created weeks ago into a new doc. I can update it in the old doc, but when it's copied into the new doc, the update option is no longer available.
    Why can't I updated it once it's in another doc so I can use its TOC styles & layouts rather than having to redefine those all over again?
    Thanks!

    Loading the TOC style gave me the fonts I wanted, but not the dots & the page numbers that were in the doc from which I loaded the styles.  My TOC has no page numbers now, but I do like the font.
    Is there a trick to getting the page number display with the dots to show up?

  • Need to delete or change default table of contents

    The default table of contents created when I imported a
    FrameMaker book is empty. I reimported the book (using a different
    option) and created a new TOC. I want to use this one in my
    project. Some questions:
    1. Can I change the default TOC to be the new (non-empty)
    one? If so, how? (Can you refer me to a topic in the RoboHelp
    Documentation?)
    2. Can I delete the default TOC? If so, how? (Can you refer
    me to a topic in the RoboHelp Documentation?)
    3. If the answers to the above questions is "no," can I just
    ignore the default (empty) one & use the new (nonempty) one
    when I generate? If so, how? (Can you refer me to a topic in the
    RoboHelp Documentation?)

    However, I thought that the blank TOC was created before I
    learned the "correct" way to import FrameMaker documents: by
    reference. So I can't say what would have happened if I had
    imported the book by reference initially. Nonetheless, I have the
    same result - a blank default TOC that I can't remove (as Peter
    points out).

  • Need MIGO BAdi to update custom table

    Hi Experts,
       I have to update a custom table after the GR is successful against PO in MIGO transaction.
    Which BADI will be suitable to this. Or is there any other way to do this?
    Thanks and regards,
    Venkat.N.

    Hi,
    You can use the badi MB_DOCUMENT_BADI and method MB_DOCUMENT_UPDATE.
    Regards,
    Nagaraj

  • Table of Contents vanishes when trying to update or regenerate in CS6

    I'm working with InDesign CS6 on Windows 7 Pro 64-bit
    This is an old, legacy document. Today, I needed to remove two pages, so of course, I need to update my table of contents and index. I had no problems with the index - it regenerated just fine. The TOC is another matter. I clicked Layout > Update Table of Contents. I got the message stating that the contents was updated. However, what actually happened was the TOC text vanished! And, it actually is gone because I can see two empty paragraph markers where the TOC used to be. I've tried regenerating it instead of doing the update. Same result - it's gone.
    I'm still fairly new to InDesign, so I'm not sure what I can do to troubleshoot this. Any suggestions would be appreciated.

    Sounds like ID doesn't think there are any paragraphs with the style names you've selected for inclusion.
    But I'm not a fan of direct conversion of legacy files because these sorts of things, or worse, happen a lot. Try this: Remove minor corruption by exporting

  • Need a help on Update statement

    Hi All,
    I Need a help in updating a table column. PFB my requirement.
    Table1
    ItemID OrgId       Date
    1       82     12/sep/2012   
    2       82     25/oct/2012
    3       82     17/Nov/2012
    4     82     22/Jan/2013
    5     82     26/sep/2012
    Table2
    Itemid     orgid       Date1
    1      82     23/sep/2012      
    2      82     25/Dec/2012
    3      82     17/Sep/2012
    4      82     22/Feb/2013
    5      82     26/Oct/2012
    Table3
    Itemid     orgid       Date3
    1      82     10/sep/2012      
    7      82     30/Dec/2012
    3      82     12/Sep/2012
    10      82     27/Feb/2013
    5      82     29/Oct/2012
    I Need to Update Date column of Table1 With Date3 of table3
    If
    Item and org combination is present in table3 and date column of table1 is less than Date3 of table3
    Else
    I need to Update with date2 of table2.Can we acheive this in a single update statement, can any one help me on this.
    Thanks and regards,
    Rakesh
    Edited by: Venkat Rakesh on Sep 27, 2012 11:04 PM

    You can probably also use MERGE:
    --DROP TABLE table1;
    --DROP TABLE table2;
    --DROP TABLE table3;
    ALTER SESSION SET nls_language = 'AMERICAN';
    CREATE TABLE table1
       itemid    CHAR (1),
       orgid     CHAR (2),
       thedate   DATE
    INSERT INTO table1   SELECT '1', '82', TO_DATE ('10/sep/2011', 'dd/mon/yyyy') FROM DUAL;
    INSERT INTO table1   SELECT '2', '82', TO_DATE ('10/oct/2011', 'dd/mon/yyyy') FROM DUAL;
    INSERT INTO table1   SELECT '3', '82', TO_DATE ('10/nov/2011', 'dd/mon/yyyy') FROM DUAL;
    INSERT INTO table1   SELECT '4', '82', TO_DATE ('10/jan/2011', 'dd/mon/yyyy') FROM DUAL;
    INSERT INTO table1   SELECT '5', '82', TO_DATE ('10/sep/2011', 'dd/mon/yyyy') FROM DUAL;-- won't be updated
    CREATE TABLE table2
       itemid    CHAR (1),
       orgid     CHAR (2),
       thedate   DATE
    INSERT INTO table2   SELECT '1', '82', TO_DATE ('01/sep/2012', 'dd/mon/yyyy') FROM DUAL;
    INSERT INTO table2   SELECT '2', '82', TO_DATE ('01/dec/2012', 'dd/mon/yyyy') FROM DUAL;
    INSERT INTO table2   SELECT '3', '82', TO_DATE ('01/sep/2012', 'dd/mon/yyyy') FROM DUAL;
    INSERT INTO table2   SELECT '4', '82', TO_DATE ('01/feb/2012', 'dd/mon/yyyy') FROM DUAL;
    CREATE TABLE table3
       itemid    CHAR (1),
       orgid     CHAR (2),
       thedate   DATE
    INSERT INTO table3   SELECT '2', '82', TO_DATE ('30/dec/2009', 'dd/mon/yyyy') FROM DUAL; -- date less than table1, so picks from table2
    INSERT INTO table3   SELECT '4', '82', TO_DATE ('30/mar/2013', 'dd/mon/yyyy') FROM DUAL; -- larger than table1 , so pick this date
    -- table1 original data
    SELECT * FROM table1;
    -- merge new data
    MERGE INTO table1
         USING (SELECT NVL (t1.itemid, t2.itemid) itemid,
                       NVL (t1.orgid, t2.orgid) orgid,
                       t2.thedate prefdate ,
                       t1.thedate nextdate
                  FROM    table2 t1
                       FULL OUTER JOIN
                          table3 t2
                       ON t1.itemid = t2.itemid AND t1.orgid = t2.orgid) dat
            ON (dat.itemid = table1.itemid AND dat.orgid = table1.orgid)
    WHEN MATCHED
    THEN
       UPDATE SET table1.thedate = (case when prefdate > table1.thedate then prefdate else nextdate end) ;
    --table1 updated data
    SELECT * FROM table1;OUTPUT:
    Session altered.
    Table created.
    1 row created.
    1 row created.
    1 row created.
    1 row created.
    1 row created.
    Table created.
    1 row created.
    1 row created.
    1 row created.
    1 row created.
    Table created.
    1 row created.
    1 row created.
    ITEMID ORGID THEDATE  
    1      82    10.09.2011
    2      82    10.10.2011
    3      82    10.11.2011
    4      82    10.01.2011
    5      82    10.09.2011
    5 rows selected.
    4 rows merged.
    ITEMID ORGID THEDATE  
    1      82    01.09.2012
    2      82    01.12.2012
    3      82    01.09.2012
    4      82    30.03.2013
    5      82    10.09.2011
    5 rows selected.

  • Need a Query to update....below are requirements

    Hi,
    I need a query to update table xx_cc_audit. below are requirements.
    In xx_cc_audit I have more than 1000 rows. In this table Column - contract_number is inserted as null for some rows.
    I need a query to update this xx_cc_audit table which will replace null contract numbers with correct ones.
    In table xx_cc_audit I have column - instance_id which is not null and not unique.(duplicate instance id's can be there).
    With this instance_id i can get the contract_number from other table okc_k_headers_b .
    I need a query to update xx_cc_audit table.
    Presently what I'm doing :
    Select XS.instance_id
    FROM cs_incidents_all_b CS,xx_cc_audit XS
    where XS.contract_number is null
    AND XS.SR_NUMBER = CS.incident_number
    AND XS.ACTIVITY_TYPE = 'TROUBLESHOOTING';
    Note : The above query can give duplicate instance_id.
    Say, above query results in 100rows.
    I will copy any 1 instance_id in a paper and then pass it to below query.
    SELECT contract_number
    FROM okc_k_headers_b
    WHERE id = (SELECT MAX(dnz_chr_id)
    FROM okc_k_items
    WHERE object1_id1 = TO_CHAR(144849056) --instance_id
    AND jtot_object1_code = 'OKX_CUSTPROD'
    AND object1_id2 = '#'
    AND chr_id IS NOT NULL);
    I'll get contract_number.
    then i'll update xx_cc_audit table as below.
    update      xx_cc_audit set contract_number = 1223464789 -- which i got as a result of above query
    where contract_number is null
    and instance_id = 144849056     --this i copied from paper, as mentioned above     ;
    this will update my table.
    I have more than 1000rows, so i need a query which will update 1000rows in 1 shot.
    Please help me.
    Thanks!...
    Edited by: Kiran Sanga on Jul 20, 2009 2:15 AM

    OK, so that means a maximum of 10 distinct IDs in okc_k_headers_b can be matched with xx_cc_audit xca.
    That's a data issue for yourself that you'll need to work out, i.e, are you being too restrictive in any of the subqueries, particularly this one:
    WHERE id = (
        SELECT MAX(dnz_chr_id)
          FROM okc_k_items
        WHERE object1_id1 IN (
          Select XS.instance_id
          FROM cs_incidents_all_b CS,xx_cc_audit XS
          where XS.contract_number is null
            AND XS.SR_NUMBER = CS.incident_number
            AND XS.ACTIVITY_TYPE = 'TROUBLESHOOTING')
      AND jtot_object1_code = 'OKX_CUSTPROD'
      AND object1_id2 = '#'
      AND chr_id IS NOT NULL)Edited by: SeánMacGC on Jul 20, 2009 3:37 AM
    And here is a slight different version of the update that should perform a little better:
    update xx_cc_audit xca set contract_number = (
      SELECT contract_number
        FROM okc_k_headers_b okhb
    WHERE id IN (
        SELECT dnz_chr_id
          FROM okc_k_items
        WHERE object1_id1 IN (
          Select XS.instance_id
          FROM cs_incidents_all_b CS,xx_cc_audit XS
          where XS.contract_number is null
            AND XS.SR_NUMBER = CS.incident_number
            AND XS.ACTIVITY_TYPE = 'TROUBLESHOOTING')
      AND jtot_object1_code = 'OKX_CUSTPROD'
      AND object1_id2 = '#'
      AND chr_id IS NOT NULL)
      AND xca.instance_id = okhb.object1_id1
    where contract_number is null;

  • ID CS5: How to include additional text into a table of contents and how to hide text from it?

    I have the following problem:
    1. I'd like to include additional Information in my table of contents which I don't want to appear in the text I refer to.
    Example: I do have a picture with a caption saying:
    picture 1: Blablabla.
    And I want to have the source of the picture as additional information in the table of contents:
    picture 1........Blablabla (source: thisandthat)........23
    Still I don't want this additional content to disappear, as soon as I update the table of contents!
    How can I achieve that?
    2. And how can I have this the other way round?
    Let's say I want the source in the caption, but not in the table of contents.
    So the caption says:
    picture1: Blablabla (source: thisandthat)
    but the table of content says:
    picture 1........Blablabla.....................23
    I was trying to achieve this by two different praograph styles in the caption. One which would be listed, and one which wouldn't be listed, but this of course resulted in always having two paragraphs in the caption, which I'd like to avoid:
    picture1: Blablabla
    (source: thisandthat)
    Any solution to this?
    Best Regards,
    Rainer Schwachsinn

    Sorry, missed the second part of the question. I think the only way to do that is to use invisible "dummy" text of some sort, and if you're going to do it for some entries, you might as will do it for all.
    One of the easiest ways is to put the text you want inthe TOC into an anchored frame attached to the actual heading in the text (so it moves along with it). Use a unique paragraph style for this text, and include this style, not the one applied to the headings inthe text, to make the TOC. I usually use a character color of red to make it satnd oout so I don't forget it's there, and the position on the page isn't really critical. Select the anchored frame, open the Attributes panel and make it non-printing. You'll see it in editing mode, the TOC will pick it up (as will variables, if required) but it will disappear on output.

  • How do I make a table of contents for a collection of six short stories that is after the legal page and NOT in the front on an unnumbered page?

    How do I make a table of contents for a collection of six short stories that is after the legal page and NOT in the front on an unnumbered page?
    When I first started I made a title page and then pasted in my first story from a .TXT file. After cleaning up I went back to the front a couple of empty lines ahead of the story and typed in the story title.  Unlarged the font size and centered it, then

    You can't do that. This is what the Pages User Guide, downloadable from your Pages Help menu, says:
    Creating and Updating a Table of Contents
    Each table of contents (TOC) you create using a Word Processing template lists only the content that follows it, up until the next table of contents. If you want a master table of contents for the entire document, it must be the only table of contents, and it must be at the beginning of the document.
    You can do it manually though.

  • Linking table of contents with pages 5.0

    I write some help-books for friends and the family.
    I wrote down everything I need and I've created a table of contents with page numbers.
    Now you can push the numbers behind the headings and you are automatically on the right page for reading the text. (In Pages document)
    In pages 5.0 these things are still working fine, but....
    When I export the document into a pdf, you can't push/touch the headings and the numbers behind there headings.
    With the old pages, after exporting the document into a pdf, you could import it into iBooks on the iPad. In iBooks now you can touch a heading and you'll get on the right page.
    That was realy helpfull, 1 click and you could read the text on which you're interested.
    But with the new pages 5.0 this feature is deleted... or I do something wrong.
    Could anyone of you help me for getting this feature back, if I do something wrong?

    Well there is a standard body for EPUB - http://idpf.org/epub
    And, Apple furnishes the TEMPLATE - the Pages 09 TEMPLATE - automatically (supposedily) makes the TOC links which - then - you can export to EPUB.
    Again, the problem I'm daling with is that the Kindle for the iPad, does not see the TOC. It des see it in the Kindle Softward for the Mac - which is different - for some reason. I have authored two books on Pages but Amazon converts my EPUB file to fit the Kindle device itself.

  • How best to include additional on-page info (*as well as*) page numbers in a Table of Contents?

    Hi all -
    I'm creating a directory / listings document. At the end of the publication, I need to create a "quick reference" section - with an alphabetised listing of each entry, some key info from each entry, and the page number for each entry.
    I've created a unique paragraph style for each of the lines that I need to include here - so the Table of Contents is picking them up successfully.
    However, I'm struggling to style the outputs of the Table of Contents the way I need: I want a tab between each of the included paragraph styles that are returned for each entry, and then a line return at the end.
    So…
    First Hotel name -> Star Rating -> Number of Bedrooms -> etc etc
    Second Hotel name -> Star Rating -> Number of Bedrooms -> etc etc
    Instead of…
    First Hotel name
    Star Rating
      Number of Bedrooms
       etc
    Second Hotel name
    Star Rating
      Number of Bedrooms
       etc
    Any suggestions?
    One important point to note - I'm using CS5.5… an upgrade is in my future, but I want to finish this project first! (Don't want to switch mid-stream.)
    Thanks!

    Thanks. I went there and bulleted align by decimal, but it didn't work on the page. For one thing, when I highlight that page, for some weird reason the numbers from 9 up DO NOT HIGHLIGHT. !  Only the text following those numbers highlight, altho all the other numbers and text following 9 highlight!
    Don't know why it would have this weird situation! Seems like a flaw in the design.
    I tried moving the little blue cursors above, but I'd need to move it half a step either way to bring those one-digit number decimals in alignment with the rest. For some reason the cursors will ONLY move a full step! So they're out of alignment no matter what I do. Darn!
    Kristen
    gemsandbeyond at aol dot com

  • Table of contents not showing items before it

    I have a document which has to follow a strict format. It must have pages in the following order:
    Cover page
    Title page
    Acknowledgements
    Table of contents
    Various other stuff
    I've set up a table of contents and it's working fine, except it isn't showing items that appear before it. All I want is for the Acknowledgements page (which is immediately before the TOC) to show up in the TOC, but I can't get it to work.
    Is this just a limitation of Pages? Does the TOC only ever show items that appear after it?

    pd,
    Unfortunately for you, according to the Pages '09 User Guide, Chapter 3 Using Table Of Contents says the following:
    Creating and Updating a Table of Contents
    Each table of contents (TOC) you create using a Word Processing template lists only the content that follows it, up until the next table of contents. If you want a master table of contents for the entire document, it must be the only table of contents, and it must be at the beginning of the document.
    Sorry.

  • Table of contents in Pages

    I am writing my master thesis right now and the structure is as follows: two cover pages, acknowledgments, abstracts and then i would like to put a table of contents. previous pages are done with the appropriate style (heading 1) but when i insert the TOC, it's empty. Is there a way it can include the previous headings? I hope this is clear enough! Thank you very much!
    Rumen

    and 8 lines under you will read:
    *Creating and Updating a Table of Contents*
    Each table of contents (TOC) you create using a Word Processing template lists only the content that follows it, up until the next table of contents. If you want a master table of contents for the entire document, it must be the only table of contents, and it must be at the beginning of the document.
    To update the TOC after editing a document, click any entry in the table of contents, or click Update Now in the TOC pane of the Document inspector. If you don’t update the table of contents after changing a document, it updates automatically when you close the document.
    You are hitting the result of the use of common resources for the Help and for the User Guide.
    In the Help, the part which you reproduced is really page different of the referenced one.
    It seems that the draft of the User Guide was made from the Help with a piece of code replacing the links between Help 'pages' by references to paper pages.
    Sometimes the result is effectively funny but not sufficient for "a good laugh" .
    Yvan KOENIG (from FRANCE jeudi 2 juillet 2009 17:32:31)

Maybe you are looking for

  • Creating a dropdown menu from an image hotspot

    How do you create a dropdown menu from an image hotspot? For example, this website is a single jpg image with links generated from hotspot coordinates on the image. Can I have someone click on a hotspot and a dropdown menu appears? Thanks in advance

  • Pages not loading with Safari 4.0.4

    I am using Safari for Microsoft windows with xp SP3. Most of the time it works fine but: If I click on a link on a page the page goes blank with the busy icon spinning and just sits there. If I click [View] [reload page] then the new page appears alm

  • White Specs and 1 Dead Pixel

    Hi everyone, I'm not sure if anyone else is experiencing this but I have a week 36 iPod, without any of the audio or negative black issues but instead with tiny white specs that appear and disappear when I move the iPod in different angles. These whi

  • Third party logistics provider

    hi , Has any one worked on third party logistics ? Can any one explain what are 'Interfaces u2013 figuring about 10 on 3rd party logistics provider side and 21 on the customer side' . Are they like interface to send some data from some other system t

  • Macbook running slow after installing Yosemite

    Problem description: macbook runs extremely slow (opening any files, especially iPhoto, safari pages) especially after “upgrading” to Yosemite. EtreCheck version: 2.1.8 (121) Report generated March 28, 2015 at 2:12:33 PM EDT Download EtreCheck from h