/*
 * Copyright 2015 Ryan Gilera.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.daytron.revworks.event;

import com.github.daytron.revworks.model.ClassTable;
import com.github.daytron.revworks.ui.AdminLoginPopup;
import com.vaadin.ui.OptionGroup;
import com.vaadin.ui.PasswordField;
import com.vaadin.ui.RichTextArea;
import com.vaadin.ui.TextField;

/**
 * Collection events for Guava's EventBus as inner classes
 *
 * @author Ryan Gilera
 */
public abstract class AppEvent {

    public static final class UserLoginRequestEvent {

        private final OptionGroup userTypeOptionGroup;
        private final TextField userField;
        private final PasswordField passwordField;

        public UserLoginRequestEvent(TextField userField,
                PasswordField passwordField,
                OptionGroup userType) {
            this.userTypeOptionGroup = userType;
            this.userField = userField;
            this.passwordField = passwordField;
        }

        public OptionGroup getUserTypeOptionGroup() {
            return userTypeOptionGroup;
        }

        public TextField getUserField() {
            return userField;
        }

        public PasswordField getPasswordField() {
            return passwordField;
        }

    }

    public static final class AdminLoginRequestEvent {

        private final TextField userField;
        private final PasswordField passwordField;
        private final AdminLoginPopup adminLoginPopup;

        public AdminLoginRequestEvent(TextField userField,
                PasswordField passwordField,
                AdminLoginPopup adminLoginPopup) {
            this.userField = userField;
            this.passwordField = passwordField;
            this.adminLoginPopup = adminLoginPopup;
        }

        public PasswordField getPasswordField() {
            return passwordField;
        }

        public TextField getUserField() {
            return userField;
        }

        public AdminLoginPopup getAdminLoginPopup() {
            return adminLoginPopup;
        }

    }

    public static final class UserLogoutRequestEvent {
    }

    public static final class WebmasterLinkClickEvent {
    }

    public static final class OptionChangeValueEvent {

        private final TextField usernameField;
        private final String value;

        public OptionChangeValueEvent(TextField userField, String value) {
            this.usernameField = userField;
            this.value = value;
        }

        public TextField getUsernameField() {
            return usernameField;
        }

        public String getValue() {
            return value;
        }

    }

    public static final class LecturerSubmitNewAnnouncementEvent {

        private final ClassTable selectedClass;
        private final TextField title;
        private final RichTextArea richTextArea;

        public LecturerSubmitNewAnnouncementEvent(ClassTable selectedClass,
                TextField title, RichTextArea richTextArea) {
            this.selectedClass = selectedClass;
            this.title = title;
            this.richTextArea = richTextArea;
        }

        public ClassTable getSelectedClass() {
            return selectedClass;
        }

        public TextField getTitle() {
            return title;
        }
        
        public RichTextArea getRichTextArea() {
            return richTextArea;
        }

    }

}

@@ -878,16 +878,37 @@
 xtField;
+%0Aimport java.io.File;
 %0A%0A/**%0A *
@@ -3855,24 +3855,16 @@
       %7D%0A
-        
 %0A       
@@ -3955,10 +3955,705 @@
 %0A    %7D%0A%0A
+    public static final class StudentSubmitCourseworkEvent %7B%0A%0A        private final File courseworkFile;%0A        private final ClassTable classTable;%0A        private final String title;%0A%0A        public StudentSubmitCourseworkEvent(File courseworkFile,%0A                ClassTable classTable, String title) %7B%0A            this.courseworkFile = courseworkFile;%0A            this.classTable = classTable;%0A            this.title = title;%0A        %7D%0A%0A        public File getCourseworkFile() %7B%0A            return courseworkFile;%0A        %7D%0A%0A        public ClassTable getClassTable() %7B%0A            return classTable;%0A        %7D%0A%0A        public String getTitle() %7B%0A            return title;%0A        %7D%0A%0A    %7D%0A%0A
 %7D%0A

Add custom event for coursework submission