blob: 96f8fd05c88172382d1cdc04c327981e712f4412 [file] [log] [blame]
//------------------------------------------------------------------------------
// Copyright (c) 2005, 2007 IBM Corporation and others.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// IBM Corporation - initial implementation
//------------------------------------------------------------------------------
package org.eclipse.epf.diagram.ad.edit.parts;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.epf.diagram.ad.edit.policies.ActivityPartitionPartitionCampartment2CanonicalEditPolicy;
import org.eclipse.epf.diagram.ad.edit.policies.ActivityPartitionPartitionCampartment2ItemSemanticEditPolicy;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
*/
public class ActivityPartitionPartitionCampartment2EditPart extends
ShapeCompartmentEditPart {
/**
* @generated
*/
public static final int VISUAL_ID = 5002;
/**
* @generated
*/
public ActivityPartitionPartitionCampartment2EditPart(View view) {
super(view);
}
/**
* @modified
*/
public String getCompartmentName() {
return ""; //$NON-NLS-1$
}
/**
* @generated
*/
public IFigure createFigure() {
ResizableCompartmentFigure result = (ResizableCompartmentFigure) super
.createFigure();
result.setTitleVisibility(false);
return result;
}
/**
* @generated
*/
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(
EditPolicyRoles.SEMANTIC_ROLE,
new ActivityPartitionPartitionCampartment2ItemSemanticEditPolicy());
installEditPolicy(EditPolicyRoles.CREATION_ROLE,
new CreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,
new DragDropEditPolicy());
installEditPolicy(EditPolicyRoles.CANONICAL_ROLE,
new ActivityPartitionPartitionCampartment2CanonicalEditPolicy());
}
/**
* @generated
*/
//public IFigure createFigure() {
// IFigure result = super.createFigure();
// result.setBorder(new LineBorder());
// return result;
//}
/**
* @generated
*/
protected void refreshVisuals() {
super.refreshVisuals();
refreshBounds();
}
/**
* @generated
*/
protected void handleNotificationEvent(Notification notification) {
super.handleNotificationEvent(notification);
Object feature = notification.getFeature();
if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
|| NotationPackage.eINSTANCE.getSize_Height().equals(feature)
|| NotationPackage.eINSTANCE.getLocation_X().equals(feature)
|| NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
refreshBounds();
}
}
/**
* @generated
*/
protected void refreshBounds() {
int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE
.getLocation_X())).intValue();
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE
.getLocation_Y())).intValue();
int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE
.getSize_Width())).intValue();
int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE
.getSize_Height())).intValue();
((GraphicalEditPart) getParent()).setLayoutConstraint(this,
getFigure(), new Rectangle(x, y, width, height));
}
/**
* @generated
*/
protected void setRatio(Double ratio) {
// nothing to do -- parent layout does not accept Double constraints as ratio
// super.setRatio(ratio);
}
}