Figures not visible [message #541354] |
Sun, 20 June 2010 08:10  |
Eclipse User |
|
|
|
Hi,
I am trying to create an graphical editor with a simple model, a single class stores the type of figure to be displayed. In the createFigure() I return a figure depending on the type in the model. When I open a file with the editoe though, nothing is displayed, there are no error messages logged either.
public class ContentModel {
List _shapes = new ArrayList();
public List getShapes() {
return _shapes;
}
public void setShapes(List shapes) {
_shapes = shapes;
}
public class ShapeModel implements Serializable{
private static final long serialVersionUID = -7303239549506441257L;
private String _type;
public String getType() {
return _type;
}
public void setType(String type) {
_type = type;
}
}
public class ShapesEditPart extends AbstractGraphicalEditPart implements
NodeEditPart {
String RECT_TYPE = "RECTANGLE";
String CIRC_TYPE = "CIRCLE";
/* (non-Javadoc)
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFi gure()
*/
@Override
protected IFigure createFigure() {
ShapeModel model = (ShapeModel)getModel();
IFigure figure;
if(RECT_TYPE.equals(model.getType())){
figure = new RectangleFigure();
} else {
figure = new Ellipse();
}
figure.setOpaque(true);
return figure;
}
...
}
Thanks in advance for your help
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.25402 seconds