package lectures.animation.threads.wait_notify;
import util.annotations.WebDocuments;
import util.models.AListenableVector;
import lectures.animation.threads_commands.ConcurrentShuttleLaunchAnimation;
import lectures.animation.threads_commands.ShuttleAnimator;
import lectures.composite.objects_shapes.PlottedShuttle;
import lectures.inheritance.AnInheritingStringSet;
import lectures.inheritance.extra.AnObservableStringSet;
import lectures.mvc.properties.AnObservablePlottedShuttle;
import bus.uigen.OEFrame;
import bus.uigen.ObjectEditor;
import bus.uigen.attributes.AttributeNames;
@WebDocuments({"Lectures/AnimationThreadsWaitNotify.pptx", "Lectures/AnimationThreadsWaitNotify.pdf", "Videos/AnimationThreadsWaitNotify.avi"})
public class ManualShuttleTrafficControl extends ConcurrentShuttleLaunchAnimation {
public final static int ANIMATOR_FRAME_HEIGHT = 125;
public final static int CONTROL_FRAME_WIDTH = 250;
public final static int CONTROL_FRAME_HEIGHT = 180;
static int animatorNumber;
public static void displayShuttleAnimator(ShuttleAnimator shuttleAnimator1) {
OEFrame frame = ObjectEditor.edit(shuttleAnimator1);
frame.setLocation(START_FRAME_X + (animatorNumber * SHUTTLE_FRAME_WIDTH), START_FRAME_Y + SHUTTLE_FRAME_HEIGHT);
frame.setSize(SHUTTLE_FRAME_WIDTH, ANIMATOR_FRAME_HEIGHT);
animatorNumber++;
}
public static void displayControlFrame(Object aController) {
ObjectEditor.setPropertyAttribute(AListenableVector.class, "element", AttributeNames.COMPONENT_WIDTH, CONTROL_FRAME_WIDTH);
OEFrame frame = ObjectEditor.edit(aController);
frame.setLocation(START_FRAME_X, START_FRAME_Y + SHUTTLE_FRAME_HEIGHT/2);
frame.setSize(CONTROL_FRAME_WIDTH, CONTROL_FRAME_HEIGHT);
}
public static void main(String[] args) {
ClearanceManager aClearanceManager = ClearanceManagerFactory.getClearanceManager();
PlottedShuttle shuttle1 = new AnObservablePlottedShuttle(SHUTTLE1_X, SHUTTLE1_Y);
displayShuttleFrame(shuttle1);
ShuttleAnimator shuttleAnimator1 = new AShuttleAnimatorWatitingForClearance(shuttle1, aClearanceManager);
displayShuttleAnimator(shuttleAnimator1);
PlottedShuttle shuttle2 = new AnObservablePlottedShuttle(SHUTTLE2_X, SHUTTLE2_Y);
displayShuttleFrame(shuttle2);
ShuttleAnimator shuttleAnimator2 = new AShuttleAnimatorWatitingForClearance(shuttle2, aClearanceManager);
displayShuttleAnimator(shuttleAnimator2);
displayControlFrame(aClearanceManager);
}
}