diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/literals/LayoutLiterals.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/literals/LayoutLiterals.java index 240398a7bad68e90239e30db6aa43bc0be6fcfdb..42f969508b79043f6edc1c78630f4f2fda9c0c13 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/literals/LayoutLiterals.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/literals/LayoutLiterals.java @@ -27,12 +27,14 @@ public class LayoutLiterals { * (1) the color of text or<br> * (2) the color of lines or<br> * (3) the color of backgrounds or<br> - * (4) the color of graphiti shapes shadows + * (4) the color of graphiti shapes shadows or<br> + * (5) the color of constraint texts and connections */ public static final IColorConstant COLOR_TEXT = IColorConstant.BLACK, COLOR_LINES = IColorConstant.BLACK, COLOR_BACKGROUND = IColorConstant.WHITE, - COLOR_SHADOW = IColorConstant.GRAY; + COLOR_SHADOW = IColorConstant.GRAY, + COLOR_CONSTRAINTS = IColorConstant.DARK_GRAY; /** * layout integer for wizards diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/FeatureManager.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/FeatureManager.java index 520629847372e471d4be164008aa96ebac0a13b4..de08e5c2ecfde4cb81115234ce3f1f3158b9d0bd 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/FeatureManager.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/FeatureManager.java @@ -5,6 +5,11 @@ import java.util.Map; import org.framed.iorm.ui.literals.NameLiterals; +/** + * This static class is used to get information about when and where a feature with a specific name + * is shown in the palette. + * @author Kevin Kassin + */ public class FeatureManager { /** @@ -37,25 +42,36 @@ public class FeatureManager { RELATIONSHIP_IMPLICATION_FEATURE_NAME = NameLiterals.RELATIONSHIP_IMPLICATION_FEATURE_NAME, RELATIONSHIP_EXCLUSION_FEATURE_NAME = NameLiterals.RELATIONSHIP_EXCLUSION_FEATURE_NAME; - //TODO k�rzel + /** + * simple short forms of the palette categories to make code more readable + */ private static PaletteCategory entities = PaletteCategory.ENTITIES_CATEGORY, properties = PaletteCategory.PROPERTIES_CATEGORY, relations = PaletteCategory.RELATIONS_CATEGORY, constraints = PaletteCategory.CONSTRAINTS_CATEGORY, none = PaletteCategory.NONE; - + /** + * simple short forms of the view visibility to make code more readable + */ private static ViewVisibility all = ViewVisibility.ALL_VIEWS, top = ViewVisibility.TOPLEVEL_VIEW, compartment = ViewVisibility.COMPARTMENT_VIEW, no_view = ViewVisibility.NO_VIEW; - - //TODO + /** + * the map that saves when and where a feature with a specific name is shown in the palette + */ public static Map<String, FeaturePaletteDescriptor> features = createFeatureCategoryMap(); /** - * TODO - * Step 1 features in none of the categories + * creates the map that saves when and where a feature with a specific name is shown in the palette + * using the following steps: + * <p> + * Step 1: features shown in none of the categories<br> + * Step 2: features shown in the category "Entities"<br> + * Step 3: features shown in the category "Properties"<br> + * Step 4: features shown in the category "Relations"<br> + * Step 5: features shown in the category "Constraints"<br> * @return */ private static Map<String, FeaturePaletteDescriptor> createFeatureCategoryMap() { diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/FeaturePaletteDescriptor.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/FeaturePaletteDescriptor.java index f0ffdf211a72ba216f8505b51836f6b65813079e..3bb3fcef066a28501ea3aafb81045e0a641ca0dd 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/FeaturePaletteDescriptor.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/FeaturePaletteDescriptor.java @@ -1,10 +1,24 @@ package org.framed.iorm.ui.palette; +/** + * An object of this class describes when and where to show a feature in the palette. + * @author Kevin Kassin + */ public class FeaturePaletteDescriptor { + /** + * in which category to show a feature in the palette + */ public PaletteCategory paletteCategory = PaletteCategory.NONE; + + /** + * depending on the current palette view when to show the feature in the palette + */ public ViewVisibility viewVisibility = ViewVisibility.NO_VIEW; + /** + * Class constructor + */ public FeaturePaletteDescriptor(PaletteCategory paletteCategory, ViewVisibility viewVisibility) { this.paletteCategory = paletteCategory; this.viewVisibility = viewVisibility; diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/PaletteCategory.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/PaletteCategory.java index 20f776408eece0c78393727a7ebe913d642e5397..2e8690f48e37250f2ee2b6b1ba58870491665569 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/PaletteCategory.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/PaletteCategory.java @@ -1,5 +1,12 @@ package org.framed.iorm.ui.palette; +import org.framed.iorm.ui.providers.ToolBehaviorProvider; //*import for javadoc link + +/** + * This enum creates possible values to save in which category to show a feature in the palette. It is used in + * {@link FeatureManager} and the {@link ToolBehaviorProvider}. + * @author Kevin Kassin + */ public enum PaletteCategory { ENTITIES_CATEGORY, diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/PaletteView.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/PaletteView.java index fc74c8caba9f207be0e5f8aab4d0ecb9c33b16c4..79420462cfac7312a6738959a1a6b15efd1f5930 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/PaletteView.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/PaletteView.java @@ -1,5 +1,9 @@ package org.framed.iorm.ui.palette; +/** + * This enumeration offers values for the palette views. + * @author Kevin Kassin + */ public enum PaletteView { TOPLEVEL_VIEW, diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/ViewVisibility.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/ViewVisibility.java index d91966e2da2992fa676b64ac537574868d5c5ef3..a201bedb544b88f7739272eefc6538766932874a 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/ViewVisibility.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/palette/ViewVisibility.java @@ -1,5 +1,12 @@ package org.framed.iorm.ui.palette; +import org.framed.iorm.ui.providers.ToolBehaviorProvider; //*import for javadoc link + +/** + * This enum creates possible values to save in which palette view to show a feature in the palette. It is used in + * {@link FeatureManager} and the {@link ToolBehaviorProvider}. + * @author Kevin Kassin + */ public enum ViewVisibility { ALL_VIEWS, diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/interrelationship/AbstractInterRelationshipConstraintPattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/interrelationship/AbstractInterRelationshipConstraintPattern.java index efe3878eef312e432dd62d027285c9b388239ae1..07b8cfd3b669af667a12174e19d01c4cda8048ec 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/interrelationship/AbstractInterRelationshipConstraintPattern.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/interrelationship/AbstractInterRelationshipConstraintPattern.java @@ -43,7 +43,7 @@ public class AbstractInterRelationshipConstraintPattern extends FRaMEDConnection /** * the color values used for the polyline and the arrowhead gathered from {@link LayoutLiterals} */ - protected final IColorConstant COLOR_CONNECTIONS = LayoutLiterals.COLOR_CONNECTIONS, + protected final IColorConstant COLOR_CONSTRAINTS = LayoutLiterals.COLOR_CONSTRAINTS, COLOR_ARROWHEAD = LayoutLiterals.COLOR_ARROWHEAD; /** @@ -92,7 +92,7 @@ public class AbstractInterRelationshipConstraintPattern extends FRaMEDConnection connection.setStart(graphicalSourceAnchor); connection.setEnd(graphicalTargetAnchor); Polyline polyline = graphicAlgorithmService.createPolyline(connection); - polyline.setForeground(manageColor(COLOR_CONNECTIONS)); + polyline.setForeground(manageColor(COLOR_CONSTRAINTS)); polyline.setLineStyle(LineStyle.DASH); polyline.setLineWidth(2); return connection; diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/interrelationship/RelationshipExclusionConstraintPattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/interrelationship/RelationshipExclusionConstraintPattern.java index 846df58d00092db1c59baf5cb18db07be74d6c25..266944f0fa2490813862cafebe016ff24829f285 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/interrelationship/RelationshipExclusionConstraintPattern.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/interrelationship/RelationshipExclusionConstraintPattern.java @@ -95,13 +95,13 @@ public class RelationshipExclusionConstraintPattern extends AbstractInterRelatio 0, -1*ARROWHEAD_HEIGHT };//P3 Polyline polylineTarget = graphicAlgorithmService.createPolyline(connectionDecoratorTarget, points); polylineTarget.setLineWidth(2); - polylineTarget.setForeground(manageColor(COLOR_CONNECTIONS)); + polylineTarget.setForeground(manageColor(COLOR_CONSTRAINTS)); PropertyUtil.setShape_IdValue(connectionDecoratorTarget, SHAPE_ID_INTER_REL_CON); ConnectionDecorator connectionDecoratorSource = pictogramElementCreateService.createConnectionDecorator(connection, false, 0, true); Polyline polylineSource = graphicAlgorithmService.createPolyline(connectionDecoratorSource, points); polylineSource.setLineWidth(2); - polylineSource.setForeground(manageColor(COLOR_CONNECTIONS)); + polylineSource.setForeground(manageColor(COLOR_CONSTRAINTS)); PropertyUtil.setShape_IdValue(connectionDecoratorSource, SHAPE_ID_INTER_REL_CON); //Step 4 link(connection, addedRoleImplication); diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/interrelationship/RelationshipImplicationConstraintPattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/interrelationship/RelationshipImplicationConstraintPattern.java index 7da329d12e41cf9ca813dabb4db53155044c1517..20e5cb1c1c900b2944b65c04962321e14b973db5 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/interrelationship/RelationshipImplicationConstraintPattern.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/interrelationship/RelationshipImplicationConstraintPattern.java @@ -94,7 +94,7 @@ public class RelationshipImplicationConstraintPattern extends AbstractInterRelat 0, 0, //P2 -1*ARROWHEAD_LENGTH, -1*ARROWHEAD_HEIGHT }; //P3 Polygon arrowhead = graphicAlgorithmService.createPolygon(connectionDecorator, points); - arrowhead.setForeground(manageColor(COLOR_CONNECTIONS)); + arrowhead.setForeground(manageColor(COLOR_CONSTRAINTS)); arrowhead.setBackground(manageColor(COLOR_ARROWHEAD)); PropertyUtil.setShape_IdValue(connectionDecorator, SHAPE_ID_INTER_REL_CON); //Step 4 diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/intrarelationship/AbstractIntraRelationshipConstraintPattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/intrarelationship/AbstractIntraRelationshipConstraintPattern.java index f59089fe2001c044e8c4fd0e41b360eb12bdaf29..b73550607a108540f5df754b3f4fc0643f14d919 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/intrarelationship/AbstractIntraRelationshipConstraintPattern.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/intrarelationship/AbstractIntraRelationshipConstraintPattern.java @@ -51,7 +51,7 @@ public abstract class AbstractIntraRelationshipConstraintPattern extends FRaMEDS * the color values gathered from {@link LayoutLiterals} */ protected static final IColorConstant COLOR_CONNECTIONS = LayoutLiterals.COLOR_CONNECTIONS, - COLOR_TEXT = LayoutLiterals.COLOR_TEXT; + COLOR_CONSTRAINTS = LayoutLiterals.COLOR_CONSTRAINTS; /** * layout integers gathered from {@link LayoutLiterals} @@ -141,8 +141,7 @@ public abstract class AbstractIntraRelationshipConstraintPattern extends FRaMEDS ConnectionDecorator constraintName = pictogramElementCreateService.createConnectionDecorator(targetConnection, true, 0.5, true); Text nameText = graphicAlgorithmService.createText(constraintName, type.getName().toLowerCase()); - nameText.setForeground(manageColor(COLOR_TEXT)); - nameText.setFont(manageFont("Arial", 10, false, true)); + nameText.setForeground(manageColor(COLOR_CONSTRAINTS)); PropertyUtil.setShape_IdValue(constraintName, SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR); link(constraintName, addContext.getNewObject()); return constraintName; diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/providers/ToolBehaviorProvider.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/providers/ToolBehaviorProvider.java index 4a24b62c1af06c786bd115e61da2706806207bf8..2f6d5550684e25831d5f686431b2a1a4dd7af2de 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/providers/ToolBehaviorProvider.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/providers/ToolBehaviorProvider.java @@ -86,11 +86,13 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{ */ private PaletteView paletteView = PaletteView.TOPLEVEL_VIEW; - //TODO - PaletteCompartmentEntry entityCategory = new PaletteCompartmentEntry(ENTITIES_PALETTE_CATEGORY_NAME, null); - PaletteCompartmentEntry propertiesCategory = new PaletteCompartmentEntry(PROPERTIES_PALETTE_CATEGORY_NAME, null); - PaletteCompartmentEntry relationsCategory = new PaletteCompartmentEntry(RELATIONS_PALETTE_CATEGORY_NAME, null); - PaletteCompartmentEntry constraintsCategory = new PaletteCompartmentEntry(CONSTRAINTS_PALETTE_CATEGORY_NAME, null); + /** + * the categories of the palette + */ + PaletteCompartmentEntry entityCategory, + propertiesCategory, + relationsCategory, + constraintsCategory; /** * Class constructor @@ -199,7 +201,11 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{ * builds the palette of the editor using the following steps * <p> * Step 1: It creates the different palette categories.<br> - * Step 2: It add create shape features to the correct categories according to the {@link FeatureManager} + * Step 2: It adds create shape features to the correct categories according to the {@link FeatureManager} + * using the operation {@link #addShapeFeature}.<br> + * Step 3: It adds create connection features to the correct categories according to the {@link FeatureManager} + * using the operation {@link #addConnectionFeature}.<br> + * Step 4: It adds the categories with the added features to the palette. */ @Override public IPaletteCompartmentEntry[] getPalette() { @@ -209,12 +215,15 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{ propertiesCategory = new PaletteCompartmentEntry(PROPERTIES_PALETTE_CATEGORY_NAME, null); relationsCategory = new PaletteCompartmentEntry(RELATIONS_PALETTE_CATEGORY_NAME, null); constraintsCategory = new PaletteCompartmentEntry(CONSTRAINTS_PALETTE_CATEGORY_NAME, null); + //Step 2 for(ICreateFeature feature : getFeatureProvider().getCreateFeatures()) { addShapeFeature(feature); } + //Step 3 for(ICreateConnectionFeature feature : getFeatureProvider().getCreateConnectionFeatures()) { addConnectionFeature(feature); } + //Step 4 pallete.add(entityCategory); pallete.add(propertiesCategory); pallete.add(relationsCategory); @@ -222,6 +231,13 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{ return pallete.toArray(new IPaletteCompartmentEntry[pallete.size()]); } + /** + * adds a shape feature to a palette category if wanted + * <p> + * It uses the {@link FeaturePaletteDescriptor} of the feature to calculate if and where to add the + * feature. + * @param feature the feature to probably add to the palette + */ private void addShapeFeature(ICreateFeature feature) { FeaturePaletteDescriptor fpd = FeatureManager.features.get(feature.getCreateName()); if(fpd == null) throw new FeatureHasNoPaletteDescriptorException(feature.getCreateName()); @@ -251,6 +267,13 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{ break; } } } + /** + * adds a connection feature to a palette category if wanted + * <p> + * It uses the {@link FeaturePaletteDescriptor} of the feature to calculate if and where to add the + * feature. + * @param feature the feature to probably add to the palette + */ private void addConnectionFeature(ICreateConnectionFeature feature) { FeaturePaletteDescriptor fpd = FeatureManager.features.get(feature.getCreateName()); if(fpd == null) throw new FeatureHasNoPaletteDescriptorException(feature.getCreateName());