Under the same hbox of JavaFX, drag the left button on the drop-down bar to bounce?

Source: Internet
Author: User

great gods, I now have a button column like this,


Then there will be a drop-down bar on the right side of the data:


But now is pulling the right pull bar, the left button will be disorderly beat out,


And then the reason for this is because each pull down the drop bar will call a UpdateItem () method, how to let this drop bar drag


only callback once this UpdateItem () method ? Or is there any other way to improve the bug? Urgently seeking!!!!!!!


Some of the code is as follows:

public class Allroomoperatebuttontablecell<s, t> extends Tablecell<s, t> {


Private final HBox Mhbox;
Private final Button mviewbn;
Private final Button mviewpicbn;
Private observablevalue<t> ov;
Private final observablelist<roomoperaterecordinfo> mtranslist;
Private Roomoperaterecordinfo Mtransinfo;
Private final TableView Mtableview;


Public Allroomoperatebuttontablecell (observablelist<roomoperaterecordinfo> Translist,tableview TableView) {
This.mtranslist = translist;
This.mtransinfo = null;
This.mtableview = TableView;
This.mhbox = new HBox ();
This.mHbox.setSpacing (5);
This.mHbox.setAlignment (Pos.center);

THIS.MVIEWBN = Buttonbuilder.create ()
. Text ("View")
. Prefwidth (60)
. Prefheight (30)
. build ();
This.mViewBn.setOnAction (New eventhandler<actionevent> () {
@Override
public void handle (ActionEvent event) {
Synchronized (mtranslist) {
Mtableview.getselectionmodel (). Select (GetIndex ());
Mtransinfo = Mtranslist.get (GetIndex ());
if (mtransinfo.getstatus () = = Check_trans_done + Ten | | mtransinfo.getstatus () = = check_trans_cancelled + | | mTransInfo. GetStatus () = = check_trans_systemcancelled + 10) {
Checkingroomtransinfo checkinfo = new Checkingroomtransinfo (Mtransinfo.gettransid (), Mtransinfo.getsubmittime (), Mtransinfo.getroomno (), Mtransinfo.getcreatedbyeno (), Mtransinfo.getreadflag (), Mtransinfo.getstatus (), Mtransinfo.getprocesstime (), mtransinfo.getcomments (), Mtransinfo.getprocesseno ());
for (int i=0;i<mtransinfo.getmminibarinfoslist (). Size (); i++) {
Checkinfo.addmminibarinfoslist (Mtransinfo.getmminibarinfoslist (). get (i));
}
Showchecktransdetail (checkinfo, NULL);
}else if (mtransinfo.getstatus () = = Clean_trans_unhandled | | mtransinfo.getstatus () = = Clean_trans_uninspected | | Mtransinfo.getstatus () = = Clean_trans_inspected | | Mtransinfo.getstatus () = = Clean_trans_unpassed | | Mtransinfo.getstatus () = = Clean_trans_delayed | | Mtransinfo.getstatus () = = Clean_trans_cancelled | | Mtransinfo.getstatus () = = Clean_trans_timeout) {
Cleantransinfo cleaninfo = new Cleantransinfo (Mtransinfo.gettransid (), Mtransinfo.getsubmittime (), Mtransinfo.getroomno (), Mtransinfo.getcreatedbyeno (), Mtransinfo.getreadflag (), Mtransinfo.getstatus (), 2, Mtransinfo.getprocesstime (), mtransinfo.getcomments (), Mtransinfo.getprocesseno ());
Showcleantransdetail (cleaninfo, NULL);
}


Mtableview.requestfocus ();
}
}
});

THIS.MVIEWPICBN = Buttonbuilder.create ()
. text ("See figure")
. Prefwidth (60)
. Prefheight (30)
. build ();
This.mViewPicBn.setOnAction (New eventhandler<actionevent> () {
@Override
public void handle (ActionEvent event) {
Mtableview.getselectionmodel (). Select (GetIndex ());
Mtransinfo = Mtranslist.get (GetIndex ());
Showrelatedpicdetail (Null,mtransinfo);
Mtableview.requestfocus ();
}
});


Mhbox.getchildren (). AddAll (MVIEWBN);
Setalignment (Pos.center);
Setgraphic (Mhbox);
}

@Override
public void UpdateItem (T item, Boolean empty) {

Super.updateitem (item, empty);
if (empty) {
SetText (NULL);
Setgraphic (NULL);
} else {
Setgraphic (Mhbox);

ov = Gettablecolumn (). Getcellobservablevalue (GetIndex ());

if (ov instanceof integerproperty) {
int status = ((Integerproperty) ov). get ();
if (status = = Check_trans_done + Ten | | | status = check_trans_cancelled + | | status = = check_trans_systemcancelled + 10
|| Status = = Clean_trans_inspected | | Status = = Clean_trans_cancelled | | Status = = Clean_trans_timeout) {
Mviewbn.settext ("View");
Mviewbn.setstyle ("-fx-base:olivedrab;");
}else if (status = = Check_status_checkout | | status = = check_trans_unhandled + | | status = = check_trans_done + 100 | | Status = = check_trans_cancelled + 100
|| Status = = check_trans_systemcancelled + 100 | | Status = = Clean_status_create | | Status = =-clean_trans_uninspected | | Status = =-clean_trans_inspected
|| Status ==-clean_trans_unpassed | |  Status ==-clean_trans_delayed | | Status = =-clean_trans_cancelled | | Status = =-clean_trans_timeout | | Status = = Notify_log) {
Setgraphic (NULL);
Return
} else {
Mviewbn.settext ("Processing");
Mviewbn.setstyle ("-fx-base:orange;");
}
}


if (mtransinfo = = null) {
Mtransinfo = Mtranslist.get (GetIndex ());
if (mtransinfo.ischecking () = null && mtransinfo.ischecking ()! = "" && mtransinfo.getrelatedpiclist (). Size () > 0) {
Mhbox.getchildren (). Add (0,MVIEWPICBN);
}
}
}
}
}

Under the same hbox of JavaFX, drag the left button on the drop-down bar to bounce?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.