diff --git a/src/main/java/forge/error/BugzReporter.java b/src/main/java/forge/error/BugzReporter.java index 70779f8a3b1..33534d1b4ed 100644 --- a/src/main/java/forge/error/BugzReporter.java +++ b/src/main/java/forge/error/BugzReporter.java @@ -7,11 +7,10 @@ import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; -import com.jgoodies.forms.layout.FormLayout; -import com.jgoodies.forms.layout.ColumnSpec; -import com.jgoodies.forms.layout.RowSpec; -import com.jgoodies.forms.factories.FormFactory; +import forge.Singletons; +import forge.model.BuildInfo; +import forge.model.FModel; import forge.properties.ForgePreferences; import javax.swing.JLabel; @@ -26,6 +25,7 @@ import javax.swing.JTextArea; import java.awt.Dimension; import javax.swing.JScrollPane; +import org.apache.log4j.Logger; import org.mantisbt.connect.MCException; import org.mantisbt.connect.axis.MCSession; import org.mantisbt.connect.model.CustomFieldValue; @@ -62,9 +62,13 @@ public class BugzReporter extends JDialog { private JComboBox cboVersion = new JComboBox(); private JComboBox cboSeverity = new JComboBox(); final JCheckBox chkReportAnonymously = new JCheckBox("Report Anonymously"); - private JTextField txtGit; + private JTextField txtSVN; + private JLabel lblAddInfo = new JLabel(); + private JTextArea txtSteps = new JTextArea(); - private static BugzReporter dialog = new BugzReporter(); + private static BugzReporter dialog = null; + + private IMCAttribute Severities[]; /** * Launch the application. @@ -79,15 +83,28 @@ public class BugzReporter extends JDialog { public void setDumpText(String dump) { txtErrorDump.setText(dump); + lblAddInfo.setText("Error Dump"); + cboCategory.setSelectedItem("New Crash Report"); } /** * Create the dialog. */ public BugzReporter() { + dialog = this; setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setResizable(false); + // Init Logger for Axis, which is used by Mantis Library + org.apache.log4j.ConsoleAppender appCON = new org.apache.log4j.ConsoleAppender(new org.apache.log4j.SimpleLayout(), "System.out"); + + org.apache.log4j.Logger logAxis= Logger.getLogger("org.apache.axis"); + logAxis.addAppender(appCON); + logAxis.setLevel(org.apache.log4j.Level.ERROR); + // Init Logger + + //System.out.println(System.getProperties().toString().replace(", ", "\n")); + MCSession mCS = null; try { @@ -105,13 +122,11 @@ public class BugzReporter extends JDialog { System.out.println("MCException - getCategories - " + e1.getMessage()); } - IMCAttribute sevs[] = {}; try { - sevs = mCS.getEnum(Enumeration.SEVERITIES); + Severities = mCS.getEnum(Enumeration.SEVERITIES); } catch (MCException e1) { System.out.println("MCException - getEnum - " + e1.getMessage()); } - final IMCAttribute imCA[] = sevs; IProjectVersion[] vers = {}; try { @@ -120,60 +135,25 @@ public class BugzReporter extends JDialog { System.out.println("MCException - getVersions - " + e1.getMessage()); } - setTitle("Bug Report"); - setBounds(100, 100, 500, 542); + BuildInfo bi = Singletons.getModel().getBuildInfo(); + + setTitle("Report Issue"); + setBounds(100, 100, 442, 575); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); - contentPanel.setLayout(new FormLayout(new ColumnSpec[] { - FormFactory.LABEL_COMPONENT_GAP_COLSPEC, - ColumnSpec.decode("35dlu"), - FormFactory.LABEL_COMPONENT_GAP_COLSPEC, - ColumnSpec.decode("16dlu:grow"), - FormFactory.LABEL_COMPONENT_GAP_COLSPEC, - ColumnSpec.decode("16dlu"), - FormFactory.LABEL_COMPONENT_GAP_COLSPEC, - ColumnSpec.decode("16dlu"), - FormFactory.LABEL_COMPONENT_GAP_COLSPEC, - ColumnSpec.decode("16dlu"), - FormFactory.LABEL_COMPONENT_GAP_COLSPEC, - ColumnSpec.decode("16dlu"), - FormFactory.LABEL_COMPONENT_GAP_COLSPEC, - ColumnSpec.decode("16dlu"), - FormFactory.LABEL_COMPONENT_GAP_COLSPEC, - ColumnSpec.decode("16dlu:grow"), - FormFactory.LABEL_COMPONENT_GAP_COLSPEC, - ColumnSpec.decode("16dlu"), - FormFactory.LABEL_COMPONENT_GAP_COLSPEC, - ColumnSpec.decode("16dlu"), - FormFactory.LABEL_COMPONENT_GAP_COLSPEC,}, - new RowSpec[] { - FormFactory.RELATED_GAP_ROWSPEC, - FormFactory.DEFAULT_ROWSPEC, - FormFactory.RELATED_GAP_ROWSPEC, - FormFactory.DEFAULT_ROWSPEC, - FormFactory.RELATED_GAP_ROWSPEC, - FormFactory.DEFAULT_ROWSPEC, - FormFactory.RELATED_GAP_ROWSPEC, - FormFactory.DEFAULT_ROWSPEC, - FormFactory.RELATED_GAP_ROWSPEC, - FormFactory.DEFAULT_ROWSPEC, - FormFactory.RELATED_GAP_ROWSPEC, - FormFactory.DEFAULT_ROWSPEC, - FormFactory.RELATED_GAP_ROWSPEC, - FormFactory.DEFAULT_ROWSPEC, - FormFactory.RELATED_GAP_ROWSPEC, - FormFactory.DEFAULT_ROWSPEC, - FormFactory.RELATED_GAP_ROWSPEC, - FormFactory.DEFAULT_ROWSPEC,})); + contentPanel.setLayout(null); { JLabel lblMantisUsername = new JLabel("Username"); - contentPanel.add(lblMantisUsername, "2, 2, right, default"); + lblMantisUsername.setHorizontalAlignment(SwingConstants.RIGHT); + lblMantisUsername.setBounds(10, 16, 75, 14); + contentPanel.add(lblMantisUsername); } { txtUserName = new JTextField("ForgeGUI"); + txtUserName.setBounds(90, 13, 185, 21); txtUserName.setFont(new Font("Dialog", Font.PLAIN, 11)); - contentPanel.add(txtUserName, "4, 2, 9, 1, fill, default"); + contentPanel.add(txtUserName); txtUserName.setColumns(4); try { @@ -190,6 +170,7 @@ public class BugzReporter extends JDialog { } } { + chkReportAnonymously.setBounds(284, 11, 139, 25); chkReportAnonymously.setFont(new Font("Dialog", Font.PLAIN, 12)); chkReportAnonymously.setHorizontalAlignment(SwingConstants.CENTER); @@ -208,75 +189,90 @@ public class BugzReporter extends JDialog { } }); - contentPanel.add(chkReportAnonymously, "14, 2, 7, 1, center, default"); + contentPanel.add(chkReportAnonymously); } { JLabel lblMantisPassword = new JLabel("Password"); - contentPanel.add(lblMantisPassword, "2, 4, right, default"); + lblMantisPassword.setHorizontalAlignment(SwingConstants.RIGHT); + lblMantisPassword.setBounds(10, 45, 75, 14); + contentPanel.add(lblMantisPassword); } { + txtPassword.setBounds(90, 42, 185, 21); txtPassword.setFont(new Font("Dialog", Font.PLAIN, 11)); - contentPanel.add(txtPassword, "4, 4, 9, 1, fill, default"); + contentPanel.add(txtPassword); } { JSeparator separator = new JSeparator(); - contentPanel.add(separator, "2, 6, 19, 1"); + separator.setBounds(10, 69, 417, 2); + contentPanel.add(separator); } { JLabel lblCategory = new JLabel("Category"); + lblCategory.setBounds(10, 81, 75, 14); lblCategory.setFont(new Font("Tahoma", Font.BOLD, 11)); lblCategory.setHorizontalAlignment(SwingConstants.RIGHT); - contentPanel.add(lblCategory, "2, 8"); + contentPanel.add(lblCategory); } { + cboCategory.setBounds(90, 77, 223, 22); cboCategory.setFont(new Font("Dialog", Font.BOLD, 10)); if (cats.length > 0) { for (int i=0; i

Additional
Information

"); + lblAddInfo.setBounds(10, 294, 75, 40); + lblAddInfo.setFont(new Font("Dialog", Font.PLAIN, 12)); + lblAddInfo.setHorizontalAlignment(SwingConstants.RIGHT); + + contentPanel.add(lblAddInfo); } { JScrollPane scrollPane = new JScrollPane(); - contentPanel.add(scrollPane, "4, 14, 17, 1, fill, fill"); + scrollPane.setBounds(90, 254, 337, 120); + contentPanel.add(scrollPane); { txtErrorDump.setFont(new Font("Monospaced", Font.PLAIN, 10)); scrollPane.setViewportView(txtErrorDump); @@ -285,129 +281,119 @@ public class BugzReporter extends JDialog { txtErrorDump.setBorder(null); txtErrorDump.setLineWrap(true); txtErrorDump.setWrapStyleWord(true); - txtErrorDump.setRows(10); + txtErrorDump.setRows(8); } } { - JLabel lblNewLabel_1 = new JLabel("Version"); - lblNewLabel_1.setFont(new Font("Dialog", Font.PLAIN, 12)); - contentPanel.add(lblNewLabel_1, "2, 16, right, default"); + JLabel lblVersion = new JLabel("Version"); + lblVersion.setHorizontalAlignment(SwingConstants.RIGHT); + lblVersion.setBounds(20, 468, 65, 16); + lblVersion.setFont(new Font("Dialog", Font.PLAIN, 12)); + contentPanel.add(lblVersion); } { + cboVersion.setBounds(90, 465, 160, 22); cboVersion.setFont(new Font("Dialog", Font.BOLD, 10)); + cboVersion.addItem(""); if (vers.length > 0) { - for (int i=0; i " + rx); + + if (curVer.equals("SVN")) { + cboVersion.setSelectedItem("SVN"); + } else { + for (int i=0; i 0) { - for (int i=0; i 0) { + for (int i=0; i

Steps to
Reproduce

"); + lblSteps.setHorizontalAlignment(SwingConstants.RIGHT); + lblSteps.setFont(new Font("Dialog", Font.PLAIN, 12)); + lblSteps.setBounds(10, 400, 75, 40); + contentPanel.add(lblSteps); } { JPanel buttonPane = new JPanel(); + buttonPane.setOpaque(false); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton cmdReport = new JButton("Report"); cmdReport.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { -Report: { - MCSession rep = null; - if (!chkReportAnonymously.isSelected()) { - - try { - rep = new MCSession(new URL("http://cardforge.org/bugz/api/soap/mantisconnect.php"), txtUserName.getText(), String.valueOf(txtPassword.getPassword())); - } catch (MalformedURLException e) { - System.out.println("MalFormedURLException"); - } catch (MCException e) { - System.out.println("MCException - new MCSession - " + e.getMessage()); - JOptionPane.showMessageDialog(null, "MCException - new MCSession - " + e.getMessage(), "Bug Report", JOptionPane.INFORMATION_MESSAGE); - break Report; - } - } else { - try { - rep = new MCSession(new URL("http://cardforge.org/bugz/api/soap/mantisconnect.php"), "ForgeGUI", "vi2ccTbfBUu^"); - } catch (MalformedURLException e) { - System.out.println("MalformedURLException"); - } catch (MCException e) { - System.out.println("MCException - new MCSession - " + e.getMessage()); - JOptionPane.showMessageDialog(null, "MCException - new MCSession - " + e.getMessage(), "Bug Report", JOptionPane.INFORMATION_MESSAGE); - break Report; - } - } - - IIssue iBug = null; - try { - iBug = rep.newIssue(1); - } catch (MCException e) { - System.out.println("MCException - newIssue - " + e.getMessage()); - JOptionPane.showMessageDialog(null, "MCException - newIssue - " + e.getMessage(), "Bug Report", JOptionPane.INFORMATION_MESSAGE); - break Report; - } - - iBug.setCategory(cboCategory.getSelectedItem().toString()); - iBug.setSummary(txtSummary.getText()); - iBug.setDescription(txtDescription.getText()); - iBug.setAdditionalInformation(txtErrorDump.getText()); - iBug.setVersion(cboVersion.getSelectedItem().toString()); - - for (int i=0; i