FailureNode.java
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 package org.gecode.explorer.cocoa;
00010
00011 import com.apple.cocoa.foundation.*;
00012 import com.apple.cocoa.application.*;
00013
00014
00015 public class FailureNode extends Node {
00016
00017 private static NSBezierPath bezierPath;
00018 private static NSColor insideColor;
00019 private static NSColor borderColor;
00020
00021 private static int myUnit = (int) (unit / ((Math.sqrt(2) + 1) / 2));
00022 private static int myHalfUnit = myUnit / 2;
00023 private static int myDown = (unit - myUnit) / 2;
00024
00025 private static NSPoint p1 = new NSPoint(- myHalfUnit, myDown);
00026 private static NSPoint p2 = new NSPoint( myHalfUnit, myDown);
00027 private static NSPoint p3 = new NSPoint( myHalfUnit, myUnit + myDown);
00028 private static NSPoint p4 = new NSPoint(- myHalfUnit, myUnit + myDown);
00029
00030 static {
00031 bezierPath = new NSBezierPath();
00032 bezierPath.moveToPoint(p1);
00033 bezierPath.lineToPoint(p2);
00034 bezierPath.lineToPoint(p3);
00035 bezierPath.lineToPoint(p4);
00036 bezierPath.lineToPoint(p1);
00037 bezierPath.closePath();
00038 insideColor = getDefaultColor("FailureInside");
00039 borderColor = getDefaultColor("FailureBorder");
00040 }
00041
00042 public FailureNode() {
00043 super();
00044 }
00045
00046 public NSBezierPath getBezierPath() {
00047 return bezierPath;
00048 }
00049
00050 public NSColor getInsideColor() {
00051 return insideColor;
00052 }
00053
00054 public NSColor getBorderColor() {
00055 return borderColor;
00056 }
00057
00058 public NSPoint getTopConnector() {
00059 return new NSPoint(0, myDown);
00060 }
00061
00062 public NSPoint getBotConnector() {
00063 return new NSPoint(0, myUnit + myDown);
00064 }
00065
00066 }