diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingStageStatus.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingStageStatus.java new file mode 100644 index 0000000..7a82d68 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingStageStatus.java @@ -0,0 +1,7 @@ +package application.editor.stages; + +public enum ControlFlowModelingStageStatus { + SELECTING_AN_EDGE, // いずれかのエッジを選ぼうとしている状態(Idle状態) + SHOWING_DELEGATABLE_NODES, // CFD適用可能範囲を表示している状態 + SHOWING_DEPENDABLE_NODES // DoM適用可能範囲を表示している状態 +} diff --git a/AlgebraicDataflowArchitectureModel/src/models/controlFlowModel/ObjectNodeAttribute.java b/AlgebraicDataflowArchitectureModel/src/models/controlFlowModel/ObjectNodeAttribute.java new file mode 100644 index 0000000..8aa9730 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/src/models/controlFlowModel/ObjectNodeAttribute.java @@ -0,0 +1,90 @@ +package models.controlFlowModel; + +import models.NodeAttribute; + +/** + * {@link ObjectNodeAttribute} represents an attribute that the linked object node in a control-flow graph has. + */ +public class ObjectNodeAttribute extends NodeAttribute { + private ObjectNode objectNode = null; + private String shapeStyle = ""; + + public ObjectNodeAttribute(final ObjectNode objectNode) { + this.objectNode = objectNode; + this.objectNode.setAttribute(this); + + // Setting a shape style of cell + if (objectNode instanceof StatefulObjectNode) { + shapeStyle = "shape=ellipse;perimeter=ellipsePerimeter;"; + } else if (objectNode instanceof EventChannelObjectNode) { + shapeStyle = "shape=rectangle;perimeter=rectanglePerimeter;"; + } else { + shapeStyle = "shape=hexagon;perimeter=hexagonPerimeter;"; + } + + // Setting a name of a cell + if (objectNode.name != null) return; +// if (objectNode.name.isEmpty()) return; + + if (objectNode instanceof StatefulObjectNode) { + objectNode.name = objectNode.getName(); + } else if (objectNode instanceof EventChannelObjectNode) { + objectNode.name = "entryPoint"; + } + } + + /** + * Get an object node that the attribute is linked to. + * + * @return an object node that the attribute is linked to. + */ + public ObjectNode getObjectNode() { + return objectNode; + } + + public String getDefaultStyle() { + String style = ";"; + + return shapeStyle + style; + } + + /** + * Get the color of a selected cell. + */ + public String getEnableStyle() { + String style = "fillColor=#7fffd4;"; + style += "strokeColor=#66cdaa;"; + style += "strokeWidth=2;"; + + return shapeStyle + style; + } + + /** + * Get the color of an unselected cell. + */ + public String getDisableStyle() { + String style = "fillColor=#999999"; + + return shapeStyle + style; + } + + /** + * Get the color of a cell that can be delegated. + */ + public String getDelegatingStyle() { + String style = "strokeWidth=4;"; + style += "strokeColor=#4169e;"; + + return shapeStyle + style; + } + + /** + * Get the cell's name that displayed on GUI + */ + @Override + public String toString() { + return objectNode instanceof StatefulObjectNode + ? ((StatefulObjectNode) objectNode).getResource().getResourceName() + : objectNode.getName(); + } +}