public void updateAutoSize(CellView view) {
if (view != null && !isEditing()) {
Rectangle2D bounds = (view.getAttributes() != null) ? GraphConstants
.getBounds(view.getAttributes())
: null;
AttributeMap attrs = getModel().getAttributes(view.getCell());
if (bounds == null)
bounds = GraphConstants.getBounds(attrs);
if (bounds != null) {
boolean autosize = GraphConstants.isAutoSize(view
.getAllAttributes());
boolean resize = GraphConstants.isResize(view
.getAllAttributes());
if (autosize || resize) {
Dimension2D d = getUI().getPreferredSize(this, view);
bounds.setFrame(bounds.getX(), bounds.getY(), d.getWidth(),
d.getHeight());
// Remove resize attribute
snap(bounds);
if (resize) {
if (view.getAttributes() != null)
view.getAttributes().remove(GraphConstants.RESIZE);
attrs.remove(GraphConstants.RESIZE);
}
view.refresh(getGraphLayoutCache(), getGraphLayoutCache(), false);
}
}
}