diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/FlowCellEditor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/FlowCellEditor.java index cd39823..24f98e3 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/FlowCellEditor.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/FlowCellEditor.java @@ -6,15 +6,40 @@ import com.mxgraph.swing.view.mxICellEditor; abstract public class FlowCellEditor implements mxICellEditor { + protected Stage stage = null; protected mxGraphComponent graphComponent = null; - + + protected Object editingCell = null; + + /************************************************************* + * [ *constructor] + /************************************************************* + * + * @param stage + * @param graphComponent + */ protected FlowCellEditor(Stage stage, mxGraphComponent graphComponent) { this.stage = stage; this.graphComponent = graphComponent; } - abstract public Object getEditingCell(); + /************************************************************* + * [ *public ] + /************************************************************* + * + */ + public Object getEditingCell() { + return this.editingCell; + } + + /************************************************************* + * + */ abstract public void startEditing(Object arg0, EventObject arg1); - abstract public void stopEditing(boolean arg0); + + /************************************************************* + * + */ + abstract public void stopEditing(boolean cancel); } diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowDelegationCellEditor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowDelegationCellEditor.java index 813ef2e..609aeaf 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowDelegationCellEditor.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowDelegationCellEditor.java @@ -9,12 +9,9 @@ public class ControlFlowDelegationCellEditor extends FlowCellEditor { - private mxGraphComponent graphComponent = null; - private Object editingCell = null; - - /**-------------------------------------------------------------------------------- + /************************************************************* * [ *constructor ] - /*-------------------------------------------------------------------------------- + /************************************************************* * * @param graph */ @@ -22,18 +19,9 @@ super(stage, graphComponent); } - /**-------------------------------------------------------------------------------- + /************************************************************* * [ *public ] - /*-------------------------------------------------------------------------------- - * - * @param graph - */ - @Override - public Object getEditingCell() { - return editingCell; - } - - /*-------------------------------------------------------------------------------- + /************************************************************* * */ @Override @@ -41,15 +29,16 @@ if( editingCell != null) stopEditing(true); if( graphComponent.getGraph().getModel().isEdge(cellObj) ) { - System.err.println("Edge: " + cellObj.toString()); + System.out.println("Edge: " + cellObj.toString()); } + } - /*-------------------------------------------------------------------------------- + /************************************************************* * */ @Override - public void stopEditing(boolean arg0) { + public void stopEditing(boolean cancel) { } diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowDelegationStage.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowDelegationStage.java index 4ded42d..a2d2f87 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowDelegationStage.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowDelegationStage.java @@ -3,33 +3,18 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import java.util.HashMap; -import java.util.Map; import com.mxgraph.model.mxCell; -import com.mxgraph.model.mxGeometry; -import com.mxgraph.model.mxGraphModel; import com.mxgraph.swing.mxGraphComponent; import com.mxgraph.swing.mxGraphComponent.mxGraphControl; -import com.mxgraph.swing.view.mxICellEditor; -import com.mxgraph.util.mxConstants; -import com.mxgraph.util.mxPoint; import com.mxgraph.view.mxGraph; -import application.editor.Editor; -import application.editor.Stage; -import application.editor.Editor.SrcDstAttribute; import application.editor.FlowCellEditor; -import models.Edge; -import models.Node; -import models.controlFlowModel.CallEdge; +import application.editor.Stage; import models.controlFlowModel.ControlFlowGraph; -import models.controlFlowModel.ObjectNode; import models.controlFlowModel.StatefulObjectNode; -import models.dataConstraintModel.ChannelGenerator; import models.dataConstraintModel.IdentifierTemplate; import models.dataFlowModel.DataFlowGraph; -import models.dataFlowModel.DataTransferChannelGenerator; import models.dataFlowModel.DataTransferModel; import models.dataFlowModel.ResourceNode; diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/DataFlowCellEditor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/DataFlowCellEditor.java index 0dfe0b4..9b400d8 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/DataFlowCellEditor.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/DataFlowCellEditor.java @@ -34,6 +34,9 @@ import parser.Parser.TokenStream; import parser.exceptions.ExpectedRightBracket; +/************************************************************* + * + */ public class DataFlowCellEditor extends FlowCellEditor { public int DEFAULT_MIN_WIDTH = 70; public int DEFAULT_MIN_HEIGHT = 30; @@ -43,29 +46,35 @@ protected int minimumWidth = DEFAULT_MIN_WIDTH; protected int minimumHeight = DEFAULT_MIN_HEIGHT; - private Object editingCell; private EventObject trigger; private JComboBox comboBox; + /************************************************************* + * [ *constructor ] + /************************************************************* + * + * @param stage + * @param graphComponent + */ public DataFlowCellEditor(DataFlowModelingStage stage, mxGraphComponent graphComponent) { super(stage, graphComponent); } + /************************************************************* + * + * @param cellObj + * @param eventObj + */ @Override - public Object getEditingCell() { - return editingCell; - } - - @Override - public void startEditing(Object cell, EventObject evt) { + public void startEditing(Object cellObj, EventObject eventObj) { if (editingCell != null) { stopEditing(true); } - if (!graphComponent.getGraph().getModel().isEdge(cell)) { - DataTransferChannelGenerator ch = (DataTransferChannelGenerator) stage.getModel().getChannelGenerator((String) ((mxCell) cell).getValue()); + if (!graphComponent.getGraph().getModel().isEdge(cellObj)) { + DataTransferChannelGenerator ch = (DataTransferChannelGenerator) stage.getModel().getChannelGenerator((String) ((mxCell) cellObj).getValue()); if (ch == null) { - ch = (DataTransferChannelGenerator) stage.getModel().getIOChannelGenerator((String) ((mxCell) cell).getValue()); + ch = (DataTransferChannelGenerator) stage.getModel().getIOChannelGenerator((String) ((mxCell) cellObj).getValue()); if(ch == null) { //resource return; @@ -139,13 +148,13 @@ return; } - mxCellState state = graphComponent.getGraph().getView().getState(cell); + mxCellState state = graphComponent.getGraph().getView().getState(cellObj); if (state != null && state.getLabel() != null && !state.getLabel().equals("")) { - editingCell = cell; - trigger = evt; + editingCell = cellObj; + trigger = eventObj; double scale = Math.max(minimumEditorScale, graphComponent.getGraph().getView().getScale()); - Object value = graphComponent.getGraph().getModel().getValue(cell); + Object value = graphComponent.getGraph().getModel().getValue(cellObj); if (value != null && value instanceof PushPullAttribute) { PushPullAttribute attr = (PushPullAttribute) value; comboBox = new JComboBox<>(attr.getOptionStrings()); @@ -159,6 +168,10 @@ } } + /************************************************************* + * + * @param cancel + */ @Override public void stopEditing(boolean cancel) { if (editingCell != null) { diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/PushPullSelectionCellEditor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/PushPullSelectionCellEditor.java index 86180c0..c25855b 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/PushPullSelectionCellEditor.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/PushPullSelectionCellEditor.java @@ -1,33 +1,39 @@ package application.editor.stages; import java.util.EventObject; - import com.mxgraph.swing.mxGraphComponent; - import application.editor.FlowCellEditor; +/************************************************************* + * + */ public class PushPullSelectionCellEditor extends FlowCellEditor { + /************************************************************* + * [ *constructor ] + /************************************************************* + * @param stage + * @param graphComponent + */ public PushPullSelectionCellEditor(PushPullSelectionStage stage, mxGraphComponent graphComponent) { super(stage, graphComponent); } - + + /************************************************************* + * + * @param cellObj + * @param eventObj + */ @Override - public Object getEditingCell() { - // TODO Auto-generated method stub - return null; + public void startEditing(Object cellObj, EventObject eventObj) { } + /************************************************************* + * + * @param cancel + */ @Override - public void startEditing(Object arg0, EventObject arg1) { - // TODO Auto-generated method stub - - } - - @Override - public void stopEditing(boolean arg0) { - // TODO Auto-generated method stub - + public void stopEditing(boolean cancel) { } }