public Block addBlock(String name, String type, String info) { Block newBlock; if (type.Equals("repeating")) newBlock = new RepeatingBlock(name, info); else if (type.Equals("single")) newBlock = new SingleBlock(name, info); else if (type.Equals("optional")) newBlock = new OptionalBlock(name, info); else if (type.Equals("dependent")) newBlock = new DependBlock(name, info); else return null; data.AddLast(newBlock); return newBlock; }
public void drawData(OptionalBlock data) { createLabel(data.getName(), "A block that may or may not appear depending on the condition."); Label conditionLabel = new Label(); conditionLabel.Text = " -? " + data.getCondition(); conditionLabel.Size = nodeLabelSize; conditionLabel.Location = new Point(nodeSize.Width + initialLeft + structureDepth * nodeSize.Width / 3, initialHeight + structureIndex * nodeSize.Height); conditionLabel.Font = new Font("Arial", 10, FontStyle.Bold); p_view.Controls.Add(conditionLabel); structureDepth++; foreach (Data child in data.getChildren()) { structureIndex++; child.drawData(this); } structureDepth--; }