diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/FlowCellEditor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/FlowCellEditor.java new file mode 100644 index 0000000..c0d6b1a --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/FlowCellEditor.java @@ -0,0 +1,45 @@ +package application.editor; + +import java.util.EventObject; + +import com.mxgraph.swing.mxGraphComponent; +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; + } + + /************************************************************* + * [ *public ] + /************************************************************* + * + */ + public Object getEditingCell() { + return this.editingCell; + } + + /************************************************************* + * + */ + abstract public void startEditing(Object cellObj, EventObject eventObj); + + /************************************************************* + * + */ + abstract public void stopEditing(boolean cancel); +} diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/IStageChangeListener.java b/AlgebraicDataflowArchitectureModel/src/application/editor/IStageChangeListener.java new file mode 100644 index 0000000..ee00c5f --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/IStageChangeListener.java @@ -0,0 +1,5 @@ +package application.editor; + +public interface IStageChangeListener { + public void stageChanged(Stage newStage); +} diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/Stage.java b/AlgebraicDataflowArchitectureModel/src/application/editor/Stage.java new file mode 100644 index 0000000..4fd5193 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/Stage.java @@ -0,0 +1,51 @@ +package application.editor; + +import com.mxgraph.swing.mxGraphComponent; +import com.mxgraph.swing.view.mxICellEditor; +import com.mxgraph.util.mxEventSource.mxIEventListener; +import com.mxgraph.view.mxGraph; +import models.dataFlowModel.DataTransferModel; + +import java.awt.event.MouseListener; + +abstract public class Stage { + protected DataTransferModel model = null; + protected mxGraphComponent graphComponent = null; + protected mxGraph graph = null; + public static final int NODE_LAYER = 0; + public static final int DATA_FLOW_LAYER = 0; + public static final int PUSH_FLOW_LAYER = 1; + public static final int PULL_FLOW_LAYER = 2; + + public Stage(mxGraphComponent graphComponent) { + this.graphComponent = graphComponent; + this.graph = graphComponent.getGraph(); + } + + public DataTransferModel getModel() { + return model; + } + + abstract public boolean canChangeFrom(Stage prevStage); + + abstract public void init(Stage prevStage); + + abstract public mxICellEditor createCellEditor(mxGraphComponent graphComponent); + + abstract public mxIEventListener createChangeEventListener(Editor editor); + + abstract public MouseListener createMouseEventListener(Editor editor); + + public void setEnabledForLayer(final int layerNo, final boolean isEnable) { + // TODO Implement + } + + /** + * Showing layers are specified number of layers. + * + * @param argsOfLayers you want to show numbers of layers. + */ + public void showOnlyLayer(final int... argsOfLayers) { + // TODO Implement + } +} diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/DataFlowCellEditor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/DataFlowCellEditor.java new file mode 100644 index 0000000..e0aa2da --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/DataFlowCellEditor.java @@ -0,0 +1,22 @@ +package application.editor.stages; + +import application.editor.FlowCellEditor; +import com.mxgraph.swing.mxGraphComponent; + +import java.util.EventObject; + +public class DataFlowCellEditor extends FlowCellEditor { + + public DataFlowCellEditor(DataFlowModelingStage stage, mxGraphComponent graphComponent) { + super(stage, graphComponent); + } + + @Override + public void startEditing(Object cellObj, EventObject eventObj) { + // TODO Implement + } + + @Override + public void stopEditing(boolean cancel) { + } +} diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/DataFlowModelingStage.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/DataFlowModelingStage.java new file mode 100644 index 0000000..46e1784 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/DataFlowModelingStage.java @@ -0,0 +1,114 @@ +package application.editor.stages; + +import application.editor.Editor; +import application.editor.FlowCellEditor; +import application.editor.Stage; +import com.mxgraph.model.mxCell; +import com.mxgraph.swing.mxGraphComponent; +import com.mxgraph.util.mxEventSource.mxIEventListener; +import com.mxgraph.view.mxGraph; +import models.dataConstraintModel.ResourcePath; +import models.dataFlowModel.DataTransferChannel; +import models.dataFlowModel.DataTransferModel; +import models.visualModel.FormulaChannel; + +import java.awt.event.MouseListener; + +public class DataFlowModelingStage extends Stage { + public int PORT_DIAMETER = 8; + public int PORT_RADIUS = PORT_DIAMETER / 2; + + private boolean bReflectingArchitectureModel = false; + + public DataFlowModelingStage(mxGraphComponent graphComponent) { + super(graphComponent); + } + + @Override + public boolean canChangeFrom(Stage prevStage) { + return true; + } + + @Override + public void init(Stage prevStage) { + // TODO Implement + } + + @Override + public FlowCellEditor createCellEditor(mxGraphComponent graphComponent) { + return new DataFlowCellEditor(this, graphComponent); + } + + @Override + public mxIEventListener createChangeEventListener(Editor editor) { + // TODO Implement + return null; + } + + @Override + public MouseListener createMouseEventListener(Editor editor) { + return null; + } + + /** + * mxGraphのレイヤーを全てクリアする. + */ + public void clear() { + // TODO Implement + } + + public DataTransferModel getModel() { + // TODO Implement + return null; + } + + public void setModel(DataTransferModel model) { + // TODO Implement + } + + public boolean isValid() { + // TODO Implement + return true; + } + + /** + * Construct a mxGraph from DataFlowModel + * + * @param model + * @param graph + * @return constructed mxGraph + */ + public mxGraph constructGraph(mxGraph graph, DataTransferModel model) { + // TODO Implement + return null; + } + + public void addResourcePath(ResourcePath res) { + // TODO Implement + } + + public void addChannel(DataTransferChannel channelGen) { + // TODO Implement + } + + public void addIOChannel(DataTransferChannel ioChannelGen) { + // TODO Implement + } + + public void addFormulaChannel(FormulaChannel formulaChannelGen) { + // TODO Implement + } + + public boolean connectEdge(mxCell edge, mxCell src, mxCell dst) { + // TODO Implement + return true; + } + + public void delete() { + // TODO Implement + } + + public void setChannelCode(DataTransferChannel ch, String code) { + // TODO Implement + } +} diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/PushPullSelectionCellEditor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/PushPullSelectionCellEditor.java new file mode 100644 index 0000000..f98ce7d --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/PushPullSelectionCellEditor.java @@ -0,0 +1,48 @@ +package application.editor.stages; + +import application.editor.FlowCellEditor; +import com.mxgraph.swing.mxGraphComponent; +import com.mxgraph.view.mxCellState; + +import javax.swing.*; +import java.awt.*; +import java.util.EventObject; + +public class PushPullSelectionCellEditor extends FlowCellEditor { + public int DEFAULT_MIN_WIDTH = 70; + public int DEFAULT_MIN_HEIGHT = 30; + public double DEFAULT_MINIMUM_EDITOR_SCALE = 1; + + protected double minimumEditorScale = DEFAULT_MINIMUM_EDITOR_SCALE; + protected int minimumWidth = DEFAULT_MIN_WIDTH; + protected int minimumHeight = DEFAULT_MIN_HEIGHT; + + private EventObject trigger; + private JComboBox comboBox; + + public PushPullSelectionCellEditor(PushPullSelectionStage stage, mxGraphComponent graphComponent) { + super(stage, graphComponent); + } + + @Override + public void startEditing(Object cellObj, EventObject eventObj) { + // TODO Implement + } + + @Override + public void stopEditing(boolean cancel) { + // TODO Implement + } + + public String getCurrentValue() { + return (String) comboBox.getSelectedItem(); + } + + /** + * Returns the bounds to be used for the editor. + */ + public Rectangle getEditorBounds(mxCellState state, double scale) { + // TODO Implement + return null; + } +} diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/PushPullSelectionStage.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/PushPullSelectionStage.java new file mode 100644 index 0000000..20b608a --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/PushPullSelectionStage.java @@ -0,0 +1,60 @@ +package application.editor.stages; + +import application.editor.Editor; +import application.editor.FlowCellEditor; +import application.editor.Stage; +import com.mxgraph.swing.mxGraphComponent; +import com.mxgraph.util.mxEventSource.mxIEventListener; +import com.mxgraph.view.mxGraph; +import models.dataFlowModel.DataFlowGraph; +import models.dataFlowModel.DataTransferModel; + +import java.awt.event.MouseListener; + +public class PushPullSelectionStage extends Stage { + protected DataFlowGraph dataFlowGraph = null; + + public PushPullSelectionStage(mxGraphComponent graphComponent) { + super(graphComponent); + } + + @Override + public boolean canChangeFrom(Stage prevStage) { + // TODO Implement + return false; + } + + @Override + public void init(Stage prevStage) { + // TODO Implement + } + + @Override + public FlowCellEditor createCellEditor(mxGraphComponent graphComponent) { + return new PushPullSelectionCellEditor(this, graphComponent); + } + + @Override + public mxIEventListener createChangeEventListener(Editor editor) { + // TODO Implement + return null; + } + + @Override + public MouseListener createMouseEventListener(Editor editor) { + return null; + } + + public DataFlowGraph getDataFlowGraph() { + return dataFlowGraph; + } + + public DataFlowGraph analyzeDataTransferModel(mxGraph graph, DataTransferModel model) { + // TODO Implement + return null; + } + + private void updateEdgeAttributes(mxGraph graph, DataFlowGraph dataFlowGraph) { + // TODO Implement + } +}