[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[ve-dev] Setting converConstraint method in LayoutHelper
|
Title: Setting converConstraint method in LayoutHelper
Hi All,
I am trying to implement a layout that is similar to xylayout in V.E. I have a constraint object that defines x,y,width, height for the component. How do I go about changing the existing border layout to the layout that I require. As suggested by one of the developers . I picked up border layout , because it accept a constraint object. I am finding it hard to implement the edit policy and the helper. Can anybody help me with the ' convertConstraint ' method of the helper class. The code excerpt from that method is as follows.
protected IJavaObjectInstance convertConstraint(Object constraint)
{
if (constraint instanceof String)
{
int ndx = REAL_INTERNAL_TAGS.indexOf(constraint);
return (IJavaObjectInstance) (ndx > -1 ?
BeanUtilities.createJavaObject("java.lang.String", getContainer().eResource().getResourceSet(), CODEGEN_TAGS[ndx]) :
// $NONS-NLS-1 $ //$NON-NLS-1$
BeanUtilities.createString(getContainer().eResource().getResourceSet(), (String) constraint));
}
else
return null;
}
Here the constraint is a String object. Hence the BeanUtilities object was able to set that constraint directly. I am not able to find a way how to set my constraint object similarly. As of now I am able to get the following code when I drag and drop a component from palette.
Container.add(component, new MyConstraints());
How do I add parameters to MyConstraint object? So that It looks as follows.
Container.add(component, new MyConstraints(0,0,30,40));
Thank in Advance,
Rashmi H.Ramachandra