Skip to content

Commit

Permalink
#Commit 7.8 18:00
Browse files Browse the repository at this point in the history
set up double click feature for compartment types and groups to step in,
fixed bugs concering the reset layout feature,
made the text color of intra relationship constraints darker,
fixed concerning the edit relationship feature
  • Loading branch information
Kevin Kassin authored and Kevin Kassin committed Aug 7, 2017
1 parent cc0d743 commit 543aa8c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions org.framed.iorm.model.edit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public class EditRelationshipFeature extends AbstractCustomFeature {
* values for property shape id of the connection decorators of the relationship
*/
private final String SHAPE_ID_RELATIONSHIP_NAME_DECORATOR = IdentifierLiterals.SHAPE_ID_RELATIONSHIP_NAME_DECORATOR,
SHAPE_ID_RELATIONSHIP_SOURCE_CARDINALITY_DECORATOR = IdentifierLiterals.SHAPE_ID_RELATIONSHIP_SOURCE_CARDINALITY_DECORATOR,
SHAPE_ID_RELATIONSHIP_TARGET_CARDINALITY_DECORATOR = IdentifierLiterals.SHAPE_ID_RELATIONSHIP_TARGET_CARDINALITY_DECORATOR;
SHAPE_ID_RELATIONSHIP_SOURCE_CARDINALITY_DECORATOR = IdentifierLiterals.SHAPE_ID_RELATIONSHIP_SOURCE_CARDINALITY_DECORATOR,
SHAPE_ID_RELATIONSHIP_TARGET_CARDINALITY_DECORATOR = IdentifierLiterals.SHAPE_ID_RELATIONSHIP_TARGET_CARDINALITY_DECORATOR;

/**
* Class constructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature {
private final String SHAPE_ID_ROLETYPE_OCCURRENCE_CONSTRAINT = IdentifierLiterals.SHAPE_ID_ROLETYPE_OCCURRENCE_CONSTRAINT,
SHAPE_ID_ROLETYPE_TYPEBODY = IdentifierLiterals.SHAPE_ID_ROLETYPE_TYPEBODY,
SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR = IdentifierLiterals.SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR,
SHAPE_ID_RELATIONSHIP_ANCHOR_DECORATOR = IdentifierLiterals.SHAPE_ID_RELATIONSHIP_ANCHOR_DECORATOR,
SHAPE_ID_FULFILLMENT_ROLES = IdentifierLiterals.SHAPE_ID_FULFILLMENT_ROLES;

/**
Expand Down Expand Up @@ -100,7 +101,7 @@ public void execute(ICustomContext customContext) {
if(relation.getType() == Type.FULFILLMENT)
executeForFulfillment(customContext);
}
if(businessObject instanceof Shape) {
if(businessObject instanceof org.framed.iorm.model.Shape) {
org.framed.iorm.model.Shape shape = (org.framed.iorm.model.Shape) businessObject;
if(shape.getType() == Type.ROLE_TYPE)
executeForRoleType(customContext);
Expand All @@ -120,8 +121,11 @@ private void executeForRelationship(ICustomContext customContext) {
graphicAlgorithmService.setLocation(decorator.getGraphicsAlgorithm(), DISTANCE_FROM_CONNECTION_LINE, intraRelConsAdded*HEIGHT_CONSTRAINT);
intraRelConsAdded++;
} else {
graphicAlgorithmService.setLocation(decorator.getGraphicsAlgorithm(), DISTANCE_FROM_CONNECTION_LINE, -1*DISTANCE_FROM_CONNECTION_LINE);
} } }
if(PropertyUtil.isShape_IdValue(decorator, SHAPE_ID_RELATIONSHIP_ANCHOR_DECORATOR)) {
graphicAlgorithmService.setLocation(decorator.getGraphicsAlgorithm(), 0, 0);
} else {
graphicAlgorithmService.setLocation(decorator.getGraphicsAlgorithm(), DISTANCE_FROM_CONNECTION_LINE, -1*DISTANCE_FROM_CONNECTION_LINE);
} } } }

/**
* executes the feature for the fulfillments
Expand Down Expand Up @@ -154,6 +158,7 @@ private FreeFormConnection getConnectionForContext(ICustomContext customContext)
* executes the feature for the role types
*/
private void executeForRoleType(ICustomContext customContext) {
System.out.println("AS");
ContainerShape containerShape = ((Shape) customContext.getPictogramElements()[0]).getContainer();
Shape typeBodyShape = null, occurenceConstraintShape = null;
for(Shape shape : containerShape.getChildren()) {
Expand All @@ -164,7 +169,6 @@ private void executeForRoleType(ICustomContext customContext) {
}
if(typeBodyShape != null && occurenceConstraintShape != null) {
RoundedRectangle typeBodyRectangle = (RoundedRectangle) typeBodyShape.getGraphicsAlgorithm();
System.out.println(typeBodyRectangle.getX()+typeBodyRectangle.getWidth()/2-HEIGHT_CONSTRAINT/2);
graphicAlgorithmService.setLocation(occurenceConstraintShape.getGraphicsAlgorithm(),
typeBodyRectangle.getX()+typeBodyRectangle.getWidth()/2-HEIGHT_CONSTRAINT/2,
typeBodyRectangle.getY()-HEIGHT_CONSTRAINT-PUFFER_BETWEEN_ELEMENTS);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.framed.iorm.ui.literals;

import org.eclipse.graphiti.util.ColorConstant;
import org.eclipse.graphiti.util.IColorConstant;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;
Expand Down Expand Up @@ -41,7 +42,7 @@ public class LayoutLiterals {
* (1) the color of constraint texts or<br>
* (2) the color of constraint connections
*/
public static final IColorConstant COLOR_CONSTRAINT_TEXT = IColorConstant.DARK_GRAY,
public static final IColorConstant COLOR_CONSTRAINT_TEXT = new ColorConstant(48, 48, 48),
COLOR_CONSTRAINT_CONNECTION = IColorConstant.GRAY;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.framed.iorm.ui.util.GeneralUtil;
import org.framed.iorm.ui.util.PropertyUtil;
import org.framed.iorm.ui.providers.FeatureProvider; //*import for javadoc link
import org.framed.iorm.model.ModelElement;
import org.framed.iorm.model.Relation;
import org.framed.iorm.model.Type;
import org.framed.iorm.ui.exceptions.FeatureHasNoPaletteDescriptorException;
Expand Down Expand Up @@ -350,12 +351,17 @@ public ICustomFeature getDoubleClickFeature(IDoubleClickContext context) {
if(context.getPictogramElements().length == 1) {
PictogramElement pictogramElement = context.getPictogramElements()[0];
EObject businessObject = GeneralUtil.getBusinessObjectIfExactlyOne(pictogramElement);
ICustomFeature[] customFeatures = getFeatureProvider().getCustomFeatures(context);
if(businessObject instanceof Relation) {
ICustomFeature[] customFeatures = getFeatureProvider().getCustomFeatures(context);
if(((Relation) businessObject).getType() == Type.RELATIONSHIP)
return (ICustomFeature) GeneralUtil.findFeatureByName(customFeatures, EDIT_RELATIONSHIP_FEATURE_NAME);
if(((Relation) businessObject).getType() == Type.FULFILLMENT)
return (ICustomFeature) GeneralUtil.findFeatureByName(customFeatures, EDIT_FULFILLMENT_FEATURE_NAME);
}
if(businessObject instanceof org.framed.iorm.model.Shape) {
if(((ModelElement) businessObject).getType() == Type.COMPARTMENT_TYPE ||
((ModelElement) businessObject).getType() == Type.GROUP)
return (ICustomFeature) GeneralUtil.findFeatureByName(customFeatures, STEP_IN_FEATURE_NAME);
} }
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public EditRelationshipDialog(Shell parentShell, Diagram diagram, Relation busin
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(EDIT_RELATIONSHIP_FEATURE_NAME + " " + businessObject.getName());
newShell.setSize(HEIGHT_EDIT_RELATIONSHIP_DIALOG, WIDTH_EDIT_RELATIONSHIP_DIALOG);
newShell.setSize(WIDTH_EDIT_RELATIONSHIP_DIALOG, HEIGHT_EDIT_RELATIONSHIP_DIALOG);
}

/**
Expand Down

0 comments on commit 543aa8c

Please sign in to comment.