How to access the Model (Bean) Properties within VE Rendering Process [message #118980] |
Sat, 25 February 2006 17:55 |
Eclipse User |
|
|
|
Originally posted by: yoshtec.gmx.net
Hello VE'lers,
I created a plugin for Eclipse based on the VE CustomWidget Tutorial
(org.eclipse.ve.example.customwidget) and I have two questions right now:
1. Even if I define that the Label should be somewhere else it always
stays at the very same position. Let's take a look at the code for clarity:
public class SomeEditPart extends ComponentGraphicalEditPart {
public SwingWidgetEditPart(Object model) {
super(model);
}
protected IFigure createFigure() {
IFigure figure = super.createFigure();
Label customFigure = new Label("SomeText");
customFigure.setForegroundColor(ColorConstants.red);
//XXX: Now here is the Problem, even if I tell him to put some
// other constant it will not move!
customFigure.setTextPlacement(PositionConstants.ALWAYS_RIGHT );
customFigure.setFont(((GraphicalEditPart)getParent()).getFig ure().getFont());
//XXX: Here I tried something like figure.getSize(),
// but it is always (0,0), even though displayed
// correctly with a size bigger than (0,0) later on.
customFigure.setSize(customFigure.getPreferredSize());
//XXX: I also tried to put a constraint here but
// found out by debugging through the code that
// the constraint is never used.
figure.add(customFigure);
return figure;
}
}
2. How can I access at this Point some other value of the Bean currently
in rendering?
For instance a extended JTextField Bean has a new field named Text2 and
it should be displayed by the code above at 1. during the drawing in VE
but not during Runtime itself. So i tried to have a look at
this.getModel() which will return a JavaObjectInstance Object somehow
encapsulating the Bean (or its class). Debugging the whole thing I
found deeply in the Tree of the model Variable a hint of the Property
Value (cause I entered "FINDME" and clicked so long until I found it).
Nevertheless I couldn't find the Property Name nor some way to find it
automatically.
It would be very nice to hear your ideas.
Nice Greetings
Jonas
PS.: The Head in the CVS tree is not anymore compatible with Eclipse 3.1
and VE 1.1, maybe you should note that in the tutorial!
|
|
|
Powered by
FUDForum. Page generated in 0.02338 seconds