PDA

View Full Version : TableLayoutBuilder Question



afida
Nov 11th, 2004, 04:06 AM
I have form which looks like


Label TextField Label TexField
Label TextField Label TexField
Label TextField Label TexField

couple of questions,
1. How do I change the Col Gap between "TextField Label" for the whole form?
2. I have a Text field with browse button next to it,


Label TextField Label TexField
Label TextField Button Label TexField
Label TextField Label TexField

How do I make TextField Button align with column width, I mean I would like it to look like


Label TextxxxxxxxField Label TexField
Label TextField Button Label TexField
Label TextxxxxxxxField Label TexField

Thanks

Amad

oliverhutchison
Nov 11th, 2004, 04:35 PM
Post your code and I'll have a look. There's some changes I've been meaning to make to TableLayoutBuilder which may help here.

Ollie

afida
Nov 11th, 2004, 10:31 PM
Post your code and I'll have a look.

Here it is,



protected JComponent createFormControl() {

TableFormBuilder formBuilder = new TableFormBuilder(getFormModel());

businessUnitNameField = formBuilder.add("businessUnitName")[1];
formBuilder.add("mainPhone");
formBuilder.row();

parentBusinessUnitNameField = (JTextField)formBuilder.add("parentBusinessUnitName")[1];
// formBuilder.getLayoutBuilder().gapCol();
formBuilder.getLayoutBuilder().cell(getBusinessUni tListButton());
formBuilder.add("otherPhone");

formBuilder.row();
formBuilder.add("division");
formBuilder.add("fax");

formBuilder.row();
formBuilder.add("website");
formBuilder.add("email");

formBuilder.getLayoutBuilder().unrelatedGapRow();
formBuilder.addSeparator("Address");
formBuilder.row();
formBuilder.add("street1");
formBuilder.add("stateOrProvince");

formBuilder.row();
formBuilder.add("street2");
formBuilder.add("zipOrPostalCode");

formBuilder.row();
formBuilder.add("street3");
formBuilder.add("countryOrRegion");

formBuilder.row();
formBuilder.add("city", "colSpan=1");
return formBuilder.getForm();
}

oliverhutchison
Nov 12th, 2004, 12:06 AM
Ok

I've just commited some small changes so you may have to wait a bit before you can see them.

The folowing should do the trick:


formBuilder.add("businessUnitName", "colGrId=ctrColumn");
formBuilder.getLayoutBuilder().unrelatedGapCol();
formBuilder.add("mainPhone", "colGrId=ctrColumn");
formBuilder.row();

businessUnitNameField = getFormModel().createBoundControl("parentBusinessUnitName")
TableLayoutBuilder subPanel = new TableLayoutBuilder();
subPanel.cell(businessUnitNameField );
subPanel.gapCol();
subPanel.cell(getBusinessUnitListButton());
formBuilder.add("parentBusinessUnitName", subPanel.getPanel())
formBuilder.add("otherPhone");


It's easier to put the button in a seperate panel you could use col span to do it all but it makes things much more complicated.

Ollie