Class ReportBugBuilder

  • All Implemented Interfaces:
    DialogDefaultsInterface, java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.ItemListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

    public class ReportBugBuilder
    extends JDialogBase
    implements java.awt.event.WindowListener
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ReportBugBuilder.BugType  
      • Nested classes/interfaces inherited from class javax.swing.JDialog

        javax.swing.JDialog.AccessibleJDialog
      • Nested classes/interfaces inherited from class java.awt.Dialog

        java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
      • Nested classes/interfaces inherited from class java.awt.Window

        java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.swing.JTextArea attachedImages
      Text are for displaying the attached images
      private java.lang.String attachmentName
      Name of the image being attached.
      private javax.swing.JFileChooser browser
      File chooser for the user to select an existing file for attachment
      private static java.lang.String BUG_MAIL_URL
      URL of the page we use to actually send the bug report email.
      private javax.swing.JComboBox bugTypeComboBox  
      private javax.swing.JTextPane descriptionField
      Text pane for user inputed bug description
      private javax.swing.JTextField directory
      Text field for the directory of a file being attached from the user's computer
      private javax.swing.JTextField emailField
      Text field for user inputed email
      private java.util.ArrayList<java.lang.String> fileNames
      ArrayList of all file names of report attachments
      private java.util.ArrayList<java.lang.String> filePaths
      ArrayList of all file paths of report attachments
      private javax.swing.JFrame frame
      Frame for the GUI in which the form is presented
      private java.io.File image
      Image file used to store images created through the screen capture function
      private boolean isScreenCapAttached
      Hack-ish boolean to avoid double adding screen captures to the attachment list.
      private javax.swing.JTextField nameField
      Text field for user inputed name
      javax.swing.JButton screenCap
      Button to launch the create new image dialog
      private JDialogCaptureScreen screenCapture
      Dialog used for taking screen captures
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      private javax.swing.JTextField standardOS
      Text field for the user inputed operating system.
      private javax.swing.JTextField standardUrgency
      Text field for the user inputed urgency of the bug
      private javax.swing.JTextField standardVersion
      Text field for the user inputed mipav version.
      private javax.swing.JTextField summaryField
      Text area for user inputed bug title
      • Fields inherited from class javax.swing.JDialog

        accessibleContext, rootPane, rootPaneCheckingEnabled
      • Fields inherited from class java.awt.Dialog

        DEFAULT_MODALITY_TYPE
      • Fields inherited from class java.awt.Component

        BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • Fields inherited from interface javax.swing.WindowConstants

        DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
    • Constructor Summary

      Constructors 
      Constructor Description
      ReportBugBuilder()
      Initializes the GUI and then deletes the created files once the program has finished running
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent event)
      Performs the following actions based on the command:
      OK - Initializes pertinent fields, checking that all fields are filled out correctly, before sending the information to be processed for an email Cancel - cleans up and disposes the dialog Other - sends event to secondary method that looks for combobox events
      static java.lang.String compileReport​(java.lang.String summary, java.lang.String name, java.lang.String email, java.lang.String version, java.lang.String os, java.lang.String urgency, java.lang.String description)
      Pulls system specifications from the user's computer and then compiles all appropriate fields together into a text document
      private void displayReportForm()
      Initializes GUI.
      static java.lang.String getEmailDefault()  
      static java.lang.String getNameDefault()  
      static java.lang.String getUrgencyDefault()  
      private void init()
      Creates a JFrame asking if the user is a developer and then runs the method displayReportForm, which displays the appropriate form for the selected type.
      private void loadFieldDefaults()
      Tries to set the bug report field defaults based on system properties or last-entered data.
      private void saveFieldDefaults()
      Saves the last-entered bug report field text for loading the next time the dialog is used.
      static void sendReportWeb​(java.lang.String summary, java.lang.String name, java.lang.String email, java.lang.String version, java.lang.String os, java.lang.String urgency, java.lang.String description, ReportBugBuilder.BugType bugType, java.util.ArrayList<java.lang.String> filePaths, java.util.ArrayList<java.lang.String> fileNames)  
      void windowClosed​(java.awt.event.WindowEvent event)
      Performs the following actions based on the command:
      OK - creates a file using the currently selected image and the given file name and then attaches it to email Insert - inserts the image into the description area and if a name is provided, attaches the image as a file as well
      • Methods inherited from class javax.swing.JDialog

        addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • Methods inherited from class java.awt.Dialog

        addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBack
      • Methods inherited from class java.awt.Window

        addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.awt.event.WindowListener

        windowActivated, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • frame

        private javax.swing.JFrame frame
        Frame for the GUI in which the form is presented
      • attachedImages

        private final javax.swing.JTextArea attachedImages
        Text are for displaying the attached images
      • descriptionField

        private final javax.swing.JTextPane descriptionField
        Text pane for user inputed bug description
      • summaryField

        private final javax.swing.JTextField summaryField
        Text area for user inputed bug title
      • nameField

        private final javax.swing.JTextField nameField
        Text field for user inputed name
      • emailField

        private final javax.swing.JTextField emailField
        Text field for user inputed email
      • standardOS

        private final javax.swing.JTextField standardOS
        Text field for the user inputed operating system.
      • standardVersion

        private final javax.swing.JTextField standardVersion
        Text field for the user inputed mipav version.
      • standardUrgency

        private final javax.swing.JTextField standardUrgency
        Text field for the user inputed urgency of the bug
      • bugTypeComboBox

        private javax.swing.JComboBox bugTypeComboBox
      • attachmentName

        private java.lang.String attachmentName
        Name of the image being attached.
      • fileNames

        private final java.util.ArrayList<java.lang.String> fileNames
        ArrayList of all file names of report attachments
      • directory

        private javax.swing.JTextField directory
        Text field for the directory of a file being attached from the user's computer
      • browser

        private javax.swing.JFileChooser browser
        File chooser for the user to select an existing file for attachment
      • filePaths

        private final java.util.ArrayList<java.lang.String> filePaths
        ArrayList of all file paths of report attachments
      • screenCap

        public javax.swing.JButton screenCap
        Button to launch the create new image dialog
      • image

        private java.io.File image
        Image file used to store images created through the screen capture function
      • isScreenCapAttached

        private boolean isScreenCapAttached
        Hack-ish boolean to avoid double adding screen captures to the attachment list.
      • BUG_MAIL_URL

        private static final java.lang.String BUG_MAIL_URL
        URL of the page we use to actually send the bug report email.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ReportBugBuilder

        public ReportBugBuilder()
        Initializes the GUI and then deletes the created files once the program has finished running
    • Method Detail

      • init

        private void init()
        Creates a JFrame asking if the user is a developer and then runs the method displayReportForm, which displays the appropriate form for the selected type.
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent event)
        Performs the following actions based on the command:
        • OK - Initializes pertinent fields, checking that all fields are filled out correctly, before sending the information to be processed for an email
        • Cancel - cleans up and disposes the dialog
        • Other - sends event to secondary method that looks for combobox events
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Overrides:
        actionPerformed in class JDialogBase
        Parameters:
        event - Event that triggered this function.
      • compileReport

        public static final java.lang.String compileReport​(java.lang.String summary,
                                                           java.lang.String name,
                                                           java.lang.String email,
                                                           java.lang.String version,
                                                           java.lang.String os,
                                                           java.lang.String urgency,
                                                           java.lang.String description)
        Pulls system specifications from the user's computer and then compiles all appropriate fields together into a text document
      • sendReportWeb

        public static final void sendReportWeb​(java.lang.String summary,
                                               java.lang.String name,
                                               java.lang.String email,
                                               java.lang.String version,
                                               java.lang.String os,
                                               java.lang.String urgency,
                                               java.lang.String description,
                                               ReportBugBuilder.BugType bugType,
                                               java.util.ArrayList<java.lang.String> filePaths,
                                               java.util.ArrayList<java.lang.String> fileNames)
      • displayReportForm

        private void displayReportForm()
        Initializes GUI. Contains two sections, one for information on the system and the user, the other containing fields for describing the bug itself.
      • windowClosed

        public void windowClosed​(java.awt.event.WindowEvent event)
        Performs the following actions based on the command:
        • OK - creates a file using the currently selected image and the given file name and then attaches it to email
        • Insert - inserts the image into the description area and if a name is provided, attaches the image as a file as well
        Specified by:
        windowClosed in interface java.awt.event.WindowListener
        Overrides:
        windowClosed in class JDialogBase
        Parameters:
        event - Event that triggered this function.
      • loadFieldDefaults

        private void loadFieldDefaults()
        Tries to set the bug report field defaults based on system properties or last-entered data.
      • getNameDefault

        public static final java.lang.String getNameDefault()
      • getEmailDefault

        public static final java.lang.String getEmailDefault()
      • getUrgencyDefault

        public static final java.lang.String getUrgencyDefault()
      • saveFieldDefaults

        private void saveFieldDefaults()
        Saves the last-entered bug report field text for loading the next time the dialog is used.