How can I get an instance of my customize cell in tableview?

Hi,I'd like to generate a customize tablecell in my tableview.but How can I get an instance of my customize cell in tableview when selected item changes?
public class Person {
          private javafx.beans.property.BooleanProperty active;
          private StringProperty firstName;
          private StringProperty lastName;
          private StringProperty email;
          private Person(String fName, String lName, String email) {
               this.active = new SimpleBooleanProperty(true);
               this.firstName = new SimpleStringProperty(fName);
               this.lastName = new SimpleStringProperty(lName);
               this.email = new SimpleStringProperty(email);
          public javafx.beans.property.BooleanProperty activeProperty() { return active; }
          public StringProperty firstNameProperty() { return firstName; }
          public StringProperty lastNameProperty() { return lastName; }
          public StringProperty emailProperty() { return email; }
final ObservableList<Person> data = FXCollections.observableArrayList(
                         new Person("Jacob", "Smith", "[email protected]"),
                         new Person("Isabella", "Johnson", "[email protected]"),
                         new Person("Ethan", "Williams", "[email protected]"),
                         new Person("Emma", "Jones", "[email protected]"),
                         new Person("Michael", "Brown", "[email protected]")
public class RatingCell extends TableCell<Person,String> {
    private NabiSyncRating rating;//NabiSyncRating is a customize control.it has some method ,like change backgroud-color,value,etc.
    public RatingCell() {
         rating = new NabiSyncRating(-1);
    @Override
    public void startEdit() {
        super.startEdit();
        if (isEmpty()) {
            return;
        rating.setDisable(false);
        rating.requestFocus();
    @Override
    public void cancelEdit() {
        super.cancelEdit();
        rating.setDisable(true);
    public void commitEdit(String value) {
        super.commitEdit(value);
        rating.setDisable(true);
    @Override
    public void updateItem(String item, boolean empty) {
        super.updateItem(item, empty);
Callback<TableColumn<Person, String>, TableCell<Person, String>> ratingCellFactory = new Callback<TableColumn<Person, String>, TableCell<Person, String>>() {
                    @Override
                    public TableCell<Person, String> call(
                              TableColumn<Person, String> p) {
                         return new RatingCell();
TableColumn firstNameCol = new TableColumn();
firstNameCol.setCellFactory(ratingCellFactory);
firstNameCol.setMinWidth(100);
firstNameCol.setMaxWidth(224);
firstNameCol.setResizable(true);
tableView.getColumns().addAll(firstNameCol);
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() {
              @Override
              public void changed(ObservableValue observable, Object oldvalue, Object newValue)
                           Person person=(Person)newValue;
                           //I'd like to get the instance of my customize control 'RatingCell' ,How can I get the RatingCell instance which in current row?
                     System.out.println("selected row is : " + newValue );
              });

HI,
I have found a solution to find it
First ,you need to set person property 'id' as the input parameter for your customized component method 'public void updateItem(String item, boolean empty)'
ratingCol.setCellValueFactory(new PropertyValueFactory<Person,String>("id"));
firstNameCol.setCellFactory(ratingCellFactory);and then you need to implement your customize component like this:
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.TableCell;
public class RatingCell extends TableCell<Person,String> {
    private NabiSyncRating rating;
    public RatingCell() {
         rating = new NabiSyncRating(5);
        this.setGraphic(rating);
        this.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
        this.setEditable(true);
    public void updateRating()
         if(rating!=null)
              rating.selectRating();
    @Override
    public void startEdit() {
        super.startEdit();
        if (isEmpty()) {
            return;
        rating.setDisable(false);
        rating.requestFocus();
    @Override
    public void cancelEdit() {
        super.cancelEdit();
        rating.setDisable(true);
    public void commitEdit(String value) {
        super.commitEdit(value);
        rating.setDisable(true);
    @Override
    public void updateItem(String item, boolean empty) {
         if(item!=null && item.length()>0)
              if(rating!=null)
                   rating.setId("NR"+item);
                   this.setId("NC"+item);
            super.updateItem(item, empty);
} and find the current like this :
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() {
                   @Override
                   public void changed(ObservableValue observable, Object oldvalue, Object newValue)
                        Person person=(Person)newValue;
                        Set<Node> colNodes=tableView.lookupAll("RatingCell");
                        for(Node nod:colNodes)
                             System.out.println("person.email:"+"NC"+person.email.getValue()+"|nodId: " + nod.getId()+"\r\n" );
                             if(("NC"+person.email.getValue()).equals(nod.getId()))
                                   System.out.println("get current instance" );
                                  ((RatingCell)nod).updateRating();
                   });Edited by: noob on Apr 20, 2012 4:49 PM

Similar Messages

  • [CS3/CS4 JS] How can you get the associatedXMLElement of a merged cell in a table?

    Hi!
    Inserting a table, and autotagging it, I get a table with a number of cell elements in the XML Structure.
    Selecting an item in the table, I can find the associated XML by the following line of code:
    app.selection[0].associatedXMLElement
    My problems begin when cells are merged. Then the associatedXMLElement for the cell returns null.
    How can I find the associatedXMLElement for a merged cell?
    Using the getElements makes no difference.
    app.selection[0].getElements()[0].associatedXMLElement
    (returns null)
    In the XML structure I can see that the merged cell is still associated to an XML Element, which becomes underlined and also referrs back to the cell, selecting it when double clicking the XML Element link in the structure.
    Is there no way to get to the xml element of a merged cell?
    I have tested in CS3 and CS4 as well, and they act in the same way.
    I also found a similar, unanswered, question from Anne-Laure Jallon in the "With CS3, some things have changed" ( http://forums.adobe.com/message/1105813#1105813 ):
    Hello,
    I'm working with VBscript.
    Is there a difference between cell.associatedXmlElement in CS2 and CS3?
    All my cells in CS2 had an associatedXmlElement.
    In CS3, my table has an associatedXmlElement, but all its cells don't (The value is Nothing)
    Is this a bug? Is it linked with XML evolution?   Thanks Anne Laure
    Adding some more info:
    I made a test, by selecting the XMLElement in the structure, and from that object finding the cell, and finding back to the assiciatedXMLElement:
    app.selection[0].getElements()[0].cells[0].associatedXMLElement
    Result: [object XMLElement]
    So that kind of "chain" works.
    But with the merged cell as only reference, I can't find its associatedXMLElement. Any ideas would be appreciated.
    Best regards,
    Andreas Jansson
    Message was edited by: Andreas Jansson

    In my opinion, locate a cell according to his content is not so effortable. What happens if contents of more than two cells are equals?
    I take xml elements of associated xml element of table and put them into an array.
    This array contains associated xml elements of every cell ordered by cell positions into table.
    Now, locate associated xml element of a cell based on its array position (index) is more reliable:
    var myCell_cell = app.selection[0];
    var myElement = myCell.associateXMLElement
    if (!myElement || !myElement.isValid)  {
         var table =  myCell.parent;
         var xml_tab = table.associatedXMLElement;
         var xml_cells_arr = xml_tab.xmlElements.everyItem().getElements();
         var idx = myCell.index;
         myElement = xml_cells_arr[idx];
    Alex ;-)

  • How can I get the position of an element/cell of a ListView?

    Hi,
    I am working on an interface that requires "Parallel Coordinate" like view. It requires lists with edges between their elements. To do that I need the location (x, y) coordinates of the right and left edges of each cell. Is there a way to find that?
    Thanks
    Ankit

    No, it has to by 'dynamic'. I don't want to transfer it hard, because it should work for any internal table name.
    The requirement is: There are many function modules that have an input field TABLENAME. I have to give the tablename in the Form 'IT_TAB'.
    But I look for a possibiltity not to write:
    tabname = 'IT_TAB'.
    For DDIC-Tables its not a problem, but I dont know a way for internal tables.

  • TS4006 My old location is stuck with the gray dot and won't rsfresh. How can I get this iphone to locate my cell again

    I am trying to locate my girlfriends cell
    I use Iphone finder
    It was working minutes later is stayed on old location with a gray dot
    Any input why?

    Hi,
    There is a similar issue in this thread
    https://discussions.apple.com/thread/5108357?start=0&tstart=0
    Follow the steps in the Apple KB metioned and hopefully you will have your device back

  • How can I get the container of a button after the button is clicked?

    I have two components:
    public class A extends JPanel implements ActionListener {
        public A() {
        public void actionPerformed(ActionEvent e) {
            String command = e.getActionCommand();
            // here need to know the instance of B to execute it's process()
            // but I can only know the button jb in B via the following code:
            JButton myjb = (JButton)(e.getSource());
    public class B extends JPanel {
        public ContainerInfoInput(ActionListener al) {
            JButton jb = new JButton("OK");
            jb.setActionCommand("B.ok");
            jb.addActionListener(al);
        public process() {
    public class Main {
        A a = new A();
        B b = new B(a);
    }How can I get the instance of B in which the button is clicked?
    Thank you

    I think it's a defect of the listener mechanism. Under the present circumstance, I must do it like the following:
    I must use another class M as a bridge:
    class A {
        public A() { }   
        public processA (String info ){}
    class B{
        public B(ActionListener al) {       
            JButton jb = new JButton("OK");       
            jb.setActionCommand("B.ok");      
            jb.addActionListener(al);  
       public String processB () {    }
    class M implements ActionListener  {
        public M() {
            A a = new A();
            B b = new B(this);
        public void actionPerformed(ActionEvent e) {
            String command = e.getActionCommand();
            if(command.equals("B.ok")) {
                String information =b.processB();
                a.processA(information);
    }Why not just use A to listen B and obtain instance of B through the ActionEvent?
    Anyone know a solution about it?

  • How can I get file from multiple instance using file adapter

    Hi.
    Our system(PI7.1) have three application instances running with each physical servers.
    We use sender file adapter.
    The file data is sent to one of the servers.
    Now, how can I get the file using three file adater?
    Should I put the file "sapmnt(\usr\sap)" .
    Or are there another solution?
    regards,

    Hi Ashutosh
    You will have to use sapcar.zip which contains the utility Sapcar.exe utility for unzipping the files from SAP compressed files. (*.car file)
    Regards
    Gaurav
    PS: Reward points if solved

  • If I add artwork by dragging a jpg to the artwork area after selecting several rows, in some instances a single icon is created in the flipper;  in others one is created for each song. Why? How can I get one image per album every time?

    If I add artwork by dragging a jpg to the artwork area after selecting several rows, in some instances a single icon is created in the flipper;  in others one is created for each song. Why? How can I get one image per album every time?

    If I add artwork by dragging a jpg to the artwork area after selecting several rows, in some instances a single icon is created in the flipper;  in others one is created for each song. Why? How can I get one image per album every time?

  • How can I get objects of multiple instances of InDesignServer

    Hello,
    We need to have InDesignServer running in more than one configuration. And we need to script them. So to keep easy let's pretend there are 2 instances of InDesignServer running. One startet with 'indesignserver -configuration conf0' and the other started with 'indesignserver -configuration conf1'.
    So we try (Visual Basic):
    dim myIndApp0 as InDesign.Application
    dim myIndApp1 as InDesign.Application
    myIndApps0 = CreateObject("InDesignServer.Application.CS2")
    myIndApps1 = CreateObject("InDesignServer.Application.CS2")
    But both objects referring to the instance with conf0. How can we get an object of the second instance?
    We tried to solve this using System.Diagnostics.Process.GetProcesses(). So we got both processes. But did not find a way to get an object of class InDesignServer.Application by using an object of System.Diagnostics.Process. Any ideas about that way?

    Hi Ian,
    The problem is not to start different instances. In the Windows Task Manager and the console output of InDesign Server I can see, that both instances are running with different configurations. When I use Systems.Diagnostics.Processes.GetProcess() I get both processes too.
    But I don't know how to get objects of both instances using the Interop Assembly or (as a runaround) how to cast an object of System.Diagnostics.Process into an object of InDesignServer.Application.
    When you talking about SOAP, do you know how to start InDesignServer twice with diffrent ports from inside VB and getting the InDesignServer.Application objects of it?
    This should be solve our problem too.

  • I am having macbook air recently my iphotos did not open and was showing report apple and reopen but i came to know that by pressing alt and iphotos i open an new photo library and stored the pics but now how can i get the pics which i had in the earlier

    i am having macbook air recently my iphotos did not open and was showing report apple and reopen but i came to know that by pressing alt and iphotos i open an new photo library and stored the pics but now how can i get the pics which i had in the earlier photo please help me to recover my photos

    Well I'll guess you're using iPhoto 11:
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In early versions of Library Manager it's the File -> Rebuild command. In later versions it's under the Library menu.)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  
    Regards
    TD

  • How can I get the underlying object from the ObjectReference

    Dear friends,
    I think this question has been asked a couple of times. But, I am still wondering if anybody has found an answer to it. Maybe this is some common need ...
    I would like to get the underlying object for which the ObjectReference is
    a mirror For example, I have a class Customer in my application, and I can get an ObjectReference through JDI during runtime. But how can I get the target VM's object which is a real instance of Customer, by which I can invoke methods defined in Customer?
    Thank you so much for any input!
    SunnyDay

    I'll preface this response by admitting this far from an elegant solution, but I did write a function addressing this question, mostly as an exercise.
    If passed an object with an InTextFrame property (Pgf, AFrame, Cell, Fn) that resides in an open document, the function will return the Doc object. Otherwise, it returns undefined.
    function getParentDoc(testObj) {
        //Get object for current page
        try { var curPage = testObj.InTextFrame.FrameParent.PageFramePage; }
        catch(er) {return;}
        //Step backwards to first page in document
        var prevPage = curPage.PagePrev;
        while (prevPage.ObjectValid())
            curPage = prevPage;
            prevPage = prevPage.PagePrev;
        //Compare with first pages of open documents
        var testDoc = app.FirstOpenDoc;
        while (testDoc.ObjectValid())
            if (curPage.id==testDoc.FirstBodyPageInDoc.id) return testDoc;
            testDoc = testDoc.NextOpenDocInSession;    
        return;
    To your PPS: Rather than seeing the native framework grow bloated to address additional features, I would love to see Adobe and other developers publish libraries of useful functions and class extensions.

  • How can we get ADFSecurity work when used in OC4J, OID and OAM?

    I am getting error in http server log "mod_oc4j: Response status=499 and reason=Oracle SSO, but failed to get mod_osso global context."
    But I am not using Oracle SSO and my client doesn't want to use it either, I am using OAM SSO(CoreIDSSO) in my configuration. Please read the details below.
    I am using ADFSecurity in an app that is protected by OAM. To migrate ADFSecurity permissions from
    system-jazn-data.xml to OID, I used JAZNMigrationTool to populate OID with Grantees and Permissions. OAM gives login page, and authentication works fine.
    But ADFSecurity is not working. ADFComponent Delete button is enabled even for roles that dont have permissions for the iterator delete.
    - The app works fine when I use without OAM. ADF Security permissions work fine.
    - The app works fine when used with OAM, but with ADFSecurity disabled (enforce=false).
    - When I enforce ADFSecurity alongwith OAM, ADFSecurity is not working.
    In the doc "Oracle Containers for J2EE Security Guide b28957", there is a mention of use of CoreIDPrincipal for permissions. Our OID Permissions entries show
    LDAPRealmRole for attribute orcljaznprincipal. I am not sure if this could be the reason.
    We have configured AccessServerSDK for the SOA instance and have policy for the urls in the policy manager. We have entries in orion-application.xml, orion-web.xml and system-jazn-data.xml as per the documentations.
    How can we get ADFSecurity work when used with OID and OAM?

    Have you been able to successfully integrate OAS with OAM & OID? We have similar requriement and so far we have not been able to get it working.
    We have application specific roles which we map to OID roles using orion-application.xml.
    Any pointers to achieve this would be greatly appreciated.
    thanks,
    Dipal

  • How can I get rid of the highlight in the list box

    I clear the T-List in WHEN-NEW-FORM-INSTANCE trigger using Clear_List(list_id). The list will be empty but it will highlight on the first entry in the list.
    How can I get rid of the hightlight at this kind of situation?
    Thanks

    If you want to change countries and can't spend it then you can try contacting iTunes support and ask them if they can remove the balance so that you can do so : http://www.apple.com/support/itunes/contact/- click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • How can you get the schedule of a single reoccurring job with Restart ability in Redwood to pause when it has failed...?

    We need the Request Restart ability when scheduling a single reoccurring job in Redwood. Most of our jobs are scheduled in CHAINs which offers the Final Status Handler on Step level, and the schedule is "paused" when a job in the CHAIN has failed ( the next instance does not populate until the OP MSG has been Replied to) , and once the OPERATOR message is replied to, the CHAIN can resume running again ( desired ) . But we need this same ability when scheduling a single job not in a CHAIN. In our testing, we set up a job with Request Restart chosen on the Error , Killed and Unknown selections on the Restart Behavior Tab. But we found when a job is scheduled say once a day at 8AM, and when it fails, an OPERATOR msg appears allowing a Restart choice ( desired), but the next day's schedule also populates ( undesired) and we do NOT want the schedule to continue on yet because we need a chance to fix the error before the next insance runs for business reasons. So how can you get the schedule of a single reoccurring job with Restart ability in Redwood to pause when it has failed...?

    Hello Fran,
    You can wrap the job chain in a master job chain in the first step and set the final status handler there.
    You can also set the Restart Behavior to 'Stop Submit Frame', in that case you will have to resubmit the job once you are finished troubleshooting.
    Regards Gerben

  • How can I get a detail block to requery after a database change?

    Hi, I have a master/detail form. When the status of the master record changes, I need to update a date in one of the detail records. If I use SQL to update the detail row in the database in the ON-CHANGE trigger of the master block, how can I get the detail block to requery to show the change? When I try doing a go_block from any of the ...UPDATE triggers, it says it is restricted.

    wjpenfold,
    Do you have a "Relationship" defined between your Master and Detail blocks? If so, you simply need to requery your master block and the detail block will automatically be requeried. If you can't use a relationship, then you can use can create a timer in the trigger that updates the database and then in the When-Timer-Expired (WTE) trigger you can go to the detail block and execute a query. For example:
    /* Sample On-Change trigger */
    DECLARE
       timer_id  TIMER;
    BEGIN
    ....your code here that performs the update....
       /* Now create an instance of a timer */
       timer_id := Create_Timer ('upd_detail',1,NO_REPEAT);
    END;
    /* Sample Form Level When-Timer-Expired trigger */
    DECLARE
       timer_id   TIMER;
    BEGIN
       -- Find the timer first
       timer_id := FIND_TIMER('upd_detail');
       IF NOT ID_NULL(timer_id) THEN
          GO_BLOCK('DETAIL_BLOCK');
          Execute_Query;
       END IF;
    END;Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • How can I get the tablename from a known ViewObject?

    I have created an entity and it's default viewobject in the BC4J business components package,and I have built a applictionmodule containing an instance of the viewobject.
    Now I can use the instance's name to visit the viewobject or the entity in Jdeveloper.
    But how can I get the tablename of the entity by the viewobject instance's name ?
    Can you give me any sample statements?

    Assuming you want to do this in your middle-tier, it could go like this:
    ViewObjectImpl vo = (ViewObjectImpl)appModule.findViewObject( "<instance name>" );
    if( vo != null ) {
      // Assuming your VO is entity based.
      EntityDefImpl[] defs = vo.getEntityDefs();
      System.out.println( defs[0].getSource() );
    }If you need the name on client side, then put the code above into a method in you Application Module impl and add the method to the client-side interface.
    Sascha

Maybe you are looking for

  • Uploading cvs or xlsx format calendar meetings

    I know there is a way to expheort a calendar in Outlook in CVS or XLXS format. The issue I am having is importing the file (Calendar) into iCloud's Calendar. It works as a hit and miss and I usually get this message: An error occurred while importing

  • Full Width Composition

    I know you can do a full width slideshow now, but that is not what I'm looking for. I want the ability to have a button that makes a hidden full width object appear.  Currently I don't know of a way to accomplish this with any of the default widgets

  • Ann: Super 8.0 with SuperJMX

    Acelet has released new version of Super - a toolkit for J2EE. The new module SuperJMS provide capability to visually create JMS message and triggers, which can be exported to SuperScheduler and SuperWatchdog. Now, you do JMS by clicking. It is free.

  • Spaces - How can I move an application in a single step

    Say, I have a Safari window open in Space1 and want to move it to Space 4. Instead of dragging the window to the edge, is there a single step that moves the window straight to Space4?

  • Query to get the followng details

    (related to IO) Table Activity for the 26 Most Active with the following fields Table name, location, reads, write, updates and Deletes