I want to access the text elements inside this textbox in GWT from the main method (where I call it like this)
DialogBox aBox = newCandidatePop.buildNewElecPopup();
aBox.center();
aBox.getWidget();
MiscUiTools.newCandidateHandler(aBox.firstName, aBox.surName);
in newCandidateHandler i want to attach a click handler to the two text boxes
However, the above doesnt quite work - I cant get access to the aBox.firstName elements because they are static methods -- I am wondering what is best practice, how would you code something like this up?
static TextBox firstName = new TextBox();
static TextBox surName = new TextBox();
static DialogBox box;
// public newCandidatePop() {
// box = buildNewElecPopup();
// }
static public DialogBox buildNewElecPopup() {
DialogBox box = new DialogBox();
box.setAutoHideEnabled(true);
box.setText("Add a New Candidate");
box.setAnimationEnabled(true);
box.setGlassEnabled(true);
Grid dialogGrid = new Grid(2, 3);
dialogGrid.setPixelSize(250 , 125);
dialogGrid.setCellPadding(10);
dialogGrid.setWidget(0, 0, new HTML("<strong>First Name</strong>"));
dialogGrid.setWidget(0, 1, firstName);
dialogGrid.setWidget(1, 0, new HTML("<strong>Surname</strong>"));
dialogGrid.setWidget(1, 1, surName);
box.add(dialogGrid);
return box;
}