[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [ve-dev] Help with generating complex constraint objects
|
Thanks.
(My target platform is Eclipse 3.2 and VE 1.2. Development platform
is Callisto 3.2RC3.)
Next question is how to provide arguments to constructors as
generated. I am able to automatically generate this code on a
layoutswitch:
private
JPanel getJPanel() {
- if
(jPanel == null) {
- FormLayout formLayout =
new FormLayout();
- formLayout.setRowGroups(
new int[][] {});
- formLayout.setColumnGroups(
new int[][] {});
- jPanel
= new JPanel();
- jPanel
.setLayout(formLayout);
- jPanel
.add(getJButton1(), new CellConstraints());
- jPanel
.add(getJButton2(), new CellConstraints());
}
return jPanel;
}
However, ...
The FormLayout signature as generated needs to be "new FormLayout(String, String)"
The CellConstratins signature as generated needs to be "new CellConstraints(int, int, int, int)"
I am currently following the pattern of GridLayoutSwitcher to specify the form layout manager and create the "setRowGroups/setColumnGroups" initializers. Not obvious how to also specify constructor arguments.
BoxLayout appears to be able to specify constructor arguments, but I have not succeeded in tracing through the source to see how it is done.
A pointer to the right place in the code to look and/or an explanation of the right methods to use would be appreciated.
Gerald
At 05:46 PM 5/31/2006, you wrote:
Hi,
Sorry, but the current code parsing doesn't understand method calls to anything other than getControl().getName() for the constraint argument in the add call. It only understands the getName() against a component and field references and literals like String and numbers and new class creation calls.
So if you change to instead of your format to (Note: This is in VE 1.2. I don't know if this works in VE 1.1, we made many changes since then):
jPanel.add(getJButton1(), new CellConstraint(1,1))
we would be able to parse and understand this, assuming the FormLayout you created would take a "CellConstraint" as a constraint.
You can open an enhancement request against VE to allow method calls there instead.
Rich