public SVGGraphNode()

in taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphNode.java [116:217]


	public SVGGraphNode(SVGGraphController graphController) {
		super(graphController);
		this.graphController = graphController;
		mouseClickAction = new SVGMouseClickEventListener(this);
		mouseDownAction = new SVGMouseDownEventListener(this);
		mouseMovedAction = new SVGMouseMovedEventListener(this);
		mouseOverAction = new SVGMouseOverEventListener(this);
		mouseOutAction = new SVGMouseOutEventListener(this);

		mainGroup = graphController.createGElem();
		mainGroup.setAttribute("alignment-baseline", SVG_MIDDLE_VALUE);
		mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE, CSS_BLACK_VALUE);
		mainGroup.setAttribute(SVG_STROKE_DASHARRAY_ATTRIBUTE, CSS_NONE_VALUE);
		mainGroup.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "1");
		mainGroup.setAttribute(SVG_FILL_ATTRIBUTE, CSS_NONE_VALUE);

		EventTarget t = (EventTarget) mainGroup;
		t.addEventListener(SVG_CLICK_EVENT_TYPE, mouseClickAction, false);
		t.addEventListener(SVG_MOUSEMOVE_EVENT_TYPE, mouseMovedAction, false);
		t.addEventListener(SVG_MOUSEDOWN_EVENT_TYPE, mouseDownAction, false);
//		t.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, mouseOverAction, false);
//		t.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, mouseOutAction, false);

		expandedElement = graphController.createGElem();
		contractedElement = graphController.createGElem();

		portsGroup = graphController.createGElem();
		portsGroup.setAttribute(CSS_DISPLAY_PROPERTY, CSS_NONE_VALUE);
		contractedElement.appendChild(portsGroup);

		mainGroup.appendChild(contractedElement);

		polygon = graphController.createPolygon();
		contractedElement.appendChild(polygon);

		ellipse = graphController.createEllipse();
		ellipse.setAttribute(CSS_DISPLAY_PROPERTY, CSS_NONE_VALUE);
		ellipse.setAttribute(SVG_RX_ATTRIBUTE, String.valueOf(2));
		ellipse.setAttribute(SVG_CX_ATTRIBUTE, String.valueOf(0));
		ellipse.setAttribute(SVG_RY_ATTRIBUTE, String.valueOf(2));
		ellipse.setAttribute(SVG_CY_ATTRIBUTE, String.valueOf(0));
		contractedElement.appendChild(ellipse);

		completedPolygon = graphController.createPolygon();
		completedPolygon.setAttribute(SVG_POINTS_ATTRIBUTE,
				calculatePoints(getShape(), 0, 0));
		completedPolygon.setAttribute(SVG_FILL_ATTRIBUTE, COMPLETED_COLOUR);
		completedPolygon.setAttribute(SVG_FILL_OPACITY_ATTRIBUTE, "0.8");
		contractedElement.appendChild(completedPolygon);

		labelText = graphController.createText("");
		label = graphController.createText(labelText);
		label.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_MIDDLE_VALUE);
		label.setAttribute("baseline-shift", "-35%");
		label.setAttribute(SVG_FILL_ATTRIBUTE, CSS_BLACK_VALUE);
		label.setAttribute(SVG_STROKE_ATTRIBUTE, SVGConstants.SVG_NONE_VALUE);
		labelGroup = graphController.createGElem();
		labelGroup.appendChild(label);
		contractedElement.appendChild(labelGroup);

		iterationText = graphController.createText("");
		iteration = graphController.createText(iterationText);
		iteration.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_END_VALUE);
		iteration.setAttribute(SVG_FONT_SIZE_ATTRIBUTE, "6");
		iteration.setAttribute(SVG_FONT_FAMILY_ATTRIBUTE, "sans-serif");
		iteration.setAttribute(SVG_FILL_ATTRIBUTE, CSS_BLACK_VALUE);
		iteration.setAttribute(SVG_STROKE_ATTRIBUTE, SVG_NONE_VALUE);
		contractedElement.appendChild(iteration);

		errorsText = graphController.createText("");
		error = graphController.createText(errorsText);
		error.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_END_VALUE);
		error.setAttribute(SVG_FONT_SIZE_ATTRIBUTE, "6");
		error.setAttribute(SVG_FONT_FAMILY_ATTRIBUTE, "sans-serif");
		error.setAttribute(SVG_FILL_ATTRIBUTE, CSSConstants.CSS_BLACK_VALUE);
		error.setAttribute(SVG_STROKE_ATTRIBUTE, SVG_NONE_VALUE);
		contractedElement.appendChild(error);

		// deleteButton = createDeleteButton();
		// g.appendChild(deleteButton);

		animateShape = createAnimationElement(graphController, SVG_ANIMATE_TAG,
				SVG_POINTS_ATTRIBUTE, null);

		animatePosition = createAnimationElement(graphController,
				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
				TRANSFORM_TRANSLATE);

		animateLabel = SVGUtil.createAnimationElement(graphController,
				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
				TRANSFORM_TRANSLATE);

		animateIteration = createAnimationElement(graphController,
				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
				TRANSFORM_TRANSLATE);

		animateErrors = createAnimationElement(graphController,
				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
				TRANSFORM_TRANSLATE);

		delegate = new SVGGraphElementDelegate(graphController, this, mainGroup);
	}